Skip to content

Locate JavaScripts

Nitro PDF Pro stores JavaScripts in five locations. Use this article to find a script that you wrote, or to find a script that you want to study. 

Field scripts

You can add a script to any field type. Each field type supports scripts in its Set Actions properties. Signature fields also support scripts in their Signed properties.

Text fields offer the most options for scripts. In a text field, you can add a script to:

  • Format properties.  Open the Format properties, and select Custom from the Select format category list. Use this option to create a custom format script and a custom keystroke script. 
  • Validate.  Open the Validate properties, and select Use custom validation script. Use this option to validate field data. 
  • Calculate. Use this option to calculate field data. You can write a script in two ways:
    • Click Simplified field notation to write a formula. This method uses syntax similar to spreadsheet formulas.
    • Click Custom calculation script to write a full JavaScript.
  • Add Action.  Like other field types, text fields support the Run a JavaScript action. 

JavaScript console

 The JavaScript Console holds a script that is not attached to a field or other document element. Use the console to test routines and debug code. 

To add a document action:

  1. On the Forms ribbon, in the Document Setup group, click the arrow besides the JavaScript button and select ConsoleDocument setup

Document Actions

Opening, saving, and printing a PDF are document actions. You can attach a JavaScript to each of these actions.

To add a document action:

  1. On the Forms ribbon, in the Document Setup group, click the arrow besides the JavaScript button and select Document ActionsDocument setup
  2. In the Set Document Actions window, select the document action and click Edit to enter the script or clear to remove itSet Document Actions JS

 


Document level JavaScripts

A document-level JavaScript stores a function. Other scripts in the same document can call this function.

The document stores this type of script. You can run the script from another script, or when a user opens the file.

To write a document level JavaScript:

  1. On the Forms ribbon, in the Document Setup group, click the arrow besides the JavaScript button and select Document ActionsDocument setup
  2. Click New, and type a name for the JavaScriptDocument JavaScript Dialog
  3. In the JavaScript Editor dialog, enter your codeJS Editor
  4. Click Execute and OK

 

Folder level JavaScripts

A folder-level JavaScript is a script file (.js) that is stored outside the PDF file. More than one PDF can use this type of script.

To add or edit a folder level JavaScript

  1. On the Forms ribbon, in the Document Setup group, click on the arrow next to JavaScript, and then select Folder Level

     

    Document setup

     

  2.  The directory where the JavaScripts are stored opens

  3. Add a new JavaScript file to the folder, or edit an existing file 


Nitro PDF Pro runs folder-level scripts when the application starts.



 

Last updated: June 16, 2026