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 recognized 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). Stricter ISO 19005 checks add pvaiTrappedTrue, pvaiForbiddenActionSubtype, pvaiTransparentColorSpace, pvaiAnnotationDictViolation, pvaiUnembeddedFont, pvaiMixedDeviceColorSpaces, pvaiUndefinedContentOperator, pvaiForbiddenRenderingIntent, pvaiExtGStateTransferFunction, pvaiImageDictionaryViolation, pvaiFormXObjectViolation, pvaiPostScriptOrRefXObject, pvaiAnnotationFlagsViolation, pvaiDeprecatedAction, pvaiMetadataFilterForbidden, pvaiStructElemTypeMissing, and pvaiRoleMapMissing. Round 4 adds pvaiHeaderBinaryMarkerMissing (6.1.2), pvaiExternalStreamRef (6.1.7), pvaiOutputIntentScheme (6.2.2), pvaiInfoXmpDateMismatch (6.7.3), pvaiMarkInfoMissing (6.8.2.2 Level A), pvaiAnnotationApDictViolation (6.5.3), pvaiEmbeddedFileMissingAFRelationship (PDF/A-3 Annex E.2), and pvaiJpeg2000Violation (PDF/A-2 6.2.8.3). Round 5 adds pvaiCidFontMissingCidToGidMap (6.3.3.2), pvaiSubsetMissingCharSet (6.3.5), pvaiSubsetMissingCidSet (6.3.5), pvaiWidgetActionForbidden (6.6.1), and pvaiOptionalContentAsKey (PDF/A-2 6.9). Round 6 adds pvaiNeedsRenderingPresent (PDF/A-2 6.4.2), pvaiDestOutputProfileRef (PDF/A-3 6.2.3), pvaiEmbeddedFileMissingUF (PDF/A-3 6.8), pvaiXmpPacketBytesAttr (6.7.5), and pvaiAnnotationToggleNoView (PDF/A-2 6.3.2). Round 7 (v1.73.0) adds the Pdfium object-model layer: pvaiPdfiumFontNotEmbedded (6.3.4, per-font FPDFFont_GetIsEmbedded) and pvaiPdfiumUnicodeMapError (6.3.8, per-character FPDFText_HasUnicodeMapError); these are set by TPdf.ValidatePdfA, not the standalone byte-level ValidatePdfACompliance. Round 8 (v1.74.0) adds pvaiPermissionsViolation (6.1.12), pvaiTransActionForbidden (PDF/A-2 6.5.1), and pvaiPdfiumObjectTransparency (PDF/A-1 6.4 via FPDFPageObj_HasTransparency). Round 9 (v1.75.0) adds pvaiIntegerImplementationLimit (PDF/A-2 6.1.13), pvaiBlendModeNotWhitelisted (PDF/A-2 6.2.10), and pvaiHexStringOddDigits (6.1.6). Round 10 (v1.76.0) adds pvaiNameNotValidUtf8 (PDF/A-2 6.1.8), pvaiInlineImageLzwForbidden (PDF/A-2 6.1.10), and pvaiTrueTypeDifferencesForbidden (6.3.7). Round 11 (v1.77.0) adds pvaiPdfiumNotDefGlyph (PDF/A-2 6.2.11.8, Pdfium object-model), pvaiWordBreakMissing (Level A 6.8.3.2), and pvaiLinkActionMissingTarget (6.6.3)pvaiMissingXmpMetadata means the catalog /Metadata key is absent, unreadable, or does not resolve to a stream dictionary with /Type /Metadata and /Subtype /XMLpvaiPdfA1Pdf15Structure reports PDF/A-1 documents that contain PDF 1.5 cross-reference streams or object streams; these structures remain valid for PDF/A-2 and PDF/A-3pvaiInlineImageLzwForbidden applies to inline-image filters in every PDF/A part: PDF/A-1 rejects /LZWDecode and PDF/A-2 / PDF/A-3 also reject inline-image /LZW, /LZWDecode, and /Crypt filter valuespvaiImageDictionaryViolation also covers PDF/A-2 and PDF/A-3 inline images whose /I or /Interpolate value is true, in addition to Image XObject /Alternates, /OPI, and /Interpolate true dictionary violationspvaiAnnotationApDictViolation covers both malformed annotation appearance dictionaries whose /AP entry contains keys other than /N and annotations that require but lack an appearance dictionaryConformance is a real PDF/A level and Issues is emptyValidatePdfA 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 color spaces or per-glyph font coverage), so pair it with a full validator such as veraPDF when exhaustive certification is requiredConformance = 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;