Using JavaScripts

You can add custom JavaScript actions to your PDF files.

javascript icon

Click JavaScript at Edit > Tools and choose from the following:
 

To add JavaScript actions to PDF document events

  1. Choose Set Document Actions.

  2. Select the Document event in the left window.

  3. Click the Edit button.

  4. Write your JavaScript in the JavaScript Editor text window.

  5. Repair any reported syntax errors and click OK again.

  6. Click OK.

To edit your script directly

  1. Choose JavaScript Console.

  2. Compile your script.

To create custom scripts

  1. Choose Document JavaScripts.

  2. Click Add.

  3. Name your script for identification and click OK.

  4. Click Edit, and compile your script. When done, click OK.

  5. Click Close to finish.

Provided that your script is correct, and it is supported by the version of your PDF, the set event will execute the specified action.

 

Example

E-mailing the PDF that you have just saved:

  1. Select Document Save Completed in the Set Document Actions dialog.

  2. Click Edit.

  3. Type in the following script: this.mailDoc(true);

  4. Click OK.

After you have successfully saved the PDF, a new, blank e-mail message will pop-up with your PDF attached to it.

 

To enable or disable Javascript in the program, go to File > Options > JavaScript.

 

Disable JavaScript if it is creating undesired actions in PDF files you receive or to respect compliance requirements. JavaScript actions may be vulnerable to malware attacks.