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, pac2b, pac3b, pacNone, or pacUnknown for a PDF/A marker without a recognised level).TPdfAValidationIssues set of TPdfAValidationIssue values describing each problem found: pvaiMissingXmpMetadata, pvaiMissingPdfAIdentifier, pvaiMissingOutputIntent, pvaiMissingIccProfile, pvaiEncryptionPresent, pvaiMissingTrailerId, pvaiMissingXmpDates, and pvaiMissingExtensionSchema.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.
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;