DynaPDF Manual - Page 287

Previous Page 286   Index   Next Page 288

Function Reference
Page 287 of 839
CreateOCG
Syntax:
SI32 pdfCreateOCG(
const PPDF* IPDF,
// Instance pointer
const char* Name,
// Layer name (required)
LBOOL DisplayInUI, // Display the OCG in the user interface?
LBOOL Visible,
// Intitial state of the OCG
TOCGIntent Intent) // see below
typedef enum
{
oiDesign = 2,
oiView
= 4, // Default
oiAll
= 8,
oiEmpty
= 16 // Internal (refers to oiView if used)
}TOCGIntent;
The function creates an Optional Content Group (OCG). Content that belongs to an OCG can be
made visible or invisible dynamically by users of conforming readers. OCGs are mostly called
Layers because Optional Content and Layers share the same basic functionality. A layer is a piece of
content that is associated with an OCG.
The parameter DisplayInUI specifies whether the OCG should be displayed in the user interface of a
PDF viewer. The state of invisible layers (the ones which are not displayed in the user interface) can
only be changed programmatically, e.g. with a SetOCGState or Javascript actions. Also if
DisplayInUI is set to false, the parameter Name is still required.
If DisplayInUI is set to true the layer will be added to the root of the layer tree. To reflect nesting
levels, layer groups and so on, it is also possible to configure the layer tree manually with
AddLayerToDisplTree(). The parameter DisplayInUI should be set to false in this case so that the
layer will not already be added to the tree.
The parameter Visible specifies the initial state of the OCG. If set to false, contents that belongs to this
OCG remains invisible until the state will be changed due to interaction with the user interface or
programmatically with a SetOCGState or Javascript action.
The parameter Intent specifies the intended use of the graphics in the group. It provides a way to
distinguish between different intended uses of optional content. For example, many document
design applications, such as CAD packages, offer layering features for collecting groups of graphics
together and selectively hiding or viewing them for the convenience of the author. However, this
layering may be different (at a finer granularity, for example) than would be useful to consumers of
the document. Therefore, it is possible to specify different intents for optional content groups within
a single document. A conforming reader may decide to use only groups that are of a specific intent.
The Intent entry can be used to create different configurations for viewing and design applications.
However, this functionality is not yet implemented in DynaPDF.
 

Previous topic: CreateNewPDF

Next topic: How to make content optional?