Difference between revisions of "PDF Boxes"

From Wiki
Jump to navigation Jump to search
(Add hints from texexchange thread (bugs to be fixed))
(Add illustration to show the various areas of a page. Own work. Rocketship was found in public domain.)
Line 3: Line 3:
 
==Basics==
 
==Basics==
  
While PostScript (and EPS, that is) knows only one kind of page size, defined by the BoundingBox (or HiResBoundingBox), the size of PDF pages can have different meanings – e.g. the visible page, the printed page, the cropped printed page.
+
[[File:page-boxes.png|400px|thumb|PDF Boxes]]
Therefore the PDF standard defines a set of "boxes":
+
 
 +
While PostScript (and EPS, that is) knows only one kind of page size, defined by the BoundingBox (or HiResBoundingBox), the size of PDF pages can have different meanings – e.g. the visible page, the printed page, the cropped printed page. Therefore the PDF standard defines a set of "boxes":
  
 
{| class=wikitable
 
{| class=wikitable
Line 10: Line 11:
 
! Meaning
 
! Meaning
 
|-
 
|-
|CropBox ||Page size that is visible in a viewer (fallback for the other boxes, minimally required)
+
|MediaBox ||Size of the physical medium (print sheet); this is the page format.
 
|-
 
|-
|BleedBox ||Page size plus bleed (cut space)
+
|CropBox ||Page size that is visible in a viewer (fallback for the other boxes, minimally required); this includes the bleed box and all marks for the printshop.
 
|-
 
|-
|TrimBox ||Size of trimmed (cut) page, "final" page size
+
|BleedBox ||Page size plus bleed (cut space); defines the trimmed page plus the bleed.
 
|-
 
|-
|MediaBox ||Size of the physical medium (print sheet)
+
|TrimBox ||Size of trimmed (cut) page, "final" page size; the net result document format.
 
|-
 
|-
|ArtBox ||Size of the page content (artwork); might be used for imposition purposes
+
|ArtBox ||Size of the page content (artwork); might be used for imposition purposes; typically, it can be used to specify any section of the page.
 
|}
 
|}
  

Revision as of 07:15, 8 January 2020

< PDF/X | PDF/A >

Basics

PDF Boxes

While PostScript (and EPS, that is) knows only one kind of page size, defined by the BoundingBox (or HiResBoundingBox), the size of PDF pages can have different meanings – e.g. the visible page, the printed page, the cropped printed page. Therefore the PDF standard defines a set of "boxes":

Name Meaning
MediaBox Size of the physical medium (print sheet); this is the page format.
CropBox Page size that is visible in a viewer (fallback for the other boxes, minimally required); this includes the bleed box and all marks for the printshop.
BleedBox Page size plus bleed (cut space); defines the trimmed page plus the bleed.
TrimBox Size of trimmed (cut) page, "final" page size; the net result document format.
ArtBox Size of the page content (artwork); might be used for imposition purposes; typically, it can be used to specify any section of the page.

In PDF/X, if ArtBox is defined at all, it must not differ from TrimBox.

In ConTeXt

End of August 2015 ConTeXt got the necessary setup keys to define these boxes (minimal example by Hans):

\showframe

\setuplayout
 [location=middle,
  width=middle,
  height=middle,
  cropoffset=auto,
  trimoffset=1bp,
  bleedoffset=2bp
]

\starttext

\definepapersize[TestA][width=100bp,height=200bp]
\definepapersize[TestB][width=150bp,height=250bp]

\setuppapersize[TestA][TestB]

test

\stoptext

The auto option only works with layout=middle (message otherwise). The offset are accumulative (so crop < trim < bleed).

The default CropBox and TrimBox handling is unchanged, so one really needs to set this when it's needed. The already present interactionscreen cropping is unchanged.

ConTeXt doesn’t set ArtBox at the moment, since nobody seems to need it.

Bugs and Pitfalls

In a thread on tex.stackexchange.com from 2017-05, there are few clarifications by user Marcus C., to be integrated here:

  • The parameter \setupinteractionscreen[width=max,height=max] is necessary for the calculations to be enabled.
  • \setupbackend[format=PDF/X-1a:2001], on the other hand, doesn't seem to have any effect. Nice to have, when exporting a PDF file for printing, of course, but not sigificant for the box calculations.
  • The media size (i.e. the size of the MediaBox) is taken from the second parameter in the command \setuppapersize. I'm not sure, if that's been a good choice, but anyway: It's the way it's currently done.
  • The first parameter cropoffset specifies the difference in size between the MediaBox and the CropBox. As it is usually suggested that the CropBox should be equal to the TrimBox, this might as well be set to something other than 0, so that MediaBox becomes the biggest "box". However, looking at how the Adobe software handles this, I guess it is expected that the MediaBox and the CropBox are identical. So, I'll set this parameter to 0 mm.
  • Next, the parameter trimoffset specifies the difference between the CropBox and the TrimBox. For achieving correct bleed, this is essential. However, in contrast to the example given (above), this parameter seems to be completely ignored, if it is positive. So, to get any bleed at all, I'll set this to -3 mm (the value most often used here in Europe).
  • The parameter bleedoffset, then, gives the difference between the TrimBox and the BleedBox. And here's a weirdness: Setting this to -3mm yields a BleedBox that's smaller than the TrimBox, which is obviously not correct. The value 0mm yields the same size as the TrimBox, which is unusable, as well. Choosing 6mm for bleedoffset yields a BleedBox that's bigger than the MediaBox, which doesn't make any sense at all (and should probably be corrected by the compiler, but that's another story).
  • So, taking all this into account: The correct value should be 3mm. However, trying this exact value yields a PDF file that doesn't have a BleedBox at all. This got me stumped for a while and I suspect it is a bug in the current version. But it is, after all, the only way for achieving something closely resembling the output by Adobe InDesign. And, while this might not be standards-compliant, it should work well in practice.

So, here's the complete MWE, just in case anybody else needs it:

\setuplayout
 [location=middle,
  width=middle,
  height=middle,
  cropoffset=0mm,
  trimoffset=-3mm,
  bleedoffset=3mm,
  artoffset=0mm
]

\setupinteractionscreen[width=max,height=max]

\definepapersize[A4plusbleed][width=216mm,height=303mm]

\setuppapersize[A4][A4plusbleed]

\starttext

\input tufte

\stoptext

Except for the missing BleedBox, the resulting PDF file is now equivalent to the one created by InDesign.