Prepress and commercial print / Bleed, trim and media boxes
Bleed, trim and media boxes in a PDF built for printing
A printed page has at least three rectangles: the sheet, the finished size after cutting, and the slightly larger area artwork must fill so that a cut a millimetre off does not leave a white sliver.
Where this API stands
This API does not produce this standard, and there is no option that would. What follows is what the requirement actually is and where a rendered document stands against it. The API sets the page geometry from the format you choose or from the document's own @page rule when `prefer_css_page_size` is on, and that geometry becomes the MediaBox. There is no TrimBox, no BleedBox and no crop mark generation, and no option adds them. The part you can control matters more than it sounds: because @page accepts an explicit size, you can render at trim plus bleed rather than at trim, so the artwork that has to survive the cut is genuinely on the page and a later step only has to declare the boxes rather than invent the pixels. Rendering at exact trim size makes the bleed unrecoverable.
What the standard requires
The requirements as a checker enforces them, rather than as a procurement document paraphrases them. A file satisfies all of these or it satisfies none of them.
- A MediaBox, which every page has, describing the sheet the content is imposed on.
- A TrimBox describing the finished page after cutting, which is what PDF/X requires and what the printer imposes against.
- A BleedBox describing how far artwork extends beyond the trim, conventionally 3mm on each side in metric workflows.
- Artwork that actually reaches the bleed edge. A box declared and not filled is worse than no box, because it says the bleed is handled.
- A safety margin inside the trim, commonly 3 to 5mm, where nothing important is placed, since the cut moves in both directions.
- Consistency between the boxes: trim inside bleed, bleed inside media, and the same geometry on every page unless the job genuinely varies.
Who asks for this
Every commercial printer, for anything where ink reaches the edge of the page. It is the most common reason artwork is sent back, and the request is usually phrased as supply with 3mm bleed and crop marks, which is two requirements rather than one.
What it looks like in a file
The concrete form of the thing being described, so you can recognise it in a document you have been handed rather than only in a specification.
<style>
/* A4 is 210 by 297mm. With 3mm bleed on every side the sheet is 216 by 303mm.
Render at the sheet size and let a later step declare the trim box. */
@page {
size: 216mm 303mm;
margin: 0;
}
.page {
/* Full sheet, so background colour genuinely reaches the bleed edge. */
width: 216mm;
height: 303mm;
background: #0f2f4a;
box-sizing: border-box;
/* 3mm of bleed plus a 12mm safety margin inside the trim. Nothing that
must survive the cut goes closer to the edge than this. */
padding: 15mm;
}
</style>
<!-- Send this with options.prefer_css_page_size set to true, otherwise the
named format wins and the three millimetres of bleed are cropped away. -->
<div class="page">...</div>What to do about it
Render oversize, then set the boxes. Declare @page with the trim size plus twice the bleed, keep the design's own margins measured from the trim edge rather than from the page edge, and hand the result to a preflight tool or to the printer with the trim size stated. Setting the boxes on an existing file is a metadata operation that costs nothing; adding 3mm of artwork that was never rendered is not.
How to check a file rather than assume
Acrobat shows all the page boxes under document properties and can display them as coloured outlines, which is the fastest way to see that a trim box exists and is where you think it is. Without Acrobat, qpdf will dump the page dictionary and the boxes are readable directly in the output.
The mistake people make here
Declaring bleed and centring the artwork inside the trim anyway. The page is then the right size, the boxes are correct, and the background still stops exactly at the cut line, so every unit shows a white edge on one side. Bleed is a property of the artwork reaching past the trim, and the boxes only describe it.
Frequently asked
Does this API produce Bleed, trim and media boxes?
Not produced by this API. The API sets the page geometry from the format you choose or from the document's own @page rule when `prefer_css_page_size` is on, and that geometry becomes the MediaBox. There is no TrimBox, no BleedBox and no crop mark generation, and no option adds them. The part you can control matters more than it sounds: because @page accepts an explicit size, you can render at trim plus bleed rather than at trim, so the artwork that has to survive the cut is genuinely on the page and a later step only has to declare the boxes rather than invent the pixels. Rendering at exact trim size makes the bleed unrecoverable.
Can I turn on the pdf_a option and be done?
No. The option writes an XMP packet declaring PDF/A-1b into the document catalogue, and the render response comes back carrying a warning that says in as many words that this is best-effort and that full conformance requires tagged structure and an embedded ICC profile. It is a claim written into the file, not a certificate earned by it, and a validator checks the claim against the bytes. Read the warning array in the response rather than taking the absence of an error as a pass.
Should I convert before rendering or after?
After, always. A conformance converter rewrites colour, embeds profiles, sets boxes and stamps metadata on a finished PDF. Trying to satisfy a conformance target from the source side means guessing at what the converter would have done, and the guesses that go wrong are expensive: flattening transparency you did not need to flatten changes what the page looks like.
Standards this one is confused with
The neighbours that matter are the ones people mistake for this, not the ones that sort next to it.
PDF/X-4: live transparency in a print handover file
The current print exchange standard, based on PDF 1.6, which keeps transparency and layers live in the file and lets the printer's own engine flatten them at the last possible moment.
PDF/X-1a: the CMYK-only handover format for commercial print
The blind exchange standard for offset printing: everything is CMYK or a named spot colour, nothing is transparent, and the file carries enough information that the printer never has to ask you a question.
CMYK and spot colour in a PDF, and why CSS cannot reach them
Print uses inks, the web uses light, and there is no CSS syntax that expresses either a CMYK ink mixture or a named separation, so the gap has to be closed somewhere other than the stylesheet.
PDF/X-3: managed colour instead of CMYK only
The same handover discipline as X-1a with one rule relaxed: device independent colour is allowed, so ICC tagged RGB and Lab content can stay in the file and be converted by the printer's own colour management.
Overprint and transparency, and the white text that vanishes
Two different ways of putting one thing on top of another: overprint is an ink instruction that a screen mostly ignores, transparency is a rendering model that older print standards ban outright, and confusing them produces the classic disappearing white text.
Every standard, with what this API does about it
The full list, grouped by what the requirement is for, each marked with how far this API gets.
What this API actually does
One page per option and endpoint that exists, with nothing that does not.
Conformance is decided after a file exists. Render the document, then check it, then convert only what the checker actually flags.