Expand description
Document-level structural data — the parallel IR to
DisplayList.
Where DisplayList carries per-page paint operations, DocumentStructure
carries the document-scoped metadata that ends up in the PDF catalog, info
dictionary, outline tree, page annotation arrays, and so on:
/DOCINFO, /OUT, /ANN, /DEST, /PAGE//PAGES,
/VIEWERPREFERENCES, /Metadata, /FORM, /EMBED.
Two producers populate this type:
- The PostScript interpreter, when
pdfmarkoperators fire — seestet-ops/src/pdfmark_ops.rs. The buffer hangs offstet_core::context::Context::doc_structure. stet-pdf-reader, when round-tripping a PDF’s structural API into an output PDF.
One consumer: the PDF output device (stet-pdf::PdfDevice) drains the
buffer at end-of-job and writes the records into the output PDF. Non-PDF
output devices ignore it, so structural data is a no-op for PNG / viewer
output.
Structs§
- Annotation
Record - One
/ANNentry. Each record contributes a single annotation (/Annot) to one page’s/Annotsarray.pageis 1-based;0is reserved for “no explicit page” (the writer substitutes the page being assembled at the time the record fired). - Border
/Borderarray[Hradius Vradius Width]. PDF spec also allows a dash pattern fourth entry; we capture it but only emit when present.- Choice
Option - One
/Optentry on a choice field. PDF allows two shapes: a single string (export = display) or[export display]for distinct values. - Dest
Record - One
/DESTentry — registers a named destination in the document’s/Names /Destsname tree. PDF outline entries and link annotations resolve the matchingnameagainst this tree. - DocInfo
Record /DOCINFOpayload —Option<String>for every key so absent entries don’t overwrite values from another producer (or the device’s auto-generated defaults).creation_dateandmod_dateaccept either a parsedPdfDateor a passthrough string the writer emits verbatim.- Document
Structure - Document-level structural records, parallel to
DisplayList. - Embed
Record - One
/EMBEDentry — a single attached file. The writer emits one/Filespecdict + one/EmbeddedFilestream per record and assembles them into a/Names /EmbeddedFilesname tree. - Form
Record /FORMpayload — document-level AcroForm dict. All fields are optional;/Fieldsis implicit (built from/Widgetannotations at write time). Multiple/FORMrecords merge last-wins viaFormRecord::merge_over.- Metadata
Record - One
/Metadataentry — an XMP stream attached to the document’s/Catalog. The writer wraps the bytes in a/Type /Metadata /Subtype /XMLstream object. - Outline
Node - One node in the assembled outline tree.
- Outline
Record - One
/OUTentry. Each record contributes a bookmark node to the document outline tree the PDF writer assembles at end-of-job. - Output
Intent Record /OUTPUTINTENTpayload — one PDF/X or PDF/A OutputIntent declaring the destination color rendering condition for the document. The writer embeds [dest_output_profile] as an/ICCBasedstream object and produces an entry in/Catalog /OutputIntents.- Page
Additional Actions - Page-level
/AA(additional actions) — open and close hooks the PDF viewer fires when a page becomes / leaves visible. Either hook is optional; both are passed through verbatim from the producer’s action dict. - Page
Boxes - Per-page box rectangles. Each entry is
Option<[llx, lly, urx, ury]>;Nonemeans “leave the device default in place”. - Page
Override Record - One
/PAGE(single-page override) or/PAGES(document-wide default) entry. The writer applies the keys to the per-page dict at build time;/PAGEwins over/PAGESfor any key that’s set on both, and an explicit/PAGEfor page N wins over the implicit “current page” target. - PdfDate
- Parsed PDF date string of the form
D:YYYYMMDDHHmmSSOHH'mm', whereOis one of+,-, orZfor the offset sign. All fields after the year are optional in the PDF spec; missing components default to the values shown inPdfDate::default. - Viewer
Prefs Record - One
/VIEWERPREFERENCESpayload. All keys are optional; later records override earlier ones key-by-key. The “page layout” and “page mode” entries technically live on/Catalogdirectly (not under/ViewerPreferences) but Adobe pdfmark groups them with the rest of the viewer-control bag, so stet does too. - Widget
Annotation /Widgetannotation payload — also acts as the field dict when the widget is a single-leaf field (the common case). Multiple widgets sharing the same dottedfield_namebecome/Kidsof an implicit parent field at write time (radio groups).
Enums§
- Annotation
Subtype - Per-subtype annotation payload. Each variant carries the keys
specific to that subtype; shared keys (rect, color, border, title,
contents, page) live on the parent
AnnotationRecord. - Annotation
Target - What an annotation activates. Mirrors
OutlineDestinationbut kept distinct because annotations can carry richer action data (e.g. JavaScript) and have their own resolution rules. - DocDate
- A document date entry. The writer can either round-trip a raw string
(already in PDF date syntax) or format a parsed
PdfDate. - Field
Type - Field type per PDF 1.7 spec § 12.7.4. The variant maps directly to
the
/FTname in the output PDF. - Field
Value - Field value — variant shape depends on the field’s
/FT. The emitter writes the corresponding PDF object kind for each variant. - GoTo
Target /GoToaction target.- Link
Highlight /Linkhighlight mode — controls the visual feedback when the user activates the link region.- Outline
Action - Outline-action passthrough. Despite the name, this enum is shared
across every place an “action dict” appears — outline
/Action, link annotation/A, page/AAopen / close — because the on-the- wire shape is identical. - Outline
Destination - What a bookmark entry navigates to when clicked.
- Page
Override Scope - Whether a
PageOverrideRecordtargets one specific page or the whole document. - Structural
Record - One accumulated structural record. Each variant corresponds to a PDF catalog / info / page entry the writer knows how to emit.
- Text
Annotation Icon - Standard
/Textannotation icon names. Anything outside this set falls back to/Note. - Trapped
State /Trappedvalue as written to the Info dict.- TzSign
- Sign of a PDF date timezone offset.
- View
Spec - Outline view spec, mirroring PDF’s
/Destarray shape.
Functions§
- build_
outline_ tree - Build an outline tree from a flat sequence of
OutlineRecords.