Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are a lot of software in Windows to merge PDF files but how can we do the same in Ubuntu?

share|improve this question
I found this link – Grijesh Chauhan Jun 5 '14 at 9:18

10 Answers 10

up vote 99 down vote accepted

PDF-Shuffler Install PDF-Shuffler

If you want a tool with a simple GUI, try pdfshuffler. It allows for merging of PDFs as well as rearranging and deleting pages. For batch processing and/or more complicated tasks, pdftk is of course more powerful.

Screenshot of PDF-Shuffler

share|improve this answer
I tried this - it didn't work on 10.04 – David Oneill Mar 13 '12 at 2:06
On 12.04, pdfshuffler always complains that there are "too many values to unpack", making it unusable. – despens Apr 12 '13 at 12:15
For me it works under 12.04 64-bit, pdfshuffler version 0.6.0 – user1251007 Jan 8 '14 at 9:35
Installs and works like a charm on 14.04. Thanks a bunch!! – Zlatty Feb 12 '14 at 20:26
I used to use pdftk for this behavior. Thanks for the PDF Shuffle reference. It looks really slick. – csgeek Dec 11 '14 at 15:51

pdftkInstall pdftk

To merge two pdf files, file1.pdf and file2.pdf:

pdftk file1.pdf file2.pdf cat output mergedfile.pdf

More info available hereWay Back Machine.

share|improve this answer
pdftk is buggy - gs might be slow, but does the work perfectly [IgnitE's answer] – Guanidene Apr 3 '13 at 11:05
Thanks! Pdftk does the simple, basic merging quite well. More than enough for my needs. YMMV. – Marky Jun 27 '14 at 9:57

Ghostscript is a package (available by default in Ubuntu) that enables you to view or print PostScript and PDF files to other formats, or to convert those files to other formats.
To use Ghostscript to combine PDF files, type something like the following:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf

Here is a brief explanation of the command:

gs         starts the Ghostscript program.
-dBATCH    once Ghostscript processes the PDF files, it should exit.
           If you don't include this option, Ghostscript will just keep running.
-dNOPAUSE  forces Ghostscript to process each page without pausing for user interaction.
-q         stops Ghostscript from displaying messages while it works
           tells Ghostscript to use its built-in PDF writer to process the files.
           tells Ghostscript to save the combined PDF file with the specified name.

Your input files don't even need to be PDF files. You can also use PostScript or EPS files, or any mixture of the three.

There is a lot you can do with Ghostscript. You can read it's documentation for more details.


share|improve this answer
True, but it's incredibly slow. I just tried concatenating 45 x 400K, single-page PDFs. pdftk took 0m0.484s, gs took 1m32.898s (that's almost 200x slower) The file from gs was about 21% smaller though. – aidan Mar 22 '13 at 6:47
this command also works if you use a wildcard for the list of files to be combined. for example, replace file1.pdf file2.pdf with file*.pdf – Antonios May 29 '14 at 13:58
For me gs worked with some "non conformant" PDFs where pdftk would just run forever. – ntc2 Dec 9 '14 at 4:37
This worked perfectly for my need! – dsh Jan 23 '15 at 2:23

PDF Chain Install PDF Chain

A very nice solution is PDFChain. It's GUI is a frontend of PDFTK where you can merge, split or even add some background to your PDF files.

share|improve this answer

Give PDFMod a try, it’s from the GNOME project:

share|improve this answer

You also also use pdfunite to merge pdf documents :

pdfunite in-1.pdf in-2.pdf in-n.pdf out.pdf
share|improve this answer
WARNING: An existing file out.pdf will be overwritten without warning, so pdfunite *.pdf won't work as expected. – krlmlr Dec 4 '14 at 15:02
@krlmlr You can always put the output into another directory. – BЈовић Dec 4 '14 at 15:05
Fair enough, cp also overwrites last argument without warning. This is just for rushing users (like myself) -- I was lucky I had a backup of the file in question... – krlmlr Dec 4 '14 at 15:08
Upvote: This is a simple command-line tool without a click-and-drool GUI like many of the other answers here. It nicely encapsulates the complexities of the (largely equivalent) GhostScript solution. – tripleee Apr 13 '15 at 14:28
This is also very fast. Does the job well. On a very slow server (aws t1.micro), gs takes 9 secs, pdftk takes 4 secs and this pdfunite takes 0.9 secs for merging two files! – rsmoorthy Jul 15 '15 at 19:49

You can also use jPDFTweak, pdfsam or pdfjam.

(That said, I use pdftk.)

share|improve this answer

Use pdfsam it's very good for splitting and merging pdfs

share|improve this answer

I use pdfseparate to extract specific pages from big pdf file:

pdfseparate -f  156 -l 157 input.pdf  output_%d.pdf 
pdfseparate -f  1   -l 2   input.pdf  output_%d.pdf 

and aftewards I join them all via command:

pdfunite $(ls -v output_*.pdf | tr '\n' ' ') out$(date  +%Y-%m-%d_%H_%M_%S ).pdf

This joins:

output_1.pdf output_2.pdf output_156.pdf output_157.pdf  



May be there is an easier way how to cope... :-)

share|improve this answer
The process substitution is superfluous and potentially even harmful. A correct an much simpler command line is pdfunite output_*.pdf out$(date +%Y-%m-%d-%H_%M_%S).pdf but it lacks the ordering of ls -v. An obvious and trivial fix is to name your files so that they naturally sort in the order you want to include them. If you absolutely want ls -v, you can at least lose the pipe to tr, which accomplishes nothing here. – tripleee Apr 13 '15 at 14:24

You can use pdftk to merge and modify PDF documents in general. Alternatively there's an online service to do just that:

share|improve this answer

protected by Eliah Kagan Sep 6 '13 at 7:02

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.