Enterprise edition: link FPdfEnterprise with Lib\Enterprise on the search path; otherwise this method raises EPdfEnterpriseRequired; see the edition matrix
function ValidatePdfX: TPdfXValidationResult;
ValidatePdfX walks the open document looking for file-format markers and selected content rules defined by the ISO 15930 family
pdfxid:GTS_PDFXVersion (and optionally pdfxid:GTS_PDFXConformance for PDF/X-1a / PDF/X-3)pdfaExtension:schemas description for the pdfxid namespace (XMP extension-schema convention)/GTS_PDFXVersion with the same value as the XMP property/OutputIntents array referencing an OutputIntent dictionary with an embedded ICC profile via /DestOutputProfileprtr / CMYK structural checks, including a Lab or XYZ PCS and the required bidirectional LUTs, and its stream must declare /N 4/Title entry (PDF/X strongly recommends it)/ID array and the absence of /Encrypt (encryption is forbidden by all PDF/X versions)xmp:CreateDate and xmp:ModifyDate entries in XMP for Info / XMP paritypvxiInvalidOutputProfile reports a PDF/X-1a output profile that is unsupported, malformed or incompatible with those requirements, including an RGB profile disguised by /N 4 or an incorrect component count. Both the sparse and compatibility validators perform this check; a /DestOutputProfile reference alone no longer establishes an acceptable PDF/X-1a profile
The result is a TPdfXValidationResult record:
pxc1a, pxc3, pxc4, pxc6, pxc6p or pxc6n; pxcNone and pxcUnknown do not establish a recognised PDF/X levelTPdfXValidationIssues set covering metadata, Info-dictionary parity, OutputIntent shape, encryption, prohibited active content, font embedding, transparency and colour-space restrictions, TrimBox presence, page-box geometry, and trapped state, drawn from the following TPdfXValidationIssue values
pvxiMissingXmpMetadata (catalogue /Metadata stream absent), pvxiMissingPdfXIdentifier (XMP pdfxid:GTS_PDFXVersion absent), pvxiMissingExtensionSchema (pdfxid extension schema description absent), pvxiMissingInfoVersionEntry (Info /GTS_PDFXVersion absent), pvxiInfoVersionMismatch (Info /GTS_PDFXVersion disagrees with the XMP value), pvxiMissingTitle (Info /Title absent), pvxiMissingTrailerId (trailer /ID absent), pvxiMissingXmpDates (xmp:CreateDate or xmp:ModifyDate missing)pvxiMissingOutputIntent (catalogue /OutputIntents absent or empty), pvxiMissingIccProfile (OutputIntent /DestOutputProfile absent), pvxiOutputIntentScheme (OutputIntent /S present but not /GTS_PDFX), pvxiOutputIntentMissingIdentifier (OutputIntent /OutputConditionIdentifier absent), pvxiInvalidOutputProfile (PDF/X-1a profile is not a supported CMYK output profile, or /N is not 4)pvxiEncryptionPresent (/Encrypt forbidden by PDF/X)pvxiLzwForbidden (/LZWDecode filter present), pvxiJavaScriptForbidden (/JavaScript action or name present), pvxiFormFieldsForbidden (/AcroForm or /XFA present), pvxiAdditionalActions (/AA additional-actions dictionary present), pvxiEmbeddedFilesForbidden (/EmbeddedFiles or /FileAttachment present), pvxiOpiForbidden (/OPI or /Alternates in an image dictionary)pvxiFontNotEmbedded (a font is used but no font programme is embedded), pvxiPdfiumFontNotEmbedded (a font used on a page is not embedded per FPDFFont_GetIsEmbedded)pvxiTransparencyForbidden (transparency group or active soft mask in X-1a or X-3), pvxiColorSpaceForbidden (a device-independent or RGB colour space in X-1a)pvxiMissingTrimBox (no /TrimBox found on any page), pvxiTrimBoxWithArtBox (a page carries /TrimBox and /ArtBox together), pvxiPageBoxOutsideMediaBox (/TrimBox or /BleedBox reaches outside /MediaBox), pvxiTrappedNotSet (/Trapped absent or /Unknown)Conformance is a real PDF/X level and Issues is emptyValidatePdfX is a read-only inspection. Use it before pushing a
PDF/X payload into a prepress workflow to surface non-conformance
to the operator. For the common "what PDF/X level is this?" check
that doesn't need the issue list, prefer the lighter-weight
PdfXConformance property
pvxiInfoVersionMismatch only when both Info /GTS_PDFXVersion and XMP pdfxid:GTS_PDFXVersion are present and disagreeConformance = pxcUnknown and an empty Issues setPDF/X-1, PDF/X-3, PDF/X-4, PDF/X-6, PDF/X-6p or PDF/X-6n; marker recognition alone is not a conformance verdict
uses System.TypInfo;
var
Outcome: TPdfXValidationResult;
Issue: TPdfXValidationIssue;
begin
Pdf1.FileName := 'C:\Incoming\ad.pdf';
Pdf1.Active := True;
Outcome := Pdf1.ValidatePdfX;
Memo1.Lines.Add('Level: ' + GetEnumName(TypeInfo(TPdfXConformance),
Ord(Outcome.Conformance)));
for Issue in Outcome.Issues do
Memo1.Lines.Add('- ' + GetEnumName(TypeInfo(TPdfXValidationIssue), Ord(Issue)));
end;