Automatic PDF/UA Structure from Layout Trees

THPDFDOMRenderer can turn the visual layout tree into a matching logical structure tree without manual MCID allocation

THPDFDOMDocument.GenerateStructure defaults to True, enables tagged PDF output, creates one Document root and one Sect per section, and uses THPDFDOMDocument.Language when the target has no document language

Semantic defaults and overrides

Layout contentGenerated structure
THPDFDOMTextP, or H1 through H6 when HeadingLevel is assigned
THPDFDOMStack and THPDFDOMContainerDiv
THPDFDOMListL with LI, Lbl, and LBody descendants plus ListNumbering
THPDFDOMTableTable, TR, TH, and TD, with column scope on header cells
THPDFDOMImageFigure with alternate text
Headers, footers, repeated table headers, spacers, and decorative boxesArtifact marked content

Every component also exposes SemanticRole, SemanticLanguage, AlternativeText, ActualText, ExpansionText, and Artifact for explicit control

Accessible document example

Document.Language := 'en-US';
Section := Document.AddSection;
Section.Header := THPDFDOMText.Create('Quarterly report');
Section.Body.AddHeading('Results', 1, 'Title');

List := THPDFDOMList.Create('Decimal', 'Steps');
List.AddItem('1.', 'Review the totals');
Section.Body.Add(List);

Table := THPDFDOMTable.Create('Summary');
Table.AddColumn;
Table.AddColumn;
Header := Table.AddRow(18, True);
Header[0].Text := 'Name';
Header[1].Text := 'Value';
Row := Table.AddRow(18);
Row[0].Text := 'Alpha';
Row[1].Text := '42';
Section.Body.Add(Table);

Section.Body.Add(THPDFDOMImage.Create(Bitmap, 120, 80,
  'Revenue chart by quarter', 'Chart'));

PDF.PDFUACompliance := True;
PDF.PDFUAPart := 2;
Statistics := Renderer.Render(Document, PDF);

The renderer rejects a first heading above H1, skipped heading levels, orphan list or table roles, and a PDF/UA figure without alternate text before writing invalid structure

Cross-page identity and reading order

A logical component keeps one structure element when it splits across pages

Each visible continuation receives a page-local MCID and an MCR dictionary that points from the existing structure element to the correct page

The page ParentTree maps every MCID back to that same structure element, while continuation clones preserve logical identity without copying the source text or table rows

Repeated table headers on continuation pages are artifacts so their visual repetition does not reorder the logical table header ahead of earlier body rows

Direct continuation-safe authoring APIs

BeginTaggedContentForStructure allocates an MCID and opens marked content for a structure element that already exists

AppendStructureMarkedContent appends an explicit page and MCID as an MCR and updates the page ParentTree

Use these lower-level methods when a custom layout renderer owns continuation logic outside HPDFLayoutDOM

Statistics and compatibility

THPDFDOMRenderStatistics reports structure-element, marked-content, and artifact counts alongside pages, placements, splits, and continuation depth

Set GenerateStructure to False before rendering when byte-compatible untagged output is required

Related APIs