PDFium Delphi Component Docs

GenerateTaggedLayout method

Component: TPdf  ·  Units: PDFium, FPdfLayout

Syntax

function GenerateTaggedLayout(Layout: TPdfLayoutDocument; out Plan: TPdfLayoutPlan; const Language: string = 'en-US'): Boolean;

Description

Measures and emits a new layout document, assigns continuous MCIDs to semantic page objects, marks decorative content as Artifact, builds the structure hierarchy and reloads the completed Tagged PDF into the same TPdf

The destination must be inactive or contain zero pages so every non-artifact object is covered by the generated semantic plan

The method loads PDFium first, then checks marked-content support; it can therefore be a new TPdf instance's first native operation without an earlier CreateDocument call

Semantic model

AddText defaults to plsrParagraph whilst headers, footers, rules, images, page XObjects and cached nodes default to plsrArtifact

Call SetLastItemSemantics to assign headings, sections, divisions, figures, captions, list roles, table roles, alternate text, actual text, language, IDs, table scope, spans or header IDs

Use AddSemanticNode for non-visual list and table containers, then connect descendants through ElementID and ParentID

Tagged links

AddLink adds measured URI text and a Link annotation

The generated annotation is converted to an indirect object when necessary, receives a StructParent key and is associated with its Link structure element through OBJR and ParentTree entries

Validation

The measure pass rejects duplicate IDs, unresolved parents, cycles, invalid list or table containment, figures without alternate or actual text, invalid spans and scope, and unresolved table header IDs

Generation rejects encrypted output, an existing structure tree, mismatched page or object counts, duplicate MCIDs, incomplete annotation mappings, and configured object-budget overruns

Result

Plan contains semantic elements, parent indexes, MCIDs, link annotation indexes, tagged-content counts, and artifact counts in addition to the ordinary layout metrics

The completed document carries a Document structure element, ParentTree, IDTree when IDs are present, MarkInfo, document language, page StructParents and structure-based tab order for pages with annotations

Advanced table layout

TPdfLayoutTableCell.AddTextRun retains mixed styles in extractable native text; SetImage places a Figure with alternate text beneath the original table cell

With AllowRowSpanContinuation=True, page-specific MCR entries let a single TH or TD cover every physical page fragment while retaining RowSpan, ColumnSpan and header relationships

Subtotal rows remain in the table body and continuation labels become Artifact content; constraints and allowances are explained in FPdfLayout

See Also

GenerateLayout, ValidatePdfUa, ReadableContent