Scope: All Acrobat versions
Skill Level: Beginner
The Document Script is where initialization code is placed, such as setting the disclosed property. However, at the time the document scripts are run the PDF may not be fully loaded. This can cause problems with code statements that access fields and annotations, or display user interface items like popup menus and dialogs. If you have problems with initialization, move the troublesome parts of the code to the Page Open script for the first page. The Page Open Script is loaded and run after initialization is complete.
To edit an existing script or create a new script use the menu item
This menu item displays the Document Scripts Dialog (Figure 1). A PDF may contain several Document Scripts. These scripts are displayed in the dialog in the same order Acrobat loads and runs them. Be careful with this ordering if you create scripts that depend on variables defined in another script. When new scripts are added using this dialog Acrobat tries to place them in alphabetical order, so naming usually controls order. This system breaks down when existing scripts are not already in alphabetical order.
Figure 1 – Editing and Creating Document Scripts
To Edit a script: select it from the list of scripts and
press the Edit… button.
To Create a new script: Enter a new Script Name and
press the Add… button.
|Edit PDF, create PDF, Action Wizard|