[Short Tip] Splitting and merging PDF files

PDF Logo

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.


14 thoughts on “[Short Tip] Splitting and merging PDF files”

    1. PDF-Shuffler is GUI pyPdf frontend, stapler is a command-line pyPdf frontend.

  1. hi,

    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.

    1. 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).

    2. (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.

    3. 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?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: