Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Use Markdown for this comment
Set severity, which reflects how much the issue affects the use of the product
Change issue status back to 'Assigned'
Pending code changes (auto-populated)
[ID: 1388909]
[ID: 1388852]
[ID: 1388884]
0: low
5: moderate
10: good [ID: 1388853]
[ID: 84481]
processed = processed by automation
triaged = validated by human
blocked = depends on another issue
information_requested = depends on reporter supplying additional information
unblocked = the issue is no longer blocked, but may not be fixed
fixed = a change was submitted but may not be deployed fully [ID: 1245093]
[ID: 1388836]
[ID: 1385984]
Set the version(s) of the product affected by this issue (comma-separated list)
Set the version(s) of the product in which the issue should be fixed (comma-separated list)
Set the version(s) of the product in which the issue fix was verified (comma-separated list)
Set if this issue occurs in production
Remove item
Show all 5 items in the list
Tags used for linking issues. [ID: 1172495]
Set Reporter
Set Type
Set priority, which reflects how soon the issue should be fixed
Set Status
Set Assignee
Set Verifier
View or edit staffing
View issue level access limits(Press Alt + Right arrow for more information)
Description
The built-in PdfApp class is consistently undefined in Google Apps Script, causing a ReferenceError whenever it's used. This issue occurs even in brand new, minimal Apps Script projects, and persists across multiple troubleshooting steps, strongly suggesting a problem outside of the specific project code or deployment. The issue occurs regardless of whether the script is run directly from the editor or from a deployed web app. The issue is not related to spreadsheet data, as a simplified test case using UrlFetchApp to get a public PDF also fails.
Create a new Google Apps Script project (script.google.com).
Replace the contents of Code.gs with the following code:
JavaScript
function testPdfApp() { try { // Use a publicly accessible PDF URL for testing. const pdfUrl = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf "; // Example public PDF
} catch (error) { console.error("PdfApp test failed:", error, error.stack); } } Save the project.
Select the testPdfApp function from the dropdown menu.
Click "Run".
Authorize the script when prompted (it needs permission for UrlFetchApp).
Go to "View" -> "Executions" (or click the "Executions" icon in the left sidebar).
Observe the error: ReferenceError: PdfApp is not defined
The testPdfApp function should run without error. The "Executions" log should show either "PdfApp is working! Form found." or "PdfApp is working, but no form found." This would indicate that the PdfApp class is correctly defined and accessible.
The script throws the following error:
ReferenceError: PdfApp is not defined at testPdfApp (Code:8:20) // Line number might vary slightly ... (rest of the stack trace) ... 6. Troubleshooting Steps Already Taken:
Created a brand new Apps Script project (multiple times). Used the simplest possible code to test PdfApp. Verified that the script is authorized to access external services (due to UrlFetchApp). Tried running the script directly from the Apps Script editor. Tried deploying the script as a web app (various configurations) and accessing it: In incognito/private browsing mode. After clearing the browser cache and cookies completely. After disabling all browser extensions. In different browsers (Chrome, Safari, and potentially others - SPECIFY WHICH BROWSERS YOU TRIED). [If applicable, add: "On a different computer/device."] [If applicable, add: "On a different network."] Tried a different Google Account Verified that the spreadsheet ID, sheet name, and PDF file ID are correct (when testing with the full diploma generation code). Verified that the PDF file is accessible (and shared correctly for testing). Used console.log extensively to trace the execution flow and data. Ruled out issues with google.script.run (it works for other function calls). Ruled out issues with date formatting or incorrect field names (by using the minimal testPdfApp code). Confirmed I see the "Web App Loaded" Alert 7. Environment:
Browser(s): [Specify the exact browser(s) and version(s) you've tested. For example: "Chrome Version 121.0.6167.184 (Official Build) (64-bit)", "Safari Version 17.3.1 (19617.2.4.11.12)"] Operating System(s): [Specify the operating system(s) you've tested. For example: "Windows 10", "macOS Sonoma 14.3.1", "Android 13", "iOS 17"] Google Account Type: [Specify whether you're using a personal @gmail.com account, or a Google Workspace account (e.g., a work or school account). If it's a Workspace account, mention the type if you know it (e.g., "Google Workspace for Education", "Google Workspace Business Standard").] Network: [Home, Office, Mobile Data] 8. Additional Information:
This issue has been reproduced consistently across multiple attempts and after extensive troubleshooting. Other Google Apps Script services (e.g., SpreadsheetApp, DriveApp, UrlFetchApp) appear to be working correctly within the script editor. The issue seems specific to PdfApp and potentially related to how Apps Script handles web app deployments, although the google.script.run API does work for simple function calls. The problem has persisted for [State how long you've been experiencing this issue]. I have attached a link to the spreadsheet:https://docs.google.com/spreadsheets/d/1NiPvL-eSvh8dorMylFsQTAwbMKuYiAdv-TulZ93nJoY/edit?usp=sharing
Here is a link to the fillable PDF: https://drive.google.com/file/d/1jjv-577v3E285uDvbPlhG024bZzw2tfx/view?usp=drive_link
9. Request:
Please investigate why the PdfApp class is undefined in my Apps Script environment. This is preventing me from using a core Apps Script feature. I need a resolution to this issue to proceed with my project.