How to Create an Acrobat Action to Run JavaScript in PDF
Question details
The user wants to set up a custom Action or button in Acrobat to execute document-level JavaScript for automating tasks like preserving PDF metadata.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Automating repetitive PDF tasks or preserving specific document metadata using custom scripts.
- Observed behavior
- The user needs a step-by-step method to set up, save, and access a JavaScript execution command via a one-click button or Action Wizard.
Ensure you have the exact JavaScript code you intend to run ready, and always duplicate your PDF file to test the script before applying it to your production documents.
Use the Action Wizard to Execute JavaScript
Set up a reusable custom Action using Acrobat's built-in tools to run your JavaScript across one or multiple PDF files.
By utilizing the Action Wizard, you can create a customized workflow that executes document-level JavaScript. This allows you to apply automated changes, such as modifying creation dates or updating metadata, consistently across your files.
Launch Adobe Acrobat, navigate to the 'Tools' tab, and select 'Action Wizard' (or 'Actions'). Click on 'New Action' in the toolbar to start configuring your custom workflow.
In the New Action dialog box, look at the left panel and expand the 'More Tools' category. Select 'Execute JavaScript' and click the '+' or 'Add' button to move it into the action steps on the right.
Click 'Specify Settings' on the newly added Execute JavaScript step. Paste or type your document-level JavaScript into the editor window, then click 'OK' to confirm.
Click 'Save' and give your new Action a descriptive name. For one-click access in the future, you can right-click the saved Action and choose to add it to your Quick Tools toolbar.

Try WPS Office for Seamless Document and PDF Management
While advanced JavaScript action wizards are specific to Adobe Acrobat, WPS Office provides a highly capable, lightweight, and free alternative for managing, editing, and converting PDF documents alongside your standard Office files.
- 1. Download and Install: Get WPS Office from the official website and complete the lightweight installation process.
- 2. Open Your Document: Launch the application and select the 'PDF' tab to open and manage your documents.
- 3. Edit and Convert: Use the built-in toolkit to edit text, manage pages, or convert the PDF to other fully compatible Office formats.

Frequently Asked Questions
Will document-level JavaScript run on all PDF viewers?
No, JavaScript execution depends on the specific PDF viewer's engine. While Acrobat fully supports it, basic PDF readers or standard web browsers may block or ignore JavaScript for security reasons.
Can I apply a custom Action to multiple PDF files at once?
Yes, when setting up an Action in the Action Wizard, you can specify 'Files to be Processed' and add entire folders, allowing the JavaScript to run across multiple PDFs in a batch process.
How do I remove an Action from the Quick Tools toolbar?
Right-click anywhere on the Quick Tools toolbar, choose 'Customize Quick Tools', locate your custom Action under the Action Wizard tools, and select the remove or trash icon to take it off the toolbar.




