PDF Automation Station

PDF Automation Station

Using JavaScript To Add JavaScript to a PDF Part 2

Using JavaScript instead of the Acrobat user interface can automate the process of adding scripts to PDFs

David Dagley's avatar
David Dagley
Mar 02, 2024
∙ Paid
1
Share

In Using JavaScript To Add JavaScript to a PDF Part 1 I outlined how to add document level scripts, page action scripts, and document action scripts using JavaScript. In this article I will outline how to use JavaScript to add scripts to form fields. The setAction method for form fields has two mandatory input parameters:

  1. cTrigger (A string that sets the trigger for the action).

  2. cScript (The JavaScript to be executed).


Get the course above, and a suite of automation tools for FREE with a Professional subscription.


Triggers

The following cTrigger parameters can be used to execute the script:

  • MouseUp (After the mouse button is pressed down and released back up)

  • MouseDown (After as the mouse button is pressed down)

  • MouseEnter (As soon as the mouse cursor enters the field area)

  • MouseExit (As soon as the mouse cursor exits the field area)

  • OnFocus (When the field receives the focus, either by clicking inside the field with the mouse, or tabbing into the field from another field)

  • OnBlur (When the field loses the focus, either by tabbing out of the field, or clicking the mouse anywhere else inside the program, including toolbars and white space on the page.).

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 David Dagley
Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture