function ValidatePdfUa: TPdfUaValidationResult;
ValidatePdfUa walks the open document looking for the PDF/UA-1 file-format markers defined by ISO 14289-1:2014:
pdfuaid:part = 1 and the matching pdfaExtension:schemas description (§5).dc:title entry inside the XMP packet (§7.1).StructTreeRoot in the catalogue or somewhere in the file (§7.1) — required so the document can carry tagging at all./MarkInfo << /Marked true /Suspects false >> (§7.1)./ViewerPreferences << /DisplayDocTitle true >> (§7.1)./Lang with a BCP 47 language tag (§7.2)./ID array and the absence of encryption.xmp:CreateDate / xmp:ModifyDate (recommended for Info/XMP parity).The result is a TPdfUaValidationResult record:
puc1 (PDF/UA-1 identifier found), pucNone (no PDF/UA marker), or pucUnknown (parse failed).TPdfUaValidationIssues set containing zero or more values: pvuaiMissingXmpMetadata, pvuaiMissingPdfUaIdentifier, pvuaiMissingExtensionSchema, pvuaiMissingDcTitle, pvuaiMissingStructTreeRoot, pvuaiMissingMarkInfo, pvuaiSuspectsTrue, pvuaiMissingDisplayDocTitle, pvuaiMissingLang, pvuaiEncryptionPresent, pvuaiMissingTrailerId, pvuaiMissingXmpDates, pvuaiFontNotEmbedded, pvuaiFontMissingToUnicode, pvuaiMissingTabsOrder, pvuaiFigureMissingAlt, pvuaiFormulaMissingAlt, pvuaiNoteMissingIdConformance is a real PDF/UA level and Issues is emptyValidatePdfUa 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 does not need the issue list, prefer the lighter-weight
PdfUaConformance property
Conformance = pucUnknown and an empty Issues setpvuaiSuspectsTrue when an explicit /Suspects true appears in /MarkInfo. Documents that do not have the /Suspects key at all are considered compliant on that point (the spec only forbids true)N 0 R); existing keys are preserved and the dictionary is normalised to a direct dictionary in the rewritten catalog
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;