DynaPDF Manual - Page 145

Previous Page 144   Index   Next Page 146

Function Reference
Page 145 of 818
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
wished 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
event.
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:
pdfAddOCGToAppEvent(pdf,
ocg,
TOCAppEvent(aeExport | aePrint),
TOCGUsageCategory(oucExport | oucPrint));
In the above example only the category oucExport will be added to the Export event, and oucPrint
to the Print event. The category oucPrint is not meaningful for exporting and oucExport is not
meaningful for printing. The invalid categories are automatically removed so that the above
function call is allowed and valid.
Remarks:
Note that application events are not supported in all viewer applications. If a watermark should
appear when printing, for example, then it is usually best to set the state of such a layer to visible,
and to make it invisible in the View event. A viewer that supports application events will hide the
layer at viewing time but still print it. A viewer that does not support application events will always
display the layer.
If the initial state of the layer would be invisible, then it would also stay invisible at printing time if
the viewer does not support application events but layers.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is 0.
 

Previous topic: AddObjectToLayer, AddOCGToAppEvent

Next topic: AddOutputIntent


Start Chat