function SaveAsPdfX(const FileName: string): Boolean; overload;
function SaveAsPdfX(const FileName: string; const Options: TPdfXSaveOptions): Boolean; overload;
SaveAsPdfX performs the regular SaveAs first, then layers an incremental update on top of the saved bytes that promotes the file to PDF/X conformance — the ISO 15930 family of print-exchange standards used in the graphic arts industry. The post-processing injects five classes of bytes into the saved stream:
pdfxid:GTS_PDFXVersion, plus pdfxid:GTS_PDFXConformance for PDF/X-1a / PDF/X-3) plus the matching pdfaExtension:schemas description for the pdfxid namespace, and bridged Dublin Core / xmp / pdf properties for Title / Author / Producer / dates./GTS_PDFXVersion, the optional /GTS_PDFXConformance (PDF/X-1a / PDF/X-3 only; PDF/X-4 deprecates this entry), and a /Trapped name (defaults to /False). Existing Info entries (Title / Author / Subject / etc.) are preserved./Metadata N 0 R and /OutputIntents [M 0 R] references./Type /OutputIntent /S /GTS_PDFX and the required /OutputCondition / /OutputConditionIdentifier / /RegistryName / /Info entries, referring to an embedded ICC profile via /DestOutputProfile.Options.IccProfileData for commercial print).The trailer is rewritten to add an /ID array. The
output stays byte-identical to the base SaveAs result up to the end
of the original PDF; only the incremental update is appended. The
two overloads differ only in how the configuration is passed in:
the file-name-only form uses TPdfXSaveOptions.Default
(PDF/X-4 + sRGB + /Trapped /False) with auto-population
of Info / DocumentId fields from FPDF_GetMetaText and
FPDF_GetFileIdentifier.
Returns True on success. Returns False
if the base SaveAs failed or if the incremental update could not be
attached.
Options.IccProfileData with the ICC bytes for the target press characterisation (FOGRA39, ISO Coated v2, GRACoL2006_Coated1v2, JapanColor2011Coated, etc.) and update OutputConditionIdentifier / RegistryName / OutputIntentInfo accordingly.SaveAs(..., saRemoveSecurity) on encrypted sources before SaveAsPdfX.Options.Conformance but cannot enforce these content-level rules. Confirm via preflight.
// Simple PDF/X-4 with bundled sRGB OutputIntent
if Pdf1.SaveAsPdfX('C:\AdProof.pdfx.pdf') then
ShowMessage('Saved PDF/X-4');
// PDF/X-1a with a custom CMYK ICC profile (e.g. FOGRA39)
var
Opts: TPdfXSaveOptions;
begin
Opts := TPdfXSaveOptions.Default;
Opts.Conformance := pxc1a;
Opts.IccProfileData := TFile.ReadAllBytes('C:\ICC\FOGRA39.icc');
Opts.OutputCondition := 'Coated FOGRA39 (ISO 12647-2:2004)';
Opts.OutputConditionIdentifier:= 'FOGRA39';
Opts.RegistryName := 'http://www.color.org';
Opts.Trapped := ptFalse;
Pdf1.SaveAsPdfX('C:\AdProof.cmyk.pdfx.pdf', Opts);
end;