PDFium Delphi Component Docs

ValidatePdfUa method

Component: TPdf  ·  Unit: PDFium
Inspects the current document for PDF/UA-1 or PDF/UA-2 conformance and returns profile-specific issues

Syntax

function ValidatePdfUa: TPdfUaValidationResult;

Description

ValidatePdfUa detects PDF/UA-1 and PDF/UA-2 from XMP and applies the rules for the selected profile

The result is a TPdfUaValidationResult record:

PDF/UA-2 validation additionally requires pdfuaid:rev to be 2024 for ISO 14289-2:2024, effective PDF 2.0, A/W/S annotation tab ordering, no XFA, non-empty optional-content configuration names, no PDF 2.0-deprecated Sound or Movie annotations, and explicitly numbered H1 through Hn heading structure types

Since v3.73.0 the issue set can also contain pvuaiNaturalLanguageUncovered when non-Artifact page text or a structure Title, Alt, ActualText, or Expansion string lacks a valid effective /Lang declaration

Since v3.74.0 the issue set can also contain pvuaiArtifactInStructureTree when an Artifact page object carries an MCID claimed by the page structure tree, including path-based pagination artifacts

Since v3.75.0 the Unicode mapping issues come from one object-scoped InspectPdfUaUnicodeCoverage pass; valid ActualText covers only characters from its originating text object, while Artifact and PDFium-generated characters are excluded from semantic coverage

Internal version 3.396.0 adds pvuaiToUnicodeMapsToZero when a ToUnicode CMap destination is U+0000 (ISO 14289-1 7.21.7); the scan is operator-aware, so <0000> in codespacerange or as a bfrange source bound is not reported. PDF/UA-2 documents can additionally carry pvuaiEmbeddedFileMissingDesc when a file specification reachable from /EmbeddedFiles lacks /Desc (ISO 14289-2 8.14.1); the same file under PDF/UA-1 is not flagged because /Desc is only recommended there

Internal version 3.396.1 resolves the description check through the active catalog's EmbeddedFiles name tree, including indirect Kids and Names arrays and compressed dictionaries. Whitespace and an optional Type entry do not decide membership. Only a top-level Desc key counts, including escaped name spelling; a nested same-name key does not satisfy it. A missing or null description is reported, while an empty string satisfies this presence check without proving that its wording is meaningful. An AF-only or unrelated file specification outside that name tree is outside this particular requirement. If the active-object reader cannot inspect this tree, including an unsupported encrypted source or an exhausted parser budget, validation raises an inspection error rather than silently treating the description requirement as satisfied

Internal version 3.396.0 adds pvuaiTextStringUsesPua for a PDF/UA-2 file when a human-readable text string uses the Unicode Private Use Area (ISO 14289-2 8.6, restated for ActualText and Alt by 8.4.3). The entries inspected are ActualText, Alt, E, TU, T, Title, Subject, Keywords, Author, Contents, Desc and Name; a value is decoded as UTF-16 only when it carries a byte order mark, since PDFDocEncoding cannot express a PUA code point, so a binary hex string that happens to start with FEFF is never read as text. PDF/UA-1 has no equivalent requirement and is never flagged

ValidatePdfUa is a read-only inspection — it does not modify the document and is safe to call repeatedly. Use it before handing a PDF off to an archive system or accessibility checker to surface non-compliance to the operator. For the common "is this PDF/UA-1?" check that doesn't need the issue list, prefer the lighter-weight PdfUaConformance property

Remarks

Example

uses System.TypInfo;

var
  Outcome: TPdfUaValidationResult;
  Issue: TPdfUaValidationIssue;
begin
  Pdf1.FileName := 'C:\Incoming\report.pdf';
  Pdf1.Active := True;
  Outcome := Pdf1.ValidatePdfUa;
  Memo1.Lines.Add('Level: ' + GetEnumName(TypeInfo(TPdfUaConformance),
    Ord(Outcome.Conformance)));
  for Issue in Outcome.Issues do
    Memo1.Lines.Add('- ' + GetEnumName(TypeInfo(TPdfUaValidationIssue), Ord(Issue)));
end;

See Also

PdfUaConformance, SaveAsPdfUa, SaveAsPdfUaToStream, IsTagged, ValidatePdfA