Trim and bleed boxes for Xelatex PDF files

Printers need trim and bleed boxes to position and cut the printed pages correctly. Xelatex has no provision to transfer information about such boxes to the PDF file. Therefore the boxes must manually be added later, I use the podofo toolset. This procedure is only for when the file is ready for the print shop.

The PDF trimbox specifies the position and size of the final cut page. The bleedbox is a slightly larger box which marks the printed area. This is useful when elements, e. g. images run to the paper edge; during document preparation such elements are extended to the outside of the final page to allow for tolerances of the trim tool.

Another box, the mediabox, specifies the outline of the paper, Xelatex adds the media box automatically.

The class file can specify the page size (e. g. A4) and the layout size (e. g. A5) and some margins. The mediabox will be the size of the A4 page, the trimbox the A5 size. And we may add the bleedbox, which typically extends 3 mm outside all trimbox edges.

PDF dimensions are Postscript point (1/72″, also called big point) while TeX uses traditional point (1/72.27″). PDF origo is at the lower left corner of the page. To scale from mm to Postscript point, multiply by 2.834645669, or use a calculator.

I will later show how to add the trim and bleed boxes to the generated PDF file, but for this method to work, the position of the lower left corner of all pages must be the same and all page sizes must also be equal. For Memoir this is achieved by adjusting the \settrims parameters. Also include a class to output crop marks or page frames, to allow for easier positioning of the layout page on the media page.

A fine PDF viewer that displays cursor coordinates is gv. I use gv to measure coordinates of page elements. When set to Fixed size the coordinates are in Postscript points.

For the Memoir class output, I get the page corners at the same position for both odd and even pages when I specify trimedge = (stock width - trimmed width)/2 and trimtop = (stock height - trimmed height)/2 - 2.54 mm.

Use gv to check correct positioning and measure the lower left and upper right coordinates given by crop marks or frame. You can also use the dimensions specified in the class file, do some calculations and scale to Postscript point. However, measuring the coordinates directly by the gv reader is easier and eliminates some uncertainties.

For my example, I measured the lower left corner (99,181) and upper right corner (495, 775), giving left margin 99 pt, bottom margin 181 pt, height 775-181 = 594 pt and width 495-99 = 396 pt.

The printer specifies the bleed, e. g. 3-5 mm. In this case 10 pt will be fine. The bleedbox is then given by adding 10 pt to the trimbox edges: left margin 89, bottom margin 171, height 614 and width 416 pt.

To insert the trim and bleed box into the PDF file I use

podofobox input-file output-file trim|bleed left bottom width height

where the parameters are given as 100 times the pt value, without decimal dot. This operation inserts the same boxes for all pages of the document, hence the importance of setting the class file layout parameters correctly.


podofobox input.pdf /tmp/1.pdf trim 9900 18100 39600 59400

and bleedbox:

podofobox /tmp/1.pdf output.pdf bleed 8900 17100 41600 61400

To check the PDF file, first decompress using pdftk:

pdftk output.pdf output x.pdf uncompress

Use less x.pdf to find the trim and bleed boxes.

I don’t know of any Linux program that displays the boxes, but acroread does. Maybe some old Linux version, but also the present free Windows version will display the boxes if enabled in the setup.

0 Responses to “Trim and bleed boxes for Xelatex PDF files”

  • No Comments

Leave a Reply