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), whilst PDF/VT-2 must use one of the file-set bases PDF/X-4p, PDF/X-5g or PDF/X-5pg (§6.2.2)pdfaExtension: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), pvcNone (no PDF/VT marker), or pvcUnknown (marker present but file-level version unrecognised)TPdfVTValidationIssues set with zero or more marker, DPart, PDF/X inheritance, recurring-object, and encapsulation issue valuespvviGtsScopeInvalidValue, 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;