How to Access Document-Level JavaScript in Acrobat Reader Mobile
Question details
The user is unable to call document-level JavaScript functions from field actions within Acrobat Reader Mobile because the document object is not exposed.

- Product
- Acrobat Reader for Mobile
- Device & OS
- Mobile
- Scenario
- Attempting to execute centralized, document-level JavaScript functions from specific field-action scripts in a PDF form on a mobile device.
- Observed behavior
- Field-action scripts cannot access document-level functions because methods like this.doc or event.target.doc are not supported or exposed in the mobile version of the reader.
Keep in mind that mobile PDF readers utilize a highly restricted JavaScript engine compared to desktop versions, primarily to maintain strict security and optimize battery performance.
Embed Logic Directly into Field-Action Scripts
Since mobile PDF readers do not support calling external document-level functions, you must place the required JavaScript logic directly inside the field properties.
Acrobat Reader Mobile limits access to the Document Object Model (DOM). To make your interactive PDF forms work on mobile, you need to bypass document-level script calls and make each field script self-contained.
Open your PDF file in a desktop PDF editor. Go to the JavaScript tools and locate the document-level functions you originally created.
Copy the specific lines of code that perform the calculation, validation, or formatting you need, ignoring the function wrapper.
Right-click the target form field and select Properties. Navigate to the Actions tab, select 'Run a custom script', and paste the core logic directly into the script editor.

Open the PDF Using a Desktop Application
For complex PDF forms that rely heavily on central document-level scripts, opening the file in a desktop environment is the most reliable solution.
Looking for a Seamless Way to Manage PDFs and Documents?
If you frequently work with complex documents, forms, and scripts, consider WPS Office. It provides a comprehensive suite of tools for Word, Excel, PowerPoint, and PDF files in a single lightweight application.
- 1. Download WPS Office: Visit the official WPS website or your device's app store to download the free application.
- 2. Install and Launch: Follow the simple installation prompts and open WPS Office on your mobile device or computer.
- 3. Open Your Documents: Use the integrated file manager to open and manage your PDFs, Word documents, Excel spreadsheets, and PowerPoint presentations seamlessly.

Frequently Asked Questions
Why does this.doc return undefined in Acrobat Reader Mobile?
Acrobat Reader for Mobile uses a restricted JavaScript engine for security and performance reasons. It does not expose the full Document Object Model (DOM) or document-level functions to field-action scripts.
Are there alternative methods to access the document object on mobile?
Currently, neither iOS nor Android versions of Acrobat Reader expose the document object (such as event.target.doc) to field scripts. The logic must be rewritten to run locally within the field action itself.
Will my PDF form's JavaScript work on all mobile PDF apps?
Most mobile PDF applications have highly limited or no support for JavaScript within PDF forms. If your form requires complex scripting, it is heavily recommended to instruct users to fill it out on a desktop computer.
Does desktop Adobe Reader support document-level JavaScript?
Yes, desktop versions of Adobe Acrobat and Reader for Windows and macOS fully support document-level JavaScript, allowing you to centralize functions and call them from any form field without issue.




