How can I remove some content from PDF layers (OCGs) using PDFNet?

Q: If I have a pdf with several layers (Pdf layers), how can I remove
some (or all elements) from one of the layers? I've found out how to
iterate the dictionaries to find the layer names and so on (OCG), but
I can't find the connection between an element and a layer.
A: To edit layers or to get OCG from Elements, you would need to
iterate (and possibly edit) PDF page display list (e.g. similar to
PDFEdit sample project -
To obtain the information about the layer use
element.GetMCPropertyDict() and element.GetMCTag() methods. Content
marked with OCG will have "OC" as MCTag; if the element is an Image or
a form XObject you can also check whether the XObject dictionary
(element.GetXObject()) contains OCG entry. So yes, using the current
API you can edit PDF layers and OCG content, but you would need to be
familiar with the low-level API-s and PDF format in general. In the
near future we are planning to release a high-level, simple-to-use API
for OCG editing as well as more sample code. You may also want to take
a look at the new sample project related OCGs (