DynaPDF Manual - Page 147

Previous Page 146   Index   Next Page 148

Function Reference
Page 147 of 839
As mentioned above, the parameters Layer and Title are both optional. This results in four possible
combinations which produce different results.
If no layer is provided then the function creates a new group (a new sub array). However, the parent
node cannot be empty (with one exception). At least one element must be added to an empty group
before a new group can be added to it.
Take a look on the examples on the next page to understand how it works.
Return values:
If the function succeeds then the return value is a pointer of the newly created group. If no new
group was created then the return value is the pointer of the parent group that was passed to the
function. If the function fails then the return value is NULL.
Examples 1:
LGRP* root, *grp;
// Set the parameter DisplayInUI to false...
SI32 oc1 = pdfCreateOCG(PDF, "All", false, true, oiView);
SI32 oc2 = pdfCreateOCG(PDF, "Text", false, true, oiView);
SI32 oc3 = pdfCreateOCG(PDF, "Images", false, true, oiView);
root = pdfAddLayerToDisplTree(PDF, NULL, -1, NULL);
pdfAddLayerToDisplTree(PDF, root, oc1, "Just a title");
pdfAddLayerToDisplTree(PDF, root, oc2, NULL);
pdfAddLayerToDisplTree(PDF, root, oc3, NULL);
Result:
Example 2:
root = pdfAddLayerToDisplTree(PDF, NULL, -1, NULL);
grp
= pdfAddLayerToDisplTree(PDF, root, -1, "This is a group");
pdfAddLayerToDisplTree(PDF, grp, oc1, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc2, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc3, NULL);
 

Previous topic: AddLayerToDisplTree

Next topic: AddMaskImage