I recently had to modify quite a stack of PDF files. Many of them where scanned documents, and sometimes I only needed certain pages, or had to re-arrange parts of some files in new documents. A set of handy tools to perform such low level tasks quick and easy comes along in the package poppler-utils
. The package is available via the default package managers on Fedora, RHEL/CentOS, Ubuntu, Debian and others.
The command pdfseparate
can be used to extract certain pages of large PDFs – in this example all pages from the third up to the fifth are separated into single page PDFs:
$ pdfseparate -f 3 -l 5 Scanned-Document.pdf Separated%d.pdf $ ls Scanned-Document.pdf Separated3.pdf Separated4.pdf Separated5.pdf
If you want to combine for example the fifth and the third page in that order in one single, new PDF you can use pdfunite
:
$ pdfunite Separated5.pdf Separated3.pdf NewDocument.pdf
Note that there is usually no output on the shell as long as everything works out fine. You can check the results with the PDF viewer of your choice, like Okular on KDE or Evince on Gnome.