How can I show a "tree" of PDF layers?

114 views
Skip to first unread message

Aaron

unread,
May 5, 2015, 7:55:53 PM5/5/15
to pdfne...@googlegroups.com
Q:

My document has some OCG layers.  I've seen some documents where OCG layers are displayed as a hierarchical tree.  How can I do that?

A:

To get started using OCGs in PDFNet, you may want to take a look at the following code sample:
https://www.pdftron.com/pdfnet/samplecode.html#PDFLayers

The sample shows how to make the visibility of some layers dependent on other layers, which you would need to implement proper "tree" semantics (so that, for example, disabling a parent disables its children).

You can then display hierarchies of OCGs using PDF.OCG.Config.SetOrder():
https://www.pdftron.com/pdfnet/docs/PDFNet/html/M_pdftron_PDF_OCG_Config_SetOrder.htm

The argument to SetOrder() can be an array which itself contains arrays, enabling you to represent a tree of OCGs,


Reply all
Reply to author
Forward
0 new messages