6

Is there an easy (preferably command line) way to reverse the pages in a PDF file?

9

PDFtk can also do this (it’s available in most distributions as pdftk):

pdftk myfile.pdf cat end-1 output myfilereversed.pdf
  • It's not available on Arch Linux (only via AUR) and there might be a good reason for that. Anyway, in that case, pdfjam is a good alternative. – user905686 Apr 25 '18 at 14:03
  • @user905686 agreed, I’m presenting this as an alternative, not saying using pdfjam is wrong ;-). – Stephen Kitt Apr 25 '18 at 14:04
3

One can make use of pdfjam which provides a front end to the "pdfpages" LaTeX package (and thus comes for example with texlive).

It generally allows to create a new PDF file by selecting pages from multiple PDF files. Particularly it allows to specify decending ranges, using "last" to refer to the last page:

pdfjam myfile.pdf 'last-1' --outfile myfilereversed.pdf

reverses myfile.pdf.

For further possibilities see pdfjam --help and the documentation of pdfpages.

2

You can use qpdf:

qpdf --empty --pages infile.pdf z-1 -- outfile.pdf

You can find more information here on page 11.

  • 1
    Of all the answers so far, this was the lightest, easiest install (brew install qpdf) on macOS 10.13.6. Also it's very fast. – William Turrell Dec 10 '19 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.