Nitro PDF Professional 4.9
Product Manual
Writing document level scripts
Document level scripts are used to add functions from which other
scripts can reuse routines throughout a PDF file. You can also use
document level JavaScripts to invoke actions when a file opens.
To write a document level JavaScript:
- Open a PDF file and select Document > JavaScript > Document JavaScripts.
- Click Add in the JavaScript Functions window.
- Type a name for your function when prompted in the Set Document JavaScript dialog box and click OK.
- In the right pane, select all the default text and press Delete.
- Click in the right pane and type a JavaScript routine. In the
example below, a simple routine is created that opens an
alert dialog box each time the file opens in Nitro PDF Professional. The code
used is:
var msg = "Created in ARTS Nitro PDF Desktop"
app.alert(msg)

- Click Close. If your script was written properly, a dialog box
opens displaying the message.
