PDF/UA-2 Structure Authoring, Validation, and Repair

HotPDF can build, validate, and atomically repair mixed PDF 1.7 and PDF 2.0 structure semantics while preserving explicit namespace identity and bounded processing cost

Namespace-aware authoring

AddStructureElement assigns the PDF 2.0 standard structure namespace when a PDF/UA-2 role requires it, including the mandatory top-level Document element

AddStructureElementNS creates explicitly namespaced elements and AddStructRoleMapNS adds name or two-item array mappings that may resolve transitively across namespace boundaries

Namespace dictionaries are indirect, registered once by URI, and emitted through StructTreeRoot/Namespaces

Attributes and semantic helpers

APIPurpose
SetStructureAttributeNameAdds or replaces a name-valued attribute in an owner-specific dictionary and can bind custom owners to a namespace
SetStructureAttributeNumberAdds or replaces an integer-valued structure attribute such as RowSpan or ColSpan
SetStructureTableCellHeadersWrites a non-empty Headers array that identifies table header cells by unique ID values
SetStructurePronunciationWrites an inherited PhoneticAlphabet name and an exact Phoneme replacement on a PDF 2.0 structure element
AddPronunciationLexiconEmbeds an indirect application/pls+xml file and appends its Filespec to StructTreeRoot/PronunciationLexicon in lookup order
AssociateFileWithStructureAssociates an indirect Filespec with a structure element through AF
AddAccessibleFormulaCreates a Formula with Alt, ActualText, or both
AddAccessibleMathMLFormulaCreates a formula, embeds a described application/mathml+xml file, associates it with structure, and adds a MathML namespace child

Bounded one-pass validation

ValidatePDFUA2Structure returns every retained diagnostic in a THPDFUA2ValidationIssues array and returns False when at least one diagnostic has uisError severity

The validator resolves namespace-aware role maps with cycle detection and checks the top-level document, parent-child hierarchy, parent backlinks, attribute owners and revisions, annotation StructParent, parent-tree and OBJR ownership, associated files, headings, lists, tables, Ruby, Warichu, pronunciation hints, formulas, and MathML

Table validation expands positive row and column spans only within

Verificările de adnotări acoperă ordinea tab-urilor paginii, proprietatea și rolurile structurii, descrierile, stările de artifact, referințele de conținut marcat ale fluxurilor de aspect, echivalența conținutului bogat, relațiile de fișiere și subtipurile interzise

Verificările de formulare acoperă identitatea accesibilă a câmpurilor, proprietățile de câmp moștenite, contextul și proprietatea widget-urilor, etichetele, acțiunile alternative, valorile bogate, opțiunile choice, widget-urile de arie zero, câmpurile multi-widget și interdicția XFA

Verificările de navigare acoperă destinațiile de structură cu precedență SD, marcajele, descrierile fișierelor încorporate, arborii numerici imbricați de etichete de pagină, indicele de pagină zero obligatoriu, stilurile de etichete și numerele de început valide ale etichetelor

Validarea tabelelor extinde span-urile pozitive de rânduri și coloane doar în interiorul MaxObjects, rejects intersecting cells and irregular row or row-group geometry, resolves Headers within the owning table, detects duplicate, self, and cyclic header references, and accepts implicit associations only when Scope or first-row and first-column placement determines them

List validation recognises the complete PDF 2.0 ListNumbering set, enforces label semantics, checks ContinuedList and ordered same-level ContinuedFrom references, and rejects continuation cycles or direct real content outside Lbl and LBody

Ruby children must be RB,RT or RB,RP,RT,RP, Warichu children must be WP,WT,WP, pronunciation entries retain their PDF object types, and every pronunciation lexicon must be an indirect embedded PLS Filespec

Indirect-object scanning, traversal depth, role-map depth, expanded table cells, retained issue count, and hostile collection processing are bounded so validation remains predictable for untrusted structure trees

Shared compliance findings

The THPDFComplianceFindings validation overload returns the same diagnostics with a shared profile, severity, stable rule ID, standard clause, logical path, indirect object number, and zero-based page index

The detailed repair overload compares bounded pre-repair and post-repair findings to identify applied, unresolved, rolled-back, or failed repair actions and appends counted repair-family summaries

ComplianceFindingsToJSON preserves deterministic order under the versioned hotpdf.compliance.findings.v1 schema and represents unknown object or page locations as null

Atomic structure repair

RepairPDFUA2Structure runs inside a copy-on-write graph transaction, canonicalises duplicate or unregistered namespace dictionaries, rewrites structure and role-map namespace references, repairs standard structure namespaces, normalises structure attribute namespaces and revisions, and repairs deterministic list, table, Ruby, Warichu, pronunciation, alternate-text, language-inheritance, heading-order, and Artifact-tag defects

After mutation the same validator checks the candidate graph, and the default policy rolls back every change when any PDF/UA-2 error remains

Validation policy

Start with THPDFUA2ValidationOptions.Default and change only the workflow-specific decisions

THPDFUA2HeadingPolicy selects heading treatment, THPDFUA2IssueSeverity distinguishes warnings from errors, and each THPDFUA2ValidationIssue carries a stable code, structure path, severity, and message

Recommended workflow

  1. Activați PDFUACompliance, selectați PDFUAPart = 2 și setați Lang înainte de BeginDoc
  2. Creați un Document de nivel superior și construiți copii semantici cu roluri standard sau explicit cu namespace
  3. Înregistrați adnotările și fișierele asociate prin ajutoarele lor de structură, scrieți indiciile de pronunție cu SetStructurePronunciation și adăugați fișiere PLS în ordinea dorită de căutare cu AddPronunciationLexicon
  4. Rulați ValidatePDFUA2Structure înainte de EndDoc când aplicația are nevoie de toate diagnosticele deodată, apelați RepairPDFUA2Structure pentru reparații deterministe de namespace, structură și accesibilitate și selectați supraîncărcarea partajată de constatări când CI cere JSON standard
  5. Rezolvați fiecare eroare înainte de ieșire, deoarece EndDoc impune și politica implicită strictă pentru documentele PDF/UA-2

See also: Automatic layout structure, ValidatePDFUA2Structure, RepairPDFUA2Structure, ComplianceFindingsToJSON, SetStructurePronunciation, AddPronunciationLexicon, AddStructureElement, BeginTaggedContentForStructure, AppendStructureMarkedContent