GetPDFUADiagnostics
PDF/UA & Accessibility
Description
Returns a newline-separated list of potential PDF/UA-1 (ISO 14289-1) compliance issues found in the current document. Each line contains one issue code followed by a colon and a human-readable description. Returns an empty string when no issues are detected.
Syntax
Delphi
function TPDFlib.GetPDFUADiagnostics: WideString;ActiveX
Function PDFlib::GetPDFUADiagnostics() As StringDLL
wchar_t * DLGetPDFUADiagnostics(int InstanceID);Issue codes
| PDF-VERSION-LOW | The document's PDF version (as recorded in the file header) is below 1.7. PDF/UA-1 is defined against ISO 32000-1:2008 (PDF 1.7). Call SetPDFUAMode to automatically raise the version to 1.7. |
|---|---|
| MARKED-FALSE | MarkInfo/Marked is not set to true; the document is not a tagged PDF. |
| LANG-MISSING | The document catalog /Lang entry is absent or empty. ISO 14289-1 §7.3 requires a natural language declaration. |
| DISPLAYDOCTITLE-FALSE | ViewerPreferences/DisplayDocTitle is not true. Required by ISO 14289-1 §7.1 so the document title is shown in the title bar. |
| DOCINFO-TITLE-MISSING | The document information dictionary /Title entry is absent or empty. PDF/UA-1 requires a document title so assistive technology can announce it when the document is opened. This check is complementary to DISPLAYDOCTITLE-FALSE: that check verifies the title is surfaced in the viewer; this check verifies the title value itself exists. Call SetInformation with the key Title to set it. |
| XMP-NO-PDFUAID | The XMP metadata stream does not contain a pdfuaid:part entry. Required by ISO 14289-1 §7.2. |
| ANNOT-NO-CONTENTS:N | N non-exempt annotations (excluding Widget, PrinterMark, and TrapNet subtypes) are missing a Contents entry. Required by ISO 14289-1 §7.18.1. |
| EMBED-NO-AFR:N | N embedded files are missing an AFRelationship entry in their file specification dictionary. Required by ISO 14289-1 §7.11. |
| FIGURE-NO-ALT:N | N Figure or Formula structure elements have no Alt text value. ISO 14289-1 §7.5 and ISO 32000-1 §14.9.3 require alternative descriptions for both graphical figures and mathematical formulas. |
| HEADING-LEVEL-SKIP:N | N heading level jumps were detected in document order (e.g. an H1 immediately followed by an H3, skipping H2). ISO 14289-1 §7.1 and WCAG 2.x Success Criterion 1.3.1 require headings to nest without gaps. |
| STRUCT-UNCLOSED:N | N structure elements are still open because EndTag was not called the correct number of times. These elements will be missing from the structure tree root. |
| TABLE-TH-NO-SCOPE:N | N TH (table header cell) structure elements have no Scope attribute. ISO 32000-1 §14.8.4.3.4 Table 337 defines Scope (Row, Column, or Both) as the attribute that describes which data cells each header cell applies to. Without it, assistive technology cannot reliably associate headers with data cells in complex or multi-header tables. Call SetStructElemScope (or AddTagAttribute with Owner='Table', Name='Scope') immediately after tagging each TH element. |
| FORM-NO-TOOLTIP:N | N interactive form fields (Widget annotations) are missing a TU (tooltip / accessible name) entry. ISO 14289-1 §7.18.4 requires all interactive form fields to carry a TU entry so assistive technology can announce the field's purpose to the user. /TU is the accessible name that screen readers read aloud; it is distinct from /T (the partial field name used programmatically). Set the TU value when creating or loading form fields. |
| LIST-STRUCT:N | N LI or LBody structure elements appear outside their required parent. ISO 32000-1 §14.8.4.4 requires LI to be a direct child of L (list), and LBody to be a direct child of LI (list item). Malformed list nesting prevents assistive technology from navigating lists correctly. Check the BeginTag / EndTag call sequence for all list-related elements. |
| ROLEMAP-UNMAPPED:N | N custom structure element types appear in the document but have no entry in the /RoleMap dictionary. ISO 14289-1 §7.1 and ISO 32000-1 §14.7.3 require that every non-standard structure type be mapped to a standard PDF type so assistive technology can determine how to handle the element. Call AddRoleMap for each custom type before saving. The issue description lists the unmapped type names. |
| SUSPECTS-TRUE | MarkInfo/Suspects is set to true. ISO 14289-1 §7.1 requires files claiming PDF/UA conformance to have a Suspects value of false. A true value marks the tagging as known to contain errors. Call SetMarkInfo after the document is fully tagged to reset Suspects to false. |
| ROLEMAP-STANDARD-REMAP:N | N standard structure types appear as the "custom" key in /RoleMap and would be remapped on save. ISO 14289-1 §7.1 forbids remapping standard tags defined in ISO 32000-1 §14.8.4 (P, H1..H6, Figure, Table, etc.). The detail line lists the offending standard tag names. Remove the affected AddRoleMap calls. |
| DC-TITLE-MISSING | The XMP metadata stream's Dublin Core dc:title is missing or empty. ISO 14289-1 §7.1 requires the Metadata stream to contain a dc:title entry that clearly identifies the document. This check is separate from DOCINFO-TITLE-MISSING, which only inspects the /Info /Title entry. Call SetPDFUAMode to copy the /Info title into the XMP packet. |
| TRAPNET-ANNOT:N | N TrapNet annotations were found on document pages. ISO 14289-1 §7.18.2 explicitly forbids TrapNet in PDF/UA-1 conforming files. Remove the offending annotations before saving. |
| ANNOT-PAGE-NO-TABS-S:N | N pages carry one or more annotations but their page dictionary does not set /Tabs /S. ISO 14289-1 §7.18.3 requires tab order on such pages to follow the structure tree, signalled by /Tabs /S. Set /Tabs /S in the page dictionary for every page that contains annotations. |
| ENCRYPT-NO-ACCESS | The document is encrypted and PDFUAMode is active, but bit 10 of the encryption /P permission key (mask $200, accessibility extract) is cleared. ISO 14289-1 §7.16 requires every encrypted conforming file to permit accessibility extraction. When PDFUAMode is set before Encrypt is called, the bit is forced on automatically. When the call order is the opposite, the encrypt dictionary is already in place with the old /P value — call Encrypt again so the dictionary is re-emitted. |
| FIRST-HEADING-NOT-H1 | The first heading element in document order is not H1 (the strongly-structured H sentinel also counts as level 1). ISO 14289-1 §7.4.2 requires the first heading tag in a non-strongly-structured document to be H1. The detail line names the offending level. |
| WIDGET-NO-STRUCTPARENT:N | N Widget annotations lack a /StructParent entry. ISO 14289-1 §7.18.4 requires Widget annotations to be nested within a Form structure tag; without /StructParent the Widget cannot be reached from the structure tree at all. The detail line reports the count. This is a partial check — full verification that the resolved parent /S is Form is not yet implemented. |
| LIST-NO-NUMBERING:N | N L (list) structure elements lack the ListNumbering attribute. ISO 14289-1 §7.6 requires every L tag to declare its numbering style via this attribute (valid values per ISO 32000-1 Table 347 are None, Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, LowerAlpha). Call SetStructElemListNumbering after opening each L tag. |
| MULTIPLE-H-CHILDREN:N | N structure tree nodes contain more than one direct H (generic heading) child. ISO 14289-1 §7.4.4 forbids that — split the parent section or replace the H tags with numbered H1..H6 sequences. |
Return value
A newline-separated string of issue descriptions, or an empty string if no compliance issues are detected.
Remarks
This function is intended as a diagnostic aid for developers. It checks the current state of the document in memory and reports issues that could cause PDF/UA-1 validation failures. Call it after loading or constructing a document to identify issues before saving.
When SetPDFUAMode is active and the document is saved, several issues (ANNOT-NO-CONTENTS, EMBED-NO-AFR) are automatically corrected during save. GetPDFUADiagnostics reports the pre-save state; issues that will be auto-corrected on save are still listed if present before save.
This function does not modify the document.
Example
var
Diag: WideString;
begin
PDFlib.SetPDFUAMode('en-US');
// ... build document ...
Diag := PDFlib.GetPDFUADiagnostics;
if Diag <> '' then
ShowMessage('PDF/UA issues found:'#10 + Diag);
end;See also
SetPDFUAMode, SetDocumentLanguage, SetEmbeddedFileAFRelationship