Estrutura PDF/UA automática a partir de árvores de layout
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
Predefinições e substituições semânticas
| Conteúdo de layout | Estrutura gerada |
|---|---|
THPDFDOMText | P, or H1 através de H6 when HeadingLevel is assigned |
THPDFDOMStack e THPDFDOMContainer | Div |
THPDFDOMList | L com LI, Lbl, and LBody descendants plus ListNumbering |
THPDFDOMTable | Table, TR, TH, and TD, with column scope on header cells |
THPDFDOMImage | Figure com texto alternativo |
| Headers, footers, repeated table headers, spacers, and decorative boxes | Artifact conteúdo marcado |
Every component also exposes SemanticRole, SemanticLanguage, AlternativeText, ActualText, ExpansionText, and Artifact for explicit control
Exemplo de documento acessível
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
Identidade entre páginas e ordem de leitura
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
APIs de criação diretas seguras para continuação
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
Estatísticas e compatibilidade
THPDFDOMRenderStatistics reports structure-element, marked-content, and artifact counts alongside pages, placements, splits, and continuation depth
Definir GenerateStructure para False before rendering when byte-compatible untagged output is required