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:
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,