DynaPDF Manual - Page 128

Previous Page 127   Index   Next Page 129

Function Reference
Page 128 of 770
Example 3:
The following two versions are a bit confusing, I know...
root = pdfAddLayerToDisplTree(PDF, NULL, oc1, NULL);
grp
= pdfAddLayerToDisplTree(PDF, root, -1, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc2, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc3, NULL);
Result:
Example 4:
root = pdfAddLayerToDisplTree(PDF, NULL,oc1,"A layer group with a title");
grp
= pdfAddLayerToDisplTree(PDF, root, -1, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc2, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc3, NULL);
Result:
There is a special case that produces the same result in Acrobat but certain viewers have problems to
display the layer tree depending on the used syntax. Compare the following two versions:
root = pdfAddLayerToDisplTree(PDF, NULL, -1, "This is a group");
grp
= pdfAddLayerToDisplTree(PDF, root, -1, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc1, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc2, NULL);
pdfAddLayerToDisplTree(PDF, grp, oc3, NULL);
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);
Normally, the second version shouldn't work since the parent node is empty but in practice both
versions produce the same result. However, many third-party viewers have problems to display the
layer tree if the title was set in the parent node (the first variant).
 

Previous topic: AddLayerToDisplTree

Next topic: AddMaskImage, AddObjectToLayer