Enterprise edition: link FPdfEnterprise with Lib\Enterprise on the search path; otherwise this method raises EPdfEnterpriseRequired; see the edition matrix
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 for the selected PDF/X print-exchange variant. 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 configured output-condition entries, referring to an embedded ICC profile via /DestOutputProfileThe 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 after writing the prepared bytes, or False if the document is inactive or the base save fails
Successful serialization does not establish complete PDF/X conformance
For pxc1a, IccProfileData must contain a structurally valid ICC v2 output profile with device class prtr, data color space CMYK, a Lab or XYZ PCS, and the required bidirectional LUTs
Missing, RGB, truncated, incorrectly classified or unsupported profile data raises EArgumentException; there is no sRGB fallback for PDF/X-1a
For PDF/X-1a, OutputCondition, OutputConditionIdentifier and OutputIntentInfo values still equal to the built-in sRGB IEC61966-2.1 default are replaced with the checked profile description
If the profile has no description, supply a nonempty, nondefault OutputConditionIdentifier; it supplies the replacement label, or the call raises EArgumentException
Explicit caller labels are preserved
Serialization and these profile checks finish in a temporary save store before the target file is opened for writing An existing target therefore remains unchanged if profile validation raises or the base save fails This is not an atomic file replacement guarantee: an I/O failure after the target is opened may leave partial output
saRemoveSecurity before marker injection/DestOutputProfileRef in place of an embedded profile. SaveAsPdfX attaches the marker corresponding to 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;