PDF Layers & Optional Content Groups
PDF Layers, technically known as Optional Content Groups (OCG), allow authors to stack content that can be toggled visible or invisible by the end user. This is heavily used in architectural blueprints (e.g., hiding the electrical wiring layer to view the plumbing).
These files are built to test how your parsers and web viewers handle complex graphical stacking. Poor text extractors might accidentally extract invisible text, while poor rendering engines might fail to calculate transparency intersections when flattening layers.
Layered OCG
A document containing distinct Optional Content Groups (Layers) that can be toggled on or off to test visibility extraction.
Flattened
A document where layers and transparency have been permanently merged into a single flat image stream. Used as a baseline validation against the OCG file.
Transparent objects
A document containing heavily overlapping elements with varying alpha channels (opacity) to stress-test rasterization and color-blending.
Frequently Asked Questions
Use Cases
- Validating PDF rendering engines to ensure they respect the `/Intent` and visibility state of Optional Content Groups.
- Testing PDF-flattening tools to ensure invisible layers are permanently purged and visible layers are merged correctly.
- Ensuring text extraction tools do not accidentally index text from hidden CAD/blueprint layers.