Home  ›  Playgrounds  ›  Print & PDF/X (v1.7.0 → v1.9.0)

Print production and PDF/X-4 — since 1.7.0, CMYK in 1.8.0, spot colours in 1.9.0

Bleed boxes and printer's marks since 1.7.0; since 1.8.0, CMYK colours, CMYK OutputIntents, marks in the registration colour, a PDF/X-4 conformance claim and validatePdfX(); since 1.9.0, spot colours (/Separation inks and /DeviceN mixes declared in print.spotColours) and the dual claim — one file that is both PDF/A-2b and PDF/X-4. The CMYK-intent presets take an output ICC profile. Choose the one your printer names (ISO Coated v2, GRACoL, SWOP…) — the file is read in your browser and never uploaded — or choose none and the page falls back to the synthetic CMYK profile that buildSyntheticCmykProfile() from pdfnative/tools builds, the same one the repository's samples use. The synthetic profile is structurally complete (a prtr profile validators accept) but characterises no press: a real job needs your printer's profile. pdfnative itself ships none.

View underlying code

Diagnostics (layout.onDiagnostic)

Generate a PDF to see the diagnostics its build raised. Every preset wires layout.onDiagnostic; a coherent print job raises none. Tick the PDF/A-2b claim on the CMYK preset to see PDFA_DEVICE_CMYK_CONTENT: CMYK colour under a claim whose OutputIntent is not CMYK.
Worth knowing:
  • The synthetic profile is built by scripts/lib/synthetic-cmyk-profile.ts in the repository: an ICC v2 output profile (prtr, CMYK data, Lab connection space) with a naive device transform. It exists so that samples and this page can be self-sufficient; it describes no printing condition, so never send a file built with it to a press.
  • CMYK colours are [c, m, y, k] in percent, or a 'C M Y K' string in 0–1; they are written with k / K.
  • Under a CMYK intent, the RGB colours pdfnative draws by default are remapped through a calibrated /DefaultRGB, so the PDF/A or PDF/X claim holds.
  • PDF/X-4 rejects, before writing, a PDF/A level, encryption, a missing or non-output profile, and trapped: 'Unknown'.
  • validatePdfX() checks the structure; veraPDF does not cover PDF/X, so confirm press files with a certified preflight.
  • Colour bars (marks: { colourBars: true }) paint C, M, Y, K at 100 % and 50 % in the bottom bleed strip as DeviceCMYK fills. They need a 5 mm bleed to reach the 12 pt default patch — 3 mm would clamp them to 7.5 pt — and a CMYK intent under PDF/A or PDF/X.

See the Print production guide for the full options.