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 catalog 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.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.
Conformance = pucUnknown and an empty Issues set.pvuaiSuspectsTrue when an explicit /Suspects true appears in /MarkInfo. Documents that lack the /Suspects key entirely are considered compliant on that point (the spec only forbids true).N 0 R) that does not contain /DisplayDocTitle, the validator reports pvuaiMissingDisplayDocTitle — but SaveAsPdfUa does not rewrite the referenced object. Adjust the source's ViewerPreferences before calling SaveAsPdfUa in that case.
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;