Search code examples
pdflayerocg

How are layers stored in PDF


In PDF everything is in the format of /name. I couldn't find a /Layers throughout the document. If I want to look for all the layers what key should I look for?


Solution

  • PDF layers are formally known as "Optional Content Groups" and are described in section 4.10 of the PDF Reference. The object types you should be looking for are 'OCG' for a simple group or 'OCMD' for a more complex dictionary.