Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 122

Previous Page 121   Index   Next Page 123

Function Reference
Page 122 of 750
SI32 pdfAddJavaScript(
const PPDF* IPDF,
// Instance pointer
const char* Name,
// Name of the script (required)
const char* Script) // JavaScript (required)
The function adds a global JavaScript to the PDF file. The parameter Name must be a unique name to
identify the script in the user interface:
Note that the name is NOT used to identify a function inside the JavaScript. The parameter Script
must be a JavaScript function or a set of JavaScript functions. DynaPDF does not check whether the
script is valid. A JavaScript is always stored unchecked and unchanged to the PDF file. The
JavaScript functions inside a script can be used by JavaScript actions to enable parameterized
function calls (see also CreateJSAction()).
This function is implemented in an Ansi and Unicode compatible version. Because JavaScript 1.2 is
not Unicode compatible, Unicode encoded scripts are translated to a platform specific encoding prior
to interpretation by the JavaScript engine. Note that there is no advantage when using Unicode
encoded scripts in a PDF file. To avoid unnecessary problems JavaScripts should be stored in Ansi
Return values:
If the function succeeds the return value is the handle of the JavaScript, a value greater or equal zero.
If the function fails the return value is a negative error code.

Previous topic: AddInkList

Next topic: AddLayerToDisplTree