Difference between revisions of "PDF Boxes"

From Wiki
Jump to navigation Jump to search
(new)
 
(corrected and reworked)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
< [[PDFX|PDF/X]] | [[PDF/A]] >
+
=Basics=
  
==Basics==
+
[[File:page-boxes.png|350px|thumb|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.
+
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":
Therefore the PDF standard defines a set of "boxes":
 
  
 
{| class=wikitable
 
{| class=wikitable
Line 10: Line 9:
 
! Meaning
 
! Meaning
 
|-
 
|-
|ArtBox ||Size of the page content (artwork); might be used for imposition purposes
+
|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.
 
|-
 
|-
|CropBox ||Page size that is visible in a viewer (fallback for the other boxes)
+
|BleedBox ||Page size plus bleed (cut space); defines the trimmed page plus the bleed.
 
|-
 
|-
|TrimBox ||Size of trimmed (cut) page, "final" page size
+
|TrimBox ||Size of trimmed (cut) page, “final” page size; the net result document format.
 
|-
 
|-
|MediaBox ||Size of the physical medium (print sheet)
+
|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 [[PDFX|PDF/X]], if ArtBox is defined at all, it must not differ from TrimBox.
 
In [[PDFX|PDF/X]], if ArtBox is defined at all, it must not differ from TrimBox.
  
==In ConTeXt==
+
=In ConTeXt=
 
 
End of August 2015 ConTeXt got the necessary setup keys to define these boxes (minimal example by Hans):
 
  
 
<texcode>
 
<texcode>
\showframe
+
\setuppapersize[A5][A5,oversized]
  
 
\setuplayout
 
\setuplayout
 
  [location=middle,
 
  [location=middle,
  width=middle,
+
   cropoffset=0mm,% default
  height=middle,
+
   trimoffset=-7.5mm,% negative offset from MediaBox to TrimBox
   cropoffset=auto,
+
   bleedoffset=3mm,% bleed size
   trimoffset=1bp,
 
   bleedoffset=2bp,
 
  artoffset=2bp % makes no sense
 
 
]
 
]
 +
\setupinteractionscreen[width=max,height=max]
  
 
\starttext
 
\starttext
 +
\showlayout
 +
\stoptext
 +
</texcode>
  
\definepapersize[TestA][width=100bp,height=200bp]
+
* Unfortunately, the offsets are not independent: If you define a {{code|1=cropoffset}}, you must add its value to the negative {{code|1=trimoffset}}.
\definepapersize[TestB][width=150bp,height=250bp]
+
* It doesn’t work without {{cmd|setupinteractionscreen}}.
 +
* {{code|1=cropoffset=auto}} only works with {{code|1=location=middle}} (message otherwise).
 +
* You can’t set ArtBox, since nobody seems to need it. ({{cmd|externalfigure}} understands <code>size=art</code> if you need to place a PDF image by its ArtBox.)
 +
* {{cmd|setupbackend}} is ''not'' significant for the box calculations.
 +
* {{cmd|setupbleeding}} affects only image placement, but not the BleedBox, see the {{manual|details}} manual.
 +
* MediaBox (i.e. the size of the sheet) is taken from the second parameter of {{cmd|setuppapersize}}.
 +
* {{code|1=trimoffset}} specifies the difference between the CropBox and the TrimBox. This parameter seems to be completely ignored, if it is positive.
 +
* {{code|1=bleedoffset}} defines the difference between the TrimBox and the BleedBox. Negative values yield a BleedBox that’s smaller than the TrimBox, which is against the specs. Values bigger than the (positive) {{code|1=trimoffset}} also make no sense.
  
\setuppapersize[TestA][TestB]
+
==Complete Example==
  
test
+
This uses a {{code|1=print}} mode:
 +
 
 +
<texcode>
 +
\setuppapersize[A5][A5,oversized] % oversized adds 15mm, enough for the crop marks
 +
 
 +
\setuplayout[
 +
  location=middle,
 +
  marking=on,
 +
]
  
\stoptext
+
\startmode[print]
</texcode>
+
\setuplayout[
 +
  cropoffset=0mm,% default
 +
  bleedoffset=3mm,% bleed
 +
  trimoffset=-7.5mm,% half of negative size difference of sheet and paper
 +
]
 +
\stopmode
  
The <code>auto</code> option only works with <code>layout=middle</code> (message otherwise).
+
\startnotmode[print]
The offset are accumulative (so crop &lt; trim &lt; bleed &lt; art).
+
\setuplayout[
 +
  cropoffset=7.5mm,% shrink the visible page to the final paper size
 +
  bleedoffset=3mm,
 +
  trimoffset=0mm,% the TrimBox is influenced by the CropBox
 +
]
 +
\stopnotmode
  
The default CropBox and TrimBox handling is unchanged, so one really needs to set this when it's needed.
+
\setupinteractionscreen[width=max,height=max]% activate!
The already present interactionscreen cropping is unchanged.
 
  
 +
\starttext
 +
\showlayout
 +
\stoptext
 +
</texcode>
  
 
[[category:PDF]]
 
[[category:PDF]]

Latest revision as of 19:21, 30 October 2021

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.
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

\setuppapersize[A5][A5,oversized]

\setuplayout
 [location=middle,
  cropoffset=0mm,% default
  trimoffset=-7.5mm,% negative offset from MediaBox to TrimBox
  bleedoffset=3mm,% bleed size
]
\setupinteractionscreen[width=max,height=max]

\starttext
\showlayout
\stoptext
  • Unfortunately, the offsets are not independent: If you define a cropoffset, you must add its value to the negative trimoffset.
  • It doesn’t work without \setupinteractionscreen.
  • cropoffset=auto only works with location=middle (message otherwise).
  • You can’t set ArtBox, since nobody seems to need it. (\externalfigure understands size=art if you need to place a PDF image by its ArtBox.)
  • \setupbackend is not significant for the box calculations.
  • \setupbleeding affects only image placement, but not the BleedBox, see the Template:manual manual.
  • MediaBox (i.e. the size of the sheet) is taken from the second parameter of \setuppapersize.
  • trimoffset specifies the difference between the CropBox and the TrimBox. This parameter seems to be completely ignored, if it is positive.
  • bleedoffset defines the difference between the TrimBox and the BleedBox. Negative values yield a BleedBox that’s smaller than the TrimBox, which is against the specs. Values bigger than the (positive) trimoffset also make no sense.

Complete Example

This uses a print mode:

\setuppapersize[A5][A5,oversized] % oversized adds 15mm, enough for the crop marks

\setuplayout[
  location=middle,
  marking=on,
]

\startmode[print]
\setuplayout[
  cropoffset=0mm,% default
  bleedoffset=3mm,% bleed
  trimoffset=-7.5mm,% half of negative size difference of sheet and paper
]
\stopmode

\startnotmode[print]
\setuplayout[
  cropoffset=7.5mm,% shrink the visible page to the final paper size
  bleedoffset=3mm,
  trimoffset=0mm,% the TrimBox is influenced by the CropBox
]
\stopnotmode

\setupinteractionscreen[width=max,height=max]% activate!

\starttext
\showlayout
\stoptext