JavaScript links

Some PDF viewers include a scripting engine which can run a script when the user clicks on a link. A link created by setting Link to Target using attribute in a mapping can execute a JavaScript program if the attribute value starts with a nominated prefix string. The prefix value is set with the pdf.javascript.prefix metadata value.

For example, the following could be used to set the prefix in the $document mapping:

<meta name="pdf.javascript.prefix" string="js:"/>

and the following to create a link that opens the print dialog:

<Action script="js:this.print()">PRINT</Action>

where the %Action mapping uses the script attribute to create the link.

For more information on JavaScript support in PDFs, visit www.adobe.com.