.NET Windows Forms project demonstrating how to create and set visibility for PDF layers - Optional Content Groups - OCGs.
This code sample shows how to:
- Create simple layers
- Create nested layers
- Create membership layers
- Load a PDF containing layers
- Annotate the layers that exist
- Redact or delete layers that are invisible
- Save the final PDF
In the screenshot below you can see found nested layers with the layer visibility for 'Layer 4' set to off. This implicitly sets the visibility of 'Layer 5' to off because it is nested. The checkboxes on the right allow you to view the OCG structure and set OCG visibility.
The ABCpdf Team