To generate a PDF a commercial printer accepts, export vector pages at their physical size with bleed and a trim box, embed every font, and declare the printer's ICC profile, usually in a PDF/X-4 file. Writing that file is the easy half. Proving it is PDF/X is harder, because no free tool validates PDF/X.
We wrote the PDF/X writer in Polotno, our design editor SDK. It runs in the browser and in Node without calling Ghostscript or any other external tool. The checklist below is what every printer asks for. The rest is what testing more than 200 generated PDF/X files taught us, including a bug that passed every check we had.
What a printer checks
Get the printer's spec sheet before you write export code. It names the bleed, the ICC profile and the PDF/X version. These are the usual values:
| Check | Typical spec | Why it matters |
|---|---|---|
| Page size | Physical units. A4 is 210 × 297 mm: 595 × 842 pt, or 2480 × 3508 px at 300 PPI | A canvas pixel has no physical size until you choose a resolution |
| Bleed | 3 mm per side, 0.125 in in the US | Sheets shift on press and in the cutting stack, so the cut rarely lands on the line |
| Safe zone | Text and logos 3 mm inside the trim | The same drift works inward |
| Trim box | On every page | Without one, software treats the bleed as part of the finished piece |
| Color | CMYK, or RGB with its own profile, plus the printer's ICC profile as the output intent | Bright screen colors have no CMYK equivalent and print duller |
| Black text | Pure black ink, 100% K | Four-ink black shows colored fringes on small text when the plates misalign |
| Total ink | From about 240% on newsprint to 330% on coated stock, set by the profile | Heavier coverage smears or dries badly |
| Fonts | All embedded | Otherwise the printer substitutes one |
| Photos | About 300 PPI at printed size, 150 for posters | Less prints soft up close |
| Fine detail | Type at least 6 pt, white-on-dark type at least 8 pt, lines at least 0.25 pt | Anything finer fills in or disappears |
| Spot colors and cut lines | Named separations, usually set to overprint | Foil, varnish, Pantone inks and die lines each become a plate, a die or a cutting path |
| PDF/X version | PDF/X-4, or X-1a when the printer insists | X-4 keeps transparency and tagged RGB. X-1a has to flatten both away |
The usual profiles are FOGRA39 or PSO Coated v3 for coated paper in Europe, FOGRA52 for uncoated, GRACoL 2013 for commercial printing in the US, and SWOP for US magazines.
The recipe in most JavaScript tutorials, toDataURL() on a canvas with the image placed on a jsPDF page, fails most of these rows. It produces an RGB image at screen resolution with no bleed, no trim box and no output intent, and its text is pixels. Outside Polotno, PDFKit writes CMYK and spot colors and leaves bleed and PDF/X to you. For HTML input, WeasyPrint's docs cover CMYK, bleed and PDF/X, while Chrome's PDF output, and so Puppeteer's, is RGB only. Rendering an RGB PDF and converting it with Ghostscript and an ICC profile also works, if you plan for it from the start.
Exporting PDF/X with Polotno
A Polotno design stores sizes in design pixels, a DPI that maps them to physical size, and a bleed for each page. In the editor, the bleed shows when the bleed view is on, and users change it in the Resize panel. @polotno/pdf-export turns the JSON into PDF/X, in the browser or in Node, with the same print options in both:
// `store` is your Polotno editor store. An A4 page designed at 300 DPI
// with 3 mm bleed looks like:
// { dpi: 300, width: 2480, height: 3508, pages: [{ bleed: 36, ... }] }
async function exportForPrint(store) {
// Load the exporter on demand: the browser bundle is around 1 MB
const { jsonToPDFBlob } = await import('@polotno/pdf-export');
// The output profile your printer names
const response = await fetch('/profiles/ISOcoated_v2_eci.icc');
const profile = new Uint8Array(await response.arrayBuffer());
return jsonToPDFBlob(store.toJSON(), {
key: 'YOUR_API_KEY',
pdfx: 'x-4',
outputIntent: { profile, identifier: 'FOGRA39' },
colorMode: 'cmyk', // fills, strokes and gradients; photos stay tagged RGB
includeBleed: true,
});
}The blob is ready to upload to a print vendor; jsonToPDF with a file name downloads the file instead. Get the profile from your printer or from ECI's downloads, and check its license before you serve it from a public URL. In Node 22.13 or later, read the profile with readFile and call jsonToPDF(design, './print.pdf', options). The Cloud Render API writes vector PDF/X from the same JSON and, when the job asks for CMYK, converts it through its built-in FOGRA39 or US Web Coated (SWOP) profile. For GRACoL or any other profile, run the exporter yourself. The SDK runs free for 30 days on a development server, and production needs a license.
CMYK mode converts fills, strokes and gradients through the profile and leaves photos in RGB, tagged as sRGB. Converting a photo early only loses gamut. The printer converts it at the last step, and what CMYK mode buys you is exact vector and brand colors.
Black needs a decision. Through FOGRA39, pure RGB black converts to about C87 M78 Y65 K93, which is 323% ink on four plates. RGB has no black channel to preserve, so any profile conversion gives a four-ink black. A vendor that caps ink at 300% rejects the file, and the exporter has no option to keep black as pure black ink. Store text black as device-cmyk(0% 0% 0% 100%) instead. A color stored in CMYK is written with its exact values in both color modes, unless blur, an SVG filter or X-1a flattening draws it as an image. The color picker takes CMYK values once you enable CMYK input.
PDF/X-1a costs more than it seems. A page with any transparency, including an SVG clip path, is flattened into a CMYK image at 300 DPI by default. Its text stops being text, and the opaque elements on that page are rasterized with it. A page that mixes transparency with a spot color is refused, because flattening would delete a printing plate while the file still passed preflight.
To use a spot color, map a design color to a named ink and choose whether it overprints. The sticker cut-line demo exports its cut path as a CutContour separation. The PDF export docs cover the print options and their defaults.
How to check that a file is really PDF/X
No free tool validates PDF/X. veraPDF, the open-source validator most people reach for, covers PDF/A and PDF/UA. The engines that check PDF/X are commercial: callas pdfToolbox, whose engine also powers Preflight in Acrobat Pro, and Enfocus PitStop, which runs inside Acrobat and has a 30-day trial. Several online printers preflight a file on upload and show the report before you pay. Our free PDF preflight checker catches missing bleed, a missing trim box, RGB color and unembedded fonts in the browser, but it cannot certify PDF/X either. Before export, the print preflight demo runs fifteen pre-press checks beside the canvas while the customer edits, as example code you copy and change.
We test our exporter in layers, each one covering a hole in the one before:
- A guard in the product. Every PDF/X export re-reads the objects it just wrote and refuses to publish the file if anything forbidden survived, such as a page that still paints in plain RGB.
- A checker on a different parser. Tests open each file with pdf-lib, a third-party parser, and check each requirement we know of where it lives in the file: the output intent, a trim box on each page, embedded fonts, no encryption or JavaScript.
- Controls. A checker that reports no problems for every file looks exactly like a correct one. Most checks have a test that breaks one thing in a conforming file and expects that check to name it.
- A stricter second reader. Ghostscript parses representative files and stops on the first error, where a lenient parser would repair the file silently.
- External preflight. callas pdfToolbox reads every generated file: every test design, at both PDF/X levels, in Node and in the browser. It needs a commercial license, so it is not a release gate. It last ran in August 2026.
- Visual review, for the reason below.
A blank page passes every check
All five layers ask structural questions, and a blank page is structurally perfect. We found that out when Node's X-1a flattening handed pdf.js a canvas from a different library. Its fill calls drew nothing, and every flattened page came out empty. Those files passed the guard, pdf-lib, Ghostscript's parser and a callas pdfToolbox run with zero failures. What showed the bug was rendering the files and looking at them.
Two guards now cover it. A unit test checks that flattened pages carry ink. And every test design is rendered as an ordinary PDF, as PDF/X-4 and as PDF/X-1a from both Node and the browser, side by side with an ink-drift number for each pair, plus the editor canvas as an optional column. Flattened pages from Node and the browser differ by 0.18% on average. A person reads the review, and nothing fails a build on it, because some designs drift for reasons the number cannot tell from a bug: a text background below full opacity makes X-1a flatten the whole page, and about a fifth of that page switches between ink and paper.
If you write PDF/X yourself, render your output and look at it. A preflight report cannot tell you the page has content.
What preflight never judges
Preflight checks structure. It never asks whether a color is the right color. We test the conversion separately: the WebAssembly build of LittleCMS we use must reproduce LittleCMS's own reference tool exactly, all four channels on 24 probe colors. The test suite checks FOGRA39 on every run. GRACoL 2006, US Web Coated (SWOP), GRACoL 2013 and SWOP 2013 matched exactly at the last manual check, in August 2026.
What external preflight caught that our checker missed
Our exporter writes through PDFKit 0.20, with a patch. If you build PDF/X on PDFKit yourself, these are the problems our external preflight runs turned up:
- PDFKit writes no modification date, and PDF/X needs both the creation and the modification date.
- It writes
/UserUniton every page. That key arrived in PDF 1.6, and a PDF/X-1a:2001 file is PDF 1.3, so it may not carry it. - It writes the width of the
.notdefglyph unscaled. - PDF/X-1a identifies itself across two Info keys.
GTS_PDFXVersionsaysPDF/X-1:2001, without the "a", andGTS_PDFXConformancenames the level.
callas pdfToolbox also rejects any reference to .notdef, the empty box a font draws for a character it lacks. It found some in our own test fonts, so a PDF/X export now refuses a character no available font can draw, and names the font and the character.
What Polotno does not do
The vector PDF can differ slightly from the canvas in font shaping and effects. Filtered SVGs and blurred text are drawn as images, so they cannot carry a spot ink, and color emoji come out in black and white. There is no imposition: arranging finished pages on press sheets is the printer's job, or a production tool's.
FAQ
Can I create a print-ready PDF entirely in the browser?
Yes. The exporter runs client-side with the same print options as in Node, including PDF/X and spot colors. With a strict Content Security Policy, allow 'wasm-unsafe-eval' for PDF/X export.
Should I convert to CMYK myself or let the printer do it?
Convert yourself when the printer requires CMYK. Keep tagged RGB in PDF/X-4 when the printer accepts it, or before you know the printer: converting through a guessed profile bakes in the wrong numbers, while tagged RGB leaves the conversion to the printer. Black text needs pure black ink either way, and a color stored in CMYK keeps it in both modes.
Can I add bleed to a design that was made without it?
Yes, but bleed has to contain artwork, not an empty margin. Polotno extends page backgrounds into the bleed automatically. An image or shape that stops at the trim edge must still be enlarged past it. Set the page's bleed, turn on the bleed view, and extend edge-to-edge elements to the outer line.
Related reading
- PDF export docs – the print options and their defaults.
- Page bleed – bleed in the editor, including per-side values.
- Bleed calculator – trim, bleed and safe-zone sizes for common formats.
- JavaScript PDF libraries compared – pdf-lib, PDFKit, jsPDF, pdf.js, Puppeteer, and where each fits.
- How to build a JavaScript PDF editor – opening and editing existing PDFs in the browser.
- How to build a production VDP pipeline – templates, proofing and batch rendering for print.
