DynaPDF Manual - Page 289

Previous Page 288   Index   Next Page 290

Function Reference
Page 289 of 839
// To reflect the same nesting as the text layer we must
// use an OCMD for the annotation because the visibility of the
// layer oc2 depends on oc1 at this position.
pdfSetBorderStyle(pdf, bsUnderline);
pdfSetStrokeColor(pdf, PDF_BLUE);
SI32 annot = pdfWebLink(pdf, 50, 51, tw, 12, "www.dynaforms.com");
UI32 ocgs[2] = {oc1, oc2};
SI32
ocmd = pdfCreateOCMD(pdf, ovAllOn, ocgs, 2);
pdfAddObjectToLayer(pdf, ocmd, ooAnnotation, annot);
pdfEndLayer(pdf);
pdfBeginLayer(pdf, oc3);
InsertImageEx(pdf, 50.0, 70.0, 300.0, 200.0, "c:/Imgs/test.tif", 1);
pdfEndLayer(pdf);
pdfEndLayer(pdf);
pdfWriteText(pdf, 50.0, 300.0, "This text is not part of a layer!");
pdfEndPage(pdf);
pdfCloseFile(pdf);
CreateOCMD
Syntax:
SI32 pdfCreateOCMD(
const PPDF* IPDF,
// Instance pointer
TOCVisibility Visibility, // When should the OCMD be visible?
UI32* OCGs,
// Array of OCG handles (required)
UI32 Count)
// Number of handles in the array (required)
typedef enum
{
ovAllOff,
ovAllOn,
ovAnyOff, // Default
ovAnyOn,
ovNotSet
// Internal (defaults to ovAnyOn if used)
}TOCVisibility;
The function creates an Optional Content Membership Dictionary (OCMD). OCMDs can be used to
create visibility expressions which depend on more than one optional content group.
OCMDs are mostly used with Annotations and Form Fields because these objects can only be
associated with one OCG or one OCMD. In cases where the visibility should depend on more than
one OCG or if the object should be used in different layers, an OCMD must be used.
 

Previous topic: How to make content optional?

Next topic: CreateRadialShading