
Using Help
|
Contents
|
Index
Back
183
Adobe Acrobat Help
Adding Interactivity
Using Help
|
Contents
|
Index
Back
183
Working with document level JavaScript actions
In addition to JavaScript functions that can be accessed by any JavaScript in the current
document, you can create document level JavaScript actions that apply to the entire
document. When you do something that affects the entire document, like printing it, the
document level action applied to that occurrence will run. You create and edit the JavaS-
cript code in the editor of your choice.You can later edit all your document level JavaScript
actions at once.
To set a document level JavaScript action:
1
Choose Tools > JavaScript > Set Document Actions.
2
In the Document Actions dialog box, choose the appropriate document occurrence.
•
Document Will Close runs the JavaScript while the document closes.
•
Document Will Save runs the JavaScript while the document is saved.
•
Document Did Save runs the JavaScript after the document is saved.
•
Document Will Print runs the JavaScript while the document is printed.
•
Document Did Print runs the JavaScript after the document is printed.
3
Click Edit. A JavaScript editor appears (you can set a default JavaScript editor in the
Preferences dialog box).
4
Enter your code into the editor and click OK. If you are using an external editor, follow
the editor’s instructions. You will have to save your code and close the editor window
before returning to Acrobat.The code is entered into the Execute this JavaScript section of
the dialog box, and a green circle appears next to the occurrence to show that a JavaScript
action is set for it.
5
Click OK.
To delete a document level JavaScript action:
1
Choose Tools > JavaScript > Set Document Actions.
2
In the Document Actions dialog box, choose the document occurrence whose JavaS-
cript you want to remove.
3
Click Edit.
4
In the JavaScript editor, delete the code and click OK.
5
Click OK to close the Document Actions dialog box.
To edit all document level JavaScript actions:
1
Choose Tools > JavaScript > Set Document Actions.
2
Click Edit All. All scripts for the file will appear. Select the document level scripts.
3
Edit the code in the editor, then click OK.
4
In the dialog box, click OK.
To set a default JavaScript editor:
1
Choose Edit > Preferences > General.
2
Choose JavaScript from the list on the left.
3
In the JavaScript editor section, select the appropriate option.