しずかなインターネット

日記やエッセイにちょうどいい
文章書き散らしサービス

ログイン

PDF/X-1a and PDF/X-4 Prepress Architecture in JavaScript

utilvo
·
公開:2026/11/1

In commercial offset and digital printing, sending a standard consumer PDF (%PDF-1.7) directly to a Raster Image Processor (RIP) frequently leads to costly production errors: RGB images shift unexpectedly when converted to cyan-magenta-yellow-black (DeviceCMYK) plates, unembedded fonts substitute with incorrect glyph widths, and missing bleed boxes leave white slivers along trim edges.

To eliminate device-dependent ambiguity in print production, the International Organization for Standardization created the PDF/X family of standards (ISO 15930):

- PDF/X-1a (ISO 15930-1 / 15930-4): Requires complete blind exchange—all color spaces must be converted to DeviceCMYK, DeviceGray, or named /Separation spot colors; RGB and Lab spaces are strictly forbidden, and live transparency (/SMask, /CA < 1.0) must be flattened.

- PDF/X-3 (ISO 15930-3 / 15930-6): Permits calibrated, ICC-tagged color spaces (/ICCBased) alongside CMYK, provided a destination /OutputIntent profile is embedded.

- PDF/X-4 (ISO 15930-7): Built on PDF 1.6, supporting live native PDF transparency groups, OpenType fonts, and JPEG2000 (JPXDecode) while enforcing strict /OutputIntent and page-boundary rules.

In this technical guide, we will examine the internal dictionary structures that distinguish a compliant PDF/X file from an ordinary PDF, and write JavaScript (pdf-lib / Uint8Array) routines to:

1. Audit and inject print geometry boxes (/MediaBox, /TrimBox, /BleedBox, /ArtBox).

2. Construct a valid /OutputIntents array with an embedded CMYK ICC destination profile (/GTS_PDFX).

3. Populate the mandatory GTS_PDFXVersion and /Trapped keys inside the /Info and XMP metadata streams.

1. Structural Requirements of a Compliant PDF/X Document

Every PDF/X preflight engine (such as Callas pdfChip, Enfocus PitStop, or Adobe Acrobat Preflight) verifies five core structural invariants in the PDF object graph:

■ Rule 1: Page Geometry Nesting (/MediaBox \supseteq /BleedBox \supseteq /TrimBox)

A standard PDF only requires a /MediaBox. A PDF/X file must explicitly define either a /TrimBox or an /ArtBox on every page, and it cannot define both on the same page. Furthermore, all boundary boxes must nest inside /MediaBox:

- /MediaBox: Full physical sheet dimensions (including crop marks and color bars).

- /BleedBox: Extends 3 mm (8.504 pt) or 0.125 in (9 pt) outside the final trim edge so ink extends past the guillotine blade.

- /TrimBox: Exact finished dimensions of the printed page after cutting.

2. Auditing and Injecting /TrimBox and /BleedBox in JavaScript

Below is a JavaScript function using pdf-lib low-level dictionary manipulation (PDFName, PDFArray) that inspects every page in a PDF document, removes conflicting /ArtBox entries when /TrimBox is set, and calculates compliant /BleedBox and /TrimBox coordinates:

3. Constructing the /OutputIntents Dictionary and ICC Profile Stream

In PDF/X, device color values (c m y k k or C M Y K K operators in content streams) are only meaningful when paired with an Output Intent that tells the print RIP which characterization condition (such as CGATS TR 001 / SWOP in North America or FOGRA39 / ISO Coated v2 in Europe) the colors were separated for.

An /OutputIntent dictionary has type /OutputIntent and subtype /S /GTS_PDFX. When embedding an ICC destination profile stream, the stream dictionary must specify /N 4 (indicating a 4-component CMYK color profile):

4. Setting /GTS_PDFXVersion and the /Trapped Flag

Preflight validators immediately reject any PDF/X candidate if the Document Information Dictionary (/Info) is missing /GTS_PDFXVersion, /Title, or if /Trapped is unset or /Unknown. Notice that /Trapped must be a PDF Name object (/True or /False), not a boolean literal (true / false):

5. Detecting Prohibited RGB Operators and Unembedded Fonts Before Print

Even if /OutputIntents and /TrimBox are properly configured, a PDF/X-1a file will fail RIP preflight if any page content stream invokes RGB color operators (rg, RG) or if any /FontDescriptor lacks an embedded font program (/FontFile, /FontFile2, or /FontFile3).

Here is a lightweight preflight scanner that inspects the indirect object table for unembedded fonts and prohibited encryption or transparency constructs:

For designers and print engineers who want to convert standard PDFs into press-ready files with compliant /OutputIntents, /TrimBox / /BleedBox geometry, and /GTS_PDFX metadata directly in the browser without uploading large print layouts to an external server, you can use the client-side PDF/X Converter .

6. Choosing Between PDF/X-1a and PDF/X-4 for Modern Print RIPs

• Feature : PDF/X-1a:2003 : PDF/X-4 (ISO 15930-7)

• Base PDF Version : PDF 1.4 : PDF 1.6

• Allowed Color Spaces : DeviceCMYK, DeviceGray, Spot (/Separation) : CMYK, Gray, Spot + ICC-tagged RGB/Lab

• Live Transparency (/SMask) : Forbidden (must be flattened) : Native live transparency supported

• Object Streams (/ObjStm) : Forbidden : Permitted

• 16-Bit Images & JPEG2000 : Forbidden : Permitted

When targeting modern Adobe PDF Print Engine (APPE) RIPs, PDF/X-4 is generally preferred because keeping transparency live allows the RIP to composite drop shadows and vector overprints at the native resolution of the platesetter (2400 DPI), avoiding the thin white stitching artifacts often caused by early raster flattening in PDF/X-1a.

@utilvo
Software engineer writing about browser internals, WebAssembly, binary file parsers, and document engineering.