Chapter 3
Pages

3.1 Page Sizes

Any time when a page size is required, instead of writing, for instance "210mm 197mm" one can instead write a4portrait. Here is a list of supported page sizes:

a0portrait       a1portrait        a2portrait
a3portrait       a4portrait        a5portrait
a6portrait       a7portrait        a8portrait
a9portrait       a10portrait

aa03lalannddssccaappee      aa14llaannddssccaapepe        aa25llaanndsdsccaappee
a6landscape      a7landscape        a8landscape
a9landscape      a10landscape

usletterportrait  usletterlandscape
uslegalportrait   uslegallandscape

3.2 Scale Pages

The -scale-page operation scales each page in the range by the X and Y factors given. This scales both the page contents, and the page size itself. It also scales any Crop Box and other boxes (Art Box, Trim Box etc). As with several of these commands, remember to take into account any page rotation when considering what the X and Y axes relate to.

The -scale-to-fit operation scales each page in the range to fit a given page size, preserving aspect ratio and centering the result.

The scale can optionally be set to a percentage of the available area, instead of filling it.

The -scale-contents operation scales the contents about the center of the crop box (or, if absent, the media box), leaving the page dimensions (boxes) unchanged.

To scale about a point other than the center, one can use the positioning commands described in Section 8.2.4. For example:

3.3 Shift Page Contents

The -shift operation shifts the contents of each page in the range by X points horizontally and Y points vertically.

3.4 Rotating Pages

There are two ways of rotating pages: (1) setting a value in the PDF file which asks the viewer (e.g. Acrobat) to rotate the page on-the-fly when viewing it (use -rotate or -rotateby) and (2) actually rotating the page contents and/or the page dimensions (use -upright afterwards or -rotate-contents to just rotate the page contents).

The possible values for -rotate and -rotate-by are 0, 90, 180 and 270, all interpreted as being clockwise. Any value may be used for -rotate-contents.

The -rotate operation sets the viewing rotation of the selected pages to the absolute value given.

The -rotateby operation changes the viewing rotation of all the given pages by the relative value given.

The -rotate-contents operation rotates the contents and dimensions of the page by the given relative value.

The -upright operation does whatever combination of -rotate and -rotate-contents is required to change the rotation of the document to zero without altering its appearance. In addition, it makes sure the media box has its origin at (0,0), changing other boxes to compensate.

3.5 Flipping Pages

The -hflip and -vflip operations flip the contents of the chosen pages horizontally or vertically. No account is taken of the current page rotation when considering what ”horizontally” and ”vertically” mean, so you may like to use -upright first.

3.6 Boxes and Cropping

All PDF files contain a media box for each page, giving the dimensions of the paper. To change these dimensions (without altering the page contents in any way), use the -mediabox option.

The four numbers are minimum x, minimum y, width, height. x coordinates increase to the right, y coordinates increase upwards. PDF file can also optionally contain a crop box for each page, defining to what extent the page is cropped before being displayed or printed. A crop box can be set, changed and removed, without affecting the underlying media box. To set or change the crop box use -crop. To remove any existing crop box, use -remove-crop.

Note that the crop box is only obeyed in some viewers.

This operation copies the contents of one box (Media box, Crop box, Trim box etc.) to another. If -mediabox-if-missing is added, the media box will be substituted when the ’from’ box is not set for a given page. For example

copies the Trim Box of each page to the Crop Box of each page. The possible boxes are /MediaBox, /CropBox, /BleedBox, /TrimBox, /ArtBox.