Other PDF Issues

How to Create an Acrobat Action to Run JavaScript in PDF

Olivia MillerOlivia Miller Oct 28, 2026 869 views

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.

How to Create an Acrobat Action to Run JavaScript
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the Action Wizard

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.

2
Add the Execute JavaScript Tool

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.

3
Insert Your JavaScript Code

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.

4
Save and Access Your Action

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.

Use the Action Wizard to Execute JavaScript
Testing Your Script: Before running the newly created JavaScript action on important files, apply it to a test copy of your PDF to ensure the script functions exactly as intended without causing document corruption.
Free Microsoft Office alternative

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. 1. Download and Install: Get WPS Office from the official website and complete the lightweight installation process.
  2. 2. Open Your Document: Launch the application and select the 'PDF' tab to open and manage your documents.
  3. 3. Edit and Convert: Use the built-in toolkit to edit text, manage pages, or convert the PDF to other fully compatible Office formats.
Comprehensive PDF editor for reading, commenting, and modifying text effortlessly.Fully compatible with Microsoft Office formats (Word, Excel, PowerPoint) and standard PDFs.Lightweight installation with a familiar, user-friendly interface for seamless migration.Built-in tools to convert PDFs to editable Word, Excel, and PowerPoint documents instantly.
microsoft office alternative - wps office

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.