Notes on working with PDFs on Linux
This is a collection of tips & tricks for working with PDF files in the Linux command line.
Compress images (lossy)
Requires the ghostscript package.
-dPDFSETTINGS collectively sets the output parameters, where:
/screen– 72 DPI/ebook– 150 DPI/prepress– 300 DPI, use this if unsure and then fine-tune.
Specific paremeters can be controlled individually if needed. See Ghostscript docs – Distiller Parameters for more details.
Reverse page order
Requires the pdftk package.
Page numbers 1,2,3 become 3,2,1 (and vice versa).
Page rotation
All pages
Rotate all pages 90° counter-clockwise. Note that end and west are semantically two separate instructions. end finishes the previous cat instruction, whereas west instructs the document processor to rotate the pages.
Specific pages
Keep 1,2,4 as-is, rotate 3 90° clockwise.