Enterprise edition: link FPdfEnterprise with Lib\Enterprise on the search path; otherwise this method raises EPdfEnterpriseRequired; see the edition matrix
function ValidatePdfVT: TPdfVTValidationResult;
ValidatePdfVT walks the open document looking for the file-format-level markers defined by ISO 16612-2:2010:
pdfvtid:GTS_PDFVTVersion (§6.3 Table 2) and pdfvtid:GTS_PDFVTModDatepdfvtid:GTS_PDFVTModDate and xmp:ModifyDate (§6.3 NOTE 1)pdfxid:GTS_PDFXVersion — PDF/VT-1 must be PDF/X-4 (§6.2.1), PDF/VT-2 must use one of the file-set bases PDF/X-4p, PDF/X-5g, or PDF/X-5pg (§6.2.2), and PDF/VT-3 must use PDF/X-6, PDF/X-6p or PDF/X-6n (ISO 16612-3:2020 §6.2). PDF/VT-3 also requires pdfvtid:rev, reported as pvviVT3MissingRevisionYearpdfaExtension:schemas description for both pdfvtid and pdfxid namespaces/DPartRoot entry with a usable §6.5 DPart tree: the /DPartRootNode, XML NMTOKEN-compatible /NodeNameList, parent links, /DParts array-of-arrays, leaf /Start//End ranges, and per-page /DPart references must cover the page tree exactly once in depth-first orderGTS_XID, GTS_Scope, and GTS_Env, the indirect DPartRoot RecordLevel used by Record scope, and the PDF/VT-2s-only boundary for Stream scopeFlateDecode page or Form XObject streams, resolving each Do operand through effective inherited resources to enforce SingleUse counts, resource visibility, and single-recipient ownership for Record scopeIntent, required isolated transparency Group with a blending colour space, and optional-content marked operators in direct or nested Form content/OutputIntents array with an OutputIntent that has an embedded /DestOutputProfile or external /DestOutputProfileRef appropriate for the PDF/X base/ID array and the absence of /Encrypt (PDF/X forbids encryption)xmp:CreateDate and xmp:ModifyDate entries in XMP for Info / XMP parityThe result is a TPdfVTValidationResult record:
pvc1 (PDF/VT-1 marker), pvc2 (PDF/VT-2 marker), pvc3 (PDF/VT-3 marker), pvcNone (no PDF/VT marker), or pvcUnknown (marker present but file-level version unrecognized)TPdfVTValidationIssues set with zero or more marker, DPart, PDF/X inheritance, recurring-object, and encapsulation issue valuespvviMissingXmpMetadata (catalog /Metadata stream absent), pvviMissingPdfVTIdentifier (pdfvtid:GTS_PDFVTVersion absent), pvviMissingExtensionSchema (no pdfvtid extension schema description), pvviMissingPdfVTModDate (pdfvtid:GTS_PDFVTModDate absent), pvviModDateMismatch (pdfvtid:GTS_PDFVTModDate differs from xmp:ModifyDate), pvviInfoModDateMismatch (Info /ModDate differs from xmp:ModifyDate), and pvviMissingXmpDates (an xmp:CreateDate or xmp:ModifyDate entry is absent)pvviMissingPdfXIdentifier (pdfxid:GTS_PDFXVersion absent, so PDF/VT-1 cannot be confirmed as PDF/X-4), pvviMissingOutputIntent (catalog /OutputIntents absent), pvviMissingIccProfile (OutputIntent /DestOutputProfile absent), pvviOutputIntentScheme (OutputIntent /S is not /GTS_PDFX), pvviOutputIntentMissingIdentifier (/OutputConditionIdentifier absent), pvviMissingTrailerId (trailer /ID array absent), and pvviEncryptionPresent (/Encrypt present, which PDF/X forbids)pvviMissingDPartRoot (no usable catalog /DPartRoot tree), pvviDPartsBadChunking (/DParts sub-arrays violate the 8192-except-last chunking rule), pvviDpmInvalidKeyName (a DPM key is not an XML NMTOKEN after # escape expansion, or lacks the Annex E second-class prefix), pvviDpmDuplicateKey (two DPM keys collapse to the same name after # escape expansion), and pvviDpmManagedShape (GTS_Managed or GTS_Suspect is present with a value that is not a dictionary)pvviLzwForbidden (/LZWDecode filter present), pvviJavaScriptForbidden (/JavaScript action or name present), pvviEmbeddedFilesForbidden (/EmbeddedFiles or /FileAttachment present), pvviOpiForbidden (/OPI or /Alternates present), pvviPdfiumFontNotEmbedded (a font used on a page is not embedded per FPDFFont_GetIsEmbedded), pvviAcroFormForbidden (/AcroForm or /XFA present), and pvviAdditionalActionsForbidden (catalog or page /AA additional actions present)/Trapped, and Reference XObject issue values include pvviMissingTrimBox (no page declares /TrimBox, which PDF/X-4 requires), pvviTrappedInvalid (/Trapped absent or set to /Unknown, both forbidden by ISO 15930-7), and pvviReferenceXObjectForbidden (a Reference XObject is present, allowed only by PDF/X-5g and PDF/X-5pg and forbidden in PDF/VT-1)pvviGtsScopeInvalidValue, pvviGtsScopeRecordWithoutRecordLevel, pvviGtsXidNotUuid, pvviGtsEnvMissing, pvviGtsXidInvalidType, pvviGtsEnvInvalidType, pvviGtsScopeStreamInVT1, pvviGtsScopeSingleUseRepeated, pvviGtsScopeRecordCrossesRecords, and pvviGtsResourceNotVisiblepvviGtsEncapsulatedInvalidType, pvviGtsEncapsulatedMissingScope, pvviGtsEncapsulatedImageMissingIntent, pvviGtsEncapsulatedGroupInvalid, and pvviGtsEncapsulatedOptionalContentConformance is a real PDF/VT level and Issues is emptyValidatePdfVT is read-only. It checks the file-format markers,
selected DPart tree semantics, recurring XObject scope and encapsulation,
exact PDF/VT-to-PDF/X base pairing, and XMP
properties whether they are written as elements or RDF attributes. Pair
it with a PDF/X preflight engine for full content-level verification and,
for PDF/VT-2, InspectPdfVT2sStream or another complete file-set validator. PDF/VT-2s is a MIME stream
conformance level whose version is signalled by the MIME stream header in
ISO 16612-2 Annex A, not by a file-level pdfvtid:GTS_PDFVTVersion
value
pvviMissingDPartRoot is emitted when the catalog lacks a usable /DPartRoot hierarchy or when the tree violates §6.5 requirements such as malformed /DParts arrays, mixed /Start and /DParts, duplicated child ownership, invalid /NodeNameList names or depth mismatches, page ranges that do not follow the page tree order, single-page ranges that repeat /Start as /End, or page /DPart links that do not point to the covering leaf DPartFlateDecode streams; content streams with other or chained filters remain available to dedicated full-preflight enginespvviModDateMismatch is emitted only when both pdfvtid:GTS_PDFVTModDate and xmp:ModifyDate are present and their values differ; SaveAsPdfVT always writes them with the same valueConformance = pvcUnknown and an empty Issues set
uses System.TypInfo;
var
Outcome: TPdfVTValidationResult;
Issue: TPdfVTValidationIssue;
begin
Pdf1.FileName := 'C:\Incoming\statements.pdf';
Pdf1.Active := True;
Outcome := Pdf1.ValidatePdfVT;
Memo1.Lines.Add('Level: ' + GetEnumName(TypeInfo(TPdfVTConformance),
Ord(Outcome.Conformance)));
for Issue in Outcome.Issues do
Memo1.Lines.Add('- ' + GetEnumName(TypeInfo(TPdfVTValidationIssue), Ord(Issue)));
end;