1.3 introduced logical structure; 1.4 standardized it as Tagged PDF, which gives a document reading order and semantics (headings, paragraphs, tables, figures with alt text) independent of how it is drawn.
% Catalog /MarkInfo << /Marked true >> /StructTreeRoot 20 0 R /Lang (en-US) % Page content: mark a run with a marked-content ID /P << /MCID 0 >> BDC BT /F1 12 Tf 72 700 Td (Hello) Tj ET EMC % Structure element pointing at it 21 0 obj << /Type /StructElem /S /P /P 20 0 R /Pg 3 0 R /K 0 >> endobj
- Standard structure types:
Document Part Sect Div H H1–H6 P L LI Table TR TH TD Figure Caption Link Span… with/RoleMapfor custom names. The Structure types reference lists them all. - Accessibility:
/Alt(alt text),/ActualText(replacement text),/E(expansion of abbreviations, 1.5),/Lang. - PDF/UA-1 (ISO 14289-1) is the accessibility profile built on 1.7. Well-Tagged PDF (WTPDF 1.0) is the 2.0-era successor guidance.
Read:
Three things that make a PDF "tagged"
/MarkInfo << /Marked true >> in the catalog declares that the file follows Tagged PDF conventions. Without it, readers treat any structure as a hint.
/StructTreeRoot in the catalog: a tree of structure elements (Document → H1, P, Table…) in logical reading order.
BDC … EMC with an /MCID that a structure element claims, or marked as an /Artifact.
Structure tree dictionaries
| Dictionary | Key | Meaning |
|---|---|---|
/StructTreeRoot | /K | Top-level element(s), usually one /Document element. |
/ParentTree | Number tree mapping page and object keys back to structure elements. Required if any element has content. | |
/ParentTreeNextKey | Next free key in the parent tree, for writers adding pages. | |
/RoleMap | Maps custom structure types to standard ones, e.g. /Heading1 /H1. | |
/IDTree, /ClassMap | Element ids, and named attribute classes shared by many elements. | |
/StructElem | /S | Structure type (/P, /H1, /Figure…). Required. |
/P | Parent element. Required, indirect reference. | |
/K | Children: MCIDs, references and nested elements (below). | |
/Pg | Default page for integer MCIDs in /K. | |
/A, /C | Layout and table attributes, inline or by class name. | |
/Alt, /ActualText, /Lang, /E, /T, /ID | Accessibility text, language, title, element id. |
How the pieces link up
Links run in both directions. Down the tree, so a screen reader can walk the document in reading order; and back up from the page, so a viewer can find which element owns the text under your cursor.
DOWN (reading order) UP (content → element)
Catalog Page 3 0 obj
└─ /StructTreeRoot 20 0 R └─ /StructParents 0
└─ /K [21 0 R …] │
└─ StructElem 21 0 obj ▼
/S /P /Pg 3 0 R /K 0 StructTreeRoot /ParentTree
│ /Nums [ 0 [21 0 R …] ]
▼ │
Page 3 content stream: ▼
/P << /MCID 0 >> BDC … EMC ◀───────────── index 0 of that array = MCID 0The page's /StructParents is a key into the parent tree; the value stored there is an array indexed by MCID. Annotations and form XObjects that belong to the structure use the singular /StructParent, whose parent-tree value is a single element.
/K that claims an MCID the parent tree doesn't map back (or the reverse) is the most common tagging defect, and PDF/UA validators reject it.
What /MCID does
A marked-content identifier is the glue between a structure element and the marks it describes. In the content stream, /P << /MCID 0 >> BDC … EMC labels a run of operators with the integer 0. The structure element then points back at that run.
- MCIDs are numbered per page, starting at 0, and must be unique within a page's content stream.
- The page's
/StructParentsentry keys into the structure tree's/ParentTree(a number tree), which maps each MCID back to its owning structure element, the reverse of the/Klink below. - The marked-content tag before
BDC(here/P) is a hint; the real semantics come from the structure element's/S(structure type).
What /K means here
In a structure element, /K ("kids") is what the element contains, and its form depends on the value:
- an integer is an MCID on the element's page (
/Pg):/K 0means "the content marked/MCID 0". - an object reference to another structure element nests the tree.
- a marked-content reference or object reference dictionary targets content on a different page, or an annotation / XObject.
- an array mixes any of the above, for an element with several children.
/K is overloaded across PDF. This structure-element /K is unrelated to the knockout /K true in a transparency group, to the K content-stream operator (CMYK stroke color), or to /K in CCITTFaxDecode parameters. Read it by the dictionary it sits in.
% Element whose content spans two pages, plus a link annotation
22 0 obj
<< /Type /StructElem /S /Link /P 21 0 R /Pg 3 0 R
/K [ 1 % MCID 1 on page 3 (/Pg)
<< /Type /MCR /Pg 4 0 R /MCID 0 >> % MCID 0 on page 4
<< /Type /OBJR /Obj 30 0 R >> ] >> % the link annotation itself
endobjArtifacts: content that isn't content
Running headers, page numbers, rules and backgrounds are artifacts: they're drawn, but they aren't part of what the author wrote, so they must not appear in the structure tree or a screen reader would announce "Page 7" in the middle of a sentence. Mark them in the content stream instead:
/Artifact << /Type /Pagination /Subtype /Footer >> BDC BT /F1 9 Tf 290 30 Td (7) Tj ET EMC /Artifact BMC % no property list: allowed, but property lists help reflow 0.5 w 72 60 m 540 60 l S EMC
/Type | For |
|---|---|
/Pagination | Running heads, folios. In 1.7, /Subtype can say /Header, /Footer or /Watermark. |
/Layout | Cosmetic design: footnote rules, decorative borders. |
/Page | Production aids such as cut marks and color bars. |
/Background | Full-page or full-element backgrounds (1.7); needs /BBox. |
The rule a validator checks: every drawing operation on a page is either inside marked content that a structure element owns, or inside an artifact. Nothing is left untagged.
Read:
Metadata
Two places, which should agree:
- Document information dictionary, the trailer's
/Info:/Title /Author /Subject /Keywords /Creator /Producer /CreationDate /ModDate. Present since 1.0 and deprecated in 2.0. - XMP metadata stream (1.4):
/Metadataon the catalog, a stream with/Type /Metadata /Subtype /XMLholding RDF/XML. Required by PDF/A. Can also be attached to pages, images and fonts.
Read: