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.
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 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.
14 thoughts on “[Short Tip] Splitting and merging PDF files”
PDF-Shuffler. Try that.
PDF-Shuffler is GUI pyPdf frontend, stapler is a command-line pyPdf frontend.
Also a nice program – however, I was aiming for command line =)
why it isn’t possible to integrate such usefull things like split, import, export, … into okular? I like command line tools, but it would also be nice to have such things in the gui.
File a wishlist bug report.
Okular is not meant to be an editor – but of course it’s possible to write an editing application which uses Okular (through the KPart technology).
(The comment from April 6, 2015 at 18:55 is mine)
Just to add some details: similar wishlists item have been filed in the past, but, given the scope of Okular, the answer was in line with my previous comment.
Good question – especially since Okular already depends on the Poppler libraries.
Maybe its out of the scope of the reader?
Have you written a bug report?
Also interesting, but Poppler utils are quicker – also, pdftk seems to be a dead project by these days.
+1 for pdftk, really powerful command-line tool