DynaPDF Manual - Page 146

Previous Page 145   Index   Next Page 147

Function Reference
Page 146 of 839
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()).
Remarks:
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 format.
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.
AddLayerToDisplTree
Syntax:
LGRP* pdfAddLayerToDisplTree(
const PPDF* IPDF,
// Instance pointer
LGRP* Parent,
// Parent node or NULL
SI32 Layer,
// Layer (OCG) handle or -1
const char* Title) // Group title or NULL
The function adds a layer or group to the layer display tree. The layer display tree is used in viewer
applications to show the available layers in a PDF file and to interactively hide or unhide layers.
If we talk about a layer then we mean a handle of an OCG (Optional Content Group, see section
Layers (Optional Content) for further information). OCMDs (Optional Content Membership
Dictionaries) cannot be added to the tree, since OCMDs represent a visibility expression and no
layer that can be displayed or hidden.
Note that the function CreateOCG() adds a layer automatically to the display tree if the parameter
DisplayInUI was set to true. So, the parameter must be set to false if you want to build the tree
manually.
The display tree consists of nested arrays. A sub array represents a new group which can optionally
contain a title, one or more layers, or both. The order in which layers are added or how they are
grouped can be freely choosen. However, it is usually best to create a layer tree with the same order
and nesting levels as in the document. Layers which were not added to the tree will not be
displayed in a viewer. This can be useful if a user should not be able to change the state of a layer
interactively.
It is also possible to lock layers if necessary (see LockLayer() for further information).
 

Previous topic: AddInkList, AddJavaScript

Next topic: AddMaskImage