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

DynaPDF Manual - Page 127

Previous Page 126   Index   Next Page 128

Function Reference
Page 127 of 750
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
LBOOL pdfAddOCGToAppEvent(
const PPDF* IPDF,
// Instance pointer
UI32 Handle,
// OCG handle
TOCAppEvent Events,
// Bitmask, see below
TOCGUsageCategory Categories) // Bitmask, see below
typedef enum
aeExport = 1,
= 2,
= 4
The categories refer to the members of a Content Usage dictionary. See SetOCGContUsage() for
further information.
typedef enum
= 0,
= 1,
oucLanguage = 2,
= 4,
= 8,
= 16,
= 32
The function adds an Optional Content Group (OCG) to an application event. PDF defines three
events, in which the state of layers or OCGs can be dynamically changed depending on settings in
Content Usage Dictionaries, which are associated to OCGs. A Content Usage dictionary must be
created or added to an OCG with SetOCGContUsage() before this function can be called.
The Content Usage dictionary can define multiple settings which control the visibility state, e.g. the
whished Export and Print state. The parameter Categories is a bitmask, so that more than one
category can be used in a specific event. The parameter Event is a bitmask too, so that the OCG can
be added to multiple events in just one function call.
The function makes sure that only valid categories can be added to a specific event. If the Content
Usage dictionary contains no settings for a specific category, then this category will be masked out
from the parameter Categories. If no more category remains then the OCG will not be added to the
For example, if the Content Usage dictionary contains settings for exporting and printing, then it is
possible to add the OCG to the Export and Print events in just one pass:

Previous topic: AddObjectToLayer

Next topic: AddOutputIntent