bookmark_borderHow to easily merge PDF documents under Linux

It’s a well known problem. You have two PDF documents and you want to merge both into one. For e.g. you want to bring your application and your personal data sheet together. This short an easy tutorial shows you how to merge PDF documents under Linux on a graphical way or with the help of the command line.

First option: commando line

Of course there is a way to use the console to do this. The command line tool pdfunite is an easy way to do this. You can use APT on Ubuntu or Debian to easily install pdfunite:

user@client:~$ sudo apt-get update
user@client:~$ sudo apt-get install poppler-utils

pdfunite is part of the poppler-utils package, which basically means that when you install poppler-utils you will also get the desired pdfunite. After the installation is finished, you can just go ahead and merge some PDF files!
To merge start merging, you have to enter the command pdfunite followed by the PDFs you want to merge. The last PDF file in the command line represents the output PDF:

user@client:~$ pdfunite source1.pdf source2.pdf merged_output.pdf

The number of PDF documents you can merge is infinite so this line can be extended like this to merge 4 documents, for e.g.:

user@client:~$ pdfunite source1.pdf source2.pdf source3.pdf source4.pdf merged_output.pdf

Keep in mind that the source files have to be in the same directory where the command pdfunite is executed. If your PDF files are stored in different places, you have to enter the relative or absolute path, for e.g.:

user@client:~$ $HOME/pdfs/source1.pdf $HOME/pdfs/source2.pdf $HOME/Downloads/source3.pdf /mnt/externalhdd/source4.pdf merged_output.pdf

And that’s it. All the magic is done 🙂

Second option: Using a GUI

There are several GUIs which are doing all the work for you but one of those GUIs is (for me) the real shining star: PDFsam. The main reason for this is that PDFsam is capable of doing a lot of more things than just merging: Split, Rotate, Extract, Split bookmarks and many more. PDFsam is written in Java and (of course) available in most Linux distributions. For Ubuntu / Debian you can easily install PDFsam like this:

user@client:~$ sudo apt-get update
user@client:~$ sudo apt-get install pdfsam

After PDFsam is successfully installed, you can start PDFsam through your start menu or by entering the command pdfsam in a terminal window.

PDFsam start window

With an click on the button Merge the merge window is going to pop up. The rest is almost self-explaining. Click on the button Add to choose the source PDF documents from your drive you want to merge, go down to the Destination file, click on Browse and select a place + filename for the merged destination PDF. Click on Run and that’s it.
PDFsam merge dialog

Final words

As you can see, merging PDF documents under Linux is super easy. If you want a graphical toolset which offers more possibilities than just merging, go with PDFsam. If you just want to merge PDF documents on a simple and easy way or if you are just a fan of the command line, go with pdfunite. However, it doesn’t matter which program you use. There are both fast, reliable and easy 🙂