0

I have a large set of PDF files, each of which contains three unnecessary pages at the end. I was originally trying to create a solution based on an answer I found on askUbuntu and another StackOverflow question, but pdf-stapler apparently doesn't support the "r" notation that pdftk did, e.g. if I try pdf-stapler del myFile.pdf r4-r1 outputFiles/myFile.pdf or pdf-stapler cat myFile.pdf 1-r4 outputFiles/myFile.pdf, I get an error saying "Invalid range: r4-r1" for the first option and an output file with only page 1 for the second option.

Is there a way to do this with pdf-stapler?

zaen
  • 326
  • 3
  • 14
  • Are you limited to pdf-stapler? Or can a solution use another command line tool? – gettalong Jul 06 '20 at 10:44
  • @gettalong I'd prefer to stick to tools available through the Fedora repository, which eliminates pdftk, unfortunately. Aside from that, I could use another tool. – zaen Jul 06 '20 at 16:50

1 Answers1

2

The qpdf CLI command should be available in the Fedora repositories. It supports the "r" notation, so removing the last three pages from a file should work like this:

qpdf --pages myFile.pdf 1-r4 -- myFile.pdf outputFiles/myFile.pdf
gettalong
  • 735
  • 3
  • 10