function ValidatePdfA: TPdfAValidationResult;
ValidatePdfA walks the open document looking for every PDF/A conformance marker defined by ISO 19005-1 (with Cor.1:2007):
pdfaid:part and pdfaid:conformance entries, which tells the validator what PDF/A level the document was authored against (1a, 1b, 2b, 3b, ...)./ID array (mandatory per ISO 19005-1 6.1.3).xmp:CreateDate and xmp:ModifyDate in the XMP packet (required when the Info dictionary holds CreationDate / ModDate values per 6.7.3 Example 2).pdfaExtension:schemas container describing the pdfaid extension schema (required by 6.7.8 / Cor.1).The result is a TPdfAValidationResult record:
pac1a, pac1b, pac2a, pac2b, pac2u, pac3a, pac3b, pac3u, pacNone, or pacUnknown for a PDF/A marker without a recognised level).TPdfAValidationIssues set of TPdfAValidationIssue values describing each problem found. The structural markers are pvaiMissingXmpMetadata, pvaiMissingPdfAIdentifier, pvaiMissingOutputIntent, pvaiMissingIccProfile, pvaiEncryptionPresent, pvaiMissingTrailerId, pvaiMissingXmpDates, and pvaiMissingExtensionSchema. It also reports content-level violations that marker injection cannot fix: pvaiLevelAStructureMissing (a Level A claim with no tagged structure), pvaiJavaScriptPresent, pvaiForbiddenAction, pvaiAdditionalActions, pvaiEmbeddedFilesNonConforming, pvaiLzwUsed, pvaiTransparencyForbidden, pvaiOptionalContentForbidden, pvaiForbiddenAnnotation, pvaiNeedAppearancesTrue, pvaiXfaPresent, pvaiFontNotEmbedded, and pvaiUnicodeMappingMissing (a PDF/A-2u / PDF/A-3u claim whose fonts lack /ToUnicode).ValidatePdfA 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 to surface non-compliance to the
operator. For the common "what level is this?" check that doesn't
need the issue list, prefer the lighter-weight
PdfAConformance property.
/NeedAppearances and /XFA, and fonts whose descriptors carry no embedded font program — in addition to the structural markers. The transparency, optional-content and embedded-file checks are applied according to the claimed PDF/A part (forbidden in PDF/A-1; permitted in PDF/A-2 and PDF/A-3). It remains a fast byte-level inspection rather than an exhaustive validator (it does not, for example, parse colour spaces or per-glyph font coverage), so pair it with a full validator such as veraPDF when exhaustive certification is required.Conformance = pacNone and an empty Issues array.
uses System.TypInfo;
var
Outcome: TPdfAValidationResult;
Issue: TPdfAValidationIssue;
begin
Pdf1.FileName := 'C:\Incoming\report.pdf';
Pdf1.Active := True;
Outcome := Pdf1.ValidatePdfA;
Memo1.Lines.Add('Level: ' + GetEnumName(TypeInfo(TPdfAConformance),
Ord(Outcome.Conformance)));
for Issue in Outcome.Issues do
Memo1.Lines.Add('- ' + GetEnumName(TypeInfo(TPdfAValidationIssue), Ord(Issue)));
end;