ConvertToPDFXEx

PDF/X

Description

Prepares the open document for print exchange as a PDF/X file using explicit colour conversion and transparency flattening policies, then validates the result

Syntax

Delphi

Function TPDFlib.ConvertToPDFXEx(TargetMode: Integer; Const ProfileFileName: WideString; ColorPolicy, FlattenPolicy, DPI: Integer): Integer;

Parameters

TargetMode1 through 9 as in SetPDFXMode and ConvertToPDFX
ProfileFileNameFor embedded-profile parts (1–4, 8), the printing-condition ICC file (a CMYK output prtr profile for PDF/X-1a), or an empty string to keep existing document or PDF/X-6 page-level output intents; external-profile parts (5, 6, 7, 9) require an empty string
ColorPolicy0 (PDF_PDFX_COLOR_STRICT) rejects unflattened RGB content in PDF/X-1a; 1 (PDF_PDFX_COLOR_CONVERT_CMYK) converts device and calibrated RGB page operators, Form XObjects, 8-bit images, and compatible shadings to DeviceCMYK using the document's CMYK output-intent ICC profile via a 17×17×17 trilinear lookup table
FlattenPolicy0 (PDF_PDFX_FLATTEN_REJECT) leaves transparency intact so preflight rejects unsupported pages; 1 (PDF_PDFX_FLATTEN_CMYK) flattens only pages with transparency in PDF/X-1a and PDF/X-3 onto opaque white at DPI, converting newly flattened rasters to DeviceCMYK for PDF/X-1a
DPI0 (defaults to 300) or 36 through 1200, the resolution used when FlattenPolicy flattens transparent pages

Return values

1The private candidate passed PDF/X preflight and replaced the open document
0Arguments were invalid, conversion failed, or preflight found remaining issues; the original document is retained and GetPDFXConversionReport lists every action, diagnostic, and blocker

Remarks

PDF/X preflight enforces ICC header integrity and device classes: output-intent ICC streams must declare valid prtr or mntr classes, and PDF/X-1a or CMYK intents strictly require a four-component CMYK output (prtr) profile

The conversion report also records spot colourants (Separation and DeviceN, flagging any RGB alternate space) and graphics-state overprint settings (OP, op, and OPM)

Example

PDF.LoadFromFile('brochure.pdf', '');
if PDF.ConvertToPDFXEx(1, 'CoatedFOGRA39.icc',
  PDF_PDFX_COLOR_CONVERT_CMYK, PDF_PDFX_FLATTEN_CMYK, 300) = 1 then
  PDF.SaveToFile('brochure-x1a.pdf')
else
  ShowMessage(PDF.GetPDFXConversionReport);

See also

ConvertToPDFX, GetPDFXConversionReport, SetPDFXMode, ConvertToPDFAEx, CheckFileCompliance