DynaPDF Manual - Page 126

Previous Page 125   Index   Next Page 127

Function Reference
Page 126 of 777
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