Run Acrobat JavaScript from Another Script: Fix the Undefined app Error
Question details
The user wants to run Acrobat's sdkAddSignature.js from another JavaScript file without displaying Acrobat.

- Product
- Adobe Acrobat JavaScript SDK
- Device & OS
- not provided
- Scenario
- An external JavaScript file attempts to call an Acrobat application-level script to add a signature.
- Observed behavior
- The external script reports that app is undefined because the Acrobat JavaScript object is not available in its runtime.
Open Acrobat and the PDF you want to work with, and check the SDK documentation for the functions and permissions required by sdkAddSignature.js. Make sure Acrobat JavaScript is enabled in Acrobat's preferences.
Call the SDK functions inside Acrobat
Use Acrobat's JavaScript environment instead of executing the application-level file in an external JavaScript runtime.
The app object belongs to Acrobat's JavaScript engine; it is not available in a general-purpose JavaScript runtime. Acrobat must be running and the target document open for this workflow.
The SDK functions may require a folder-level script or another trusted context. Follow the SDK's instructions and Acrobat's security requirements rather than assuming every function can run from a document script.
In Acrobat, open Preferences and select JavaScript. Enable Acrobat JavaScript if it is disabled.
Follow the Acrobat SDK instructions to install the required functions as a folder-level script or place suitable code in an Acrobat document script. Restart Acrobat if you install a folder-level script.
In Acrobat, select File > Open and open the PDF to be signed.
Use Acrobat's JavaScript console or an appropriate Acrobat document script to call the function specified by the SDK, with its required arguments and security context.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility helps you move existing files into WPS, but it does not run Acrobat SDK JavaScript or fix Acrobat's app object.

Frequently Asked Questions
Why is app undefined when I run the script externally?
The app object is provided by Acrobat's JavaScript engine. An external JavaScript runtime does not have that object, so the SDK file cannot be called directly there.
Can I run sdkAddSignature.js without opening Acrobat?
Not by calling the application-level file from external JavaScript. This Acrobat JavaScript workflow requires Acrobat to be running and the target document to be open.
Where should I put the Acrobat JavaScript functions?
Depending on the SDK's requirements, use an Acrobat folder-level script, a document script, or another appropriate trusted Acrobat JavaScript context. Check the SDK documentation for the function's installation and security requirements.
How do I enable JavaScript in Acrobat?
Open Acrobat Preferences, select JavaScript, and enable Acrobat JavaScript. Some functions may still require additional trust or permissions.
Can WPS Office execute Acrobat SDK JavaScript?
WPS Office can open PDF and Microsoft Office files, but it does not provide the Acrobat JavaScript engine needed to run Acrobat SDK scripts.




