pdf editing on the commandline

Posted on May 26, 2020

Occasionally one needs to edit .pdf files. Inserting, removing, combining pages and finally reducing the file size, so that one can send it via mail or something. Masterpdf can do all that. On Arch Linux, there currently seems to be an issue with the QT Version used by masterpdf.

Fortunately one does not need a graphical front-end to do these kind of tasks.

  • pdftk - Inserting, removing, combining, you name it
  • ps2pdf - Reducing file size

Example Usage

  • pdftk IN.pdf cat 1-14 16-end output OUT.pdf
  • ps2pdf -dPDFSETTINGS=/ebook IN.pdf OUT.pdf

These tools can do much more. man is your friend.