What layers are
A PDF can carry several overlapping drawings in one file and let the reader switch between them. The mechanism is called optional content, and each switchable piece is an optional content group (OCG). CAD and illustration tools use it constantly: dimensions, hatching, construction lines, revision clouds, language variants, print-only marks.
Most PDFs have none. That is normal, and this tool says so plainly instead of showing an error.
Toggling actually re-renders
Every switch in the tree changes the visibility in pdf.js's optional content configuration and re-renders the page, so what you see is what a reader would see with those layers on — not a simulation.
Radio-button groups are respected: /RBGroups declares sets in which at most one layer may be visible, and switching one member on switches the others off, exactly as a viewer would.
What the object graph adds
pdf.js reports names and visibility. Everything else has to be read out of /OCProperties directly, and it is the part that surprises people:
/D /BaseState—/OFFmeans everything starts hidden except the groups in/ON./D /Locked— layers the viewer will not let a reader toggle at all./D /AS— usage application dictionaries. These are the mechanism behind a layer that switches itself off when the document is printed, exported or zoomed past a threshold.- Each group's
/Usage—/Print /PrintState /OFFis a real trap: the layer looks correct on screen and simply is not there on paper. /Intent— a group with/Designintent instead of/Viewis ignored by ordinary readers entirely.- Which pages reference each group, found by scanning
/Resources /Properties, form XObjects carrying/OC, and annotations carrying/OC. A group referenced by nothing is declared but paints no ink.
Flattening
You can export a copy with the current visibility baked in. Each page's content stream is walked, /OC … BDC … EMC spans belonging to hidden groups are dropped — counting nested marked content so the right EMC is matched — hidden form XObjects and annotations go with them, and /OCProperties is removed.
The claim is then checked by rendering: the original is rendered with the settings you chose, the flattened file is rendered plainly, and the largest per-page pixel difference is reported. If the two are identical to the file's own default view, the tool says so rather than implying it changed something.
Privacy
The file is read, toggled and written entirely inside your browser. Nothing is uploaded.
Tiny Online Tools







