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 before checking marked-content capabilities, so it can be the first native operation on a new TPdf instance without a preliminary CreateDocument call

Semantic model

AddText defaults to plsrParagraph while 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 tables

TPdfLayoutTableCell.AddTextRun keeps mixed text styles as native, extractable text; SetImage emits a Figure with alternate text under the original table cell

With AllowRowSpanContinuation=True, one TH or TD spans all of its physical page fragments through page-specific MCR entries while preserving RowSpan, ColumnSpan and header relationships

Subtotal rows remain body rows and continuation labels are marked as Artifact; see FPdfLayout for constraints and budgets

See Also

GenerateLayout, ValidatePdfUa, ReadableContent