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.

cpdf -rotate 90 in.pdf -o out.pdf

Set the rotation of all the pages in the input file to ninety degrees clockwise.

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

cpdf -rotateby 90 in.pdf -o out.pdf

Rotate all the pages in the input file by ninety degrees clockwise.

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

cpdf -rotate-contents 90 in.pdf -o out.pdf

Rotate all the page contents in the input file by ninety degrees clockwise. Doesn’t change the page dimensions.

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.