Skip to main content

Pdfcpu Commands For Manipulating Pdf Files

utilities pdf

Install
#

Download and extract pdfcpu.

Copy the pdfcpu binary somewhere in your PATH.

Commands
#

Extract a range into separate PDFs per page
#

pdfcpu extract -mode page -pages 3-4 my-file.pdf" .

Extract a range into a single PDF
#

pdfcpu collect -pages 3,4 "my-file.pdf" pages3-4.pdf

Create a “2-up” PDF (two pages side by side) in landscape orientation
#

pdfcpu nup 'formsize:LetterL' 2up.pdf 2 'my-file.pdf"

Rotate all pages 90 degrees clockwise
#

pdfcpu rotate 'my-file.pdf' 90 'my-file-rotated.pdf'

Rotate counter-clockwise
#

pdfcpu rotate 'my-file.pdf' -90 'my-file-rotated.pdf'

Rotate a single page within all pages
#

pdfcpu rotate -pages 1 'my-file.pdf' 90 'my-file-rotated.pdf'

Resources
#

PdfCpu documentation

Alternatives
#

Qpdf also has options for rotation.

Related

Print CSV Files To PDF With Weasyprint
utilities development pdf python css
CSV file converted to PDF, with variable column widths and footers Printing a CSV file as a nicely formatted table is easy if you import it first into a spreadsheet like Microsoft Excel or LibreOffice Calc.
Printing Text Files To PDF With Enscript
utilities pdf
Sometimes you want to print a text file and apply some fancy formatting – say, a header with page numbering, or printing two-pages per sheet to conserve paper.
Shrink Image Files With GraphicsMagick
utilities graphics
GraphicsMagick is a fork of the ImageMagick project that describes itself as “the swiss army knife of image processing”.