84

I have 16 pdfs that I want to convert into a single one... I am on Ubuntu 10.10, how can I do it?

Mathias711
  • 6,266
  • 4
  • 34
  • 51
rodrigoalvesvieira
  • 7,331
  • 14
  • 57
  • 80

5 Answers5

162

First, get Pdftk:

sudo apt-get install pdftk

Now, as shown on example page, use

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf

for merging pdf files into one.

darioo
  • 43,550
  • 10
  • 71
  • 102
51

You can also use Ghostscript to merge different PDFs. You can even use it to merge a mix of PDFs, PostScript (PS) and EPS into one single output PDF file:

gs \
  -o merged.pdf \
  -sDEVICE=pdfwrite \
  -dPDFSETTINGS=/prepress \
   input_1.pdf \
   input_2.pdf \
   input_3.eps \
   input_4.ps \
   input_5.pdf

However, I agree with other answers: for your use case of merging PDF file types only, pdftk may be the best (and certainly fastest) option.

Update:
If processing time is not the main concern, but if the main concern is file size (or a fine-grained control over certain features of the output file), then the Ghostscript way certainly offers more power to you. To highlight a few of the differences:

  • Ghostscript can 'consolidate' the fonts of the input files which leads to a smaller file size of the output. It also can re-sample images, or scale all pages to a different size, or achieve a controlled color conversion from RGB to CMYK (or vice versa) should you need this (but that will require more CLI options than outlined in above command).
  • pdftk will just concatenate each file, and will not convert any colors. If each of your 16 input PDFs contains 5 subsetted fonts, the resulting output will contain 80 subsetted fonts. The resulting PDF's size is (nearly exactly) the sum of the input file bytes.
Kurt Pfeifle
  • 78,224
  • 20
  • 220
  • 319
15

You can use http://www.mergepdf.net/ for example

Or:

PDFTK http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

If you are NOT on Ubuntu and you have the same problem (and you wanted to start a new topic on SO and SO suggested to have a look at this question) you can also do it like this:

Things You'll Need:

* Full Version of Adobe Acrobat
  1. Open all the .pdf files you wish to merge. These can be minimized on your desktop as individual tabs.

  2. Pull up what you wish to be the first page of your merged document.

  3. Click the 'Combine Files' icon on the top left portion of the screen.

  4. The 'Combine Files' window that pops up is divided into three sections. The first section is titled, 'Choose the files you wish to combine'. Select the 'Add Open Files' option.

  5. Select the other open .pdf documents on your desktop when prompted.

  6. Rearrange the documents as you wish in the second window, titled, 'Arrange the files in the order you want them to appear in the new PDF'

  7. The final window, titled, 'Choose a file size and conversion setting' allows you to control the size of your merged PDF document. Consider the purpose of your new document. If its to be sent as an e-mail attachment, use a low size setting. If the PDF contains images or is to be used for presentation, choose a high setting. When finished, select 'Next'.

  8. A final choice: choose between either a single PDF document, or a PDF package, which comes with the option of creating a specialized cover sheet. When finished, hit 'Create', and save to your preferred location.

    • Tips & Warnings

Double check the PDF documents prior to merging to make sure all pertinent information is included. Its much easier to re-create a single PDF page than a multi-page document.

Wouter Dorgelo
  • 10,988
  • 11
  • 55
  • 75
  • You can also use PrimoPDF (print driver) and set the option (Append to existing PDF files instead of overwrite). Print all the PDF to the same filename and the files are merged. It is freeware too. – Wouter Dorgelo Nov 15 '10 at 12:17
  • 2
    Pallazo: rodrigo3n did state explicitely that he is using Ubuntu 10.10. How could you then advice him to buy the (rather expensive) `"Adobe Acrobat Full Version"` (which is only available for Windows and Mac OS X, not for Linux/Ubuntu) is way beyond my mental horizon. -- And how this answer could gain 2 upvotes from other readers is just unbelievable... – Kurt Pfeifle Nov 20 '10 at 17:23
  • It's possible people search for `How to merge many PDF files into a single one?` in Google while they are NOT on Ubuntu. In that case my third option will help them and they don't have to start a new question on SO. I didn't know `Adobe Acrobat Full Version` isn't available on Ubuntu, sorry for that. But my `out-of-the-box` answer might help other people who are NOT on Ubuntu while on Windows or Mac with the same problem. I edited my answer for you. – Wouter Dorgelo Nov 20 '10 at 17:34
  • Your first link first gets your files, and then asks for your email adress to register. Not the most friendly way to get informations about users. – m.raynal Apr 21 '17 at 12:36
  • I wanted to add a separate answer, but looks like new answers can be added to this question anymore. pdftk is no more available for ubuntu. So use pdfunite, see details at: https://www.unixblogger.com/2017/11/12/how-to-easily-merge-pdf-documents-under-linux/ – R71 Jul 05 '18 at 04:04
5

There are lots of free tools that can do this.

I use PDFTK (a open source cross-platform command-line tool) for things like that.

Christian Specht
  • 33,837
  • 14
  • 123
  • 176
2

Also seem pdfjam: http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic/firth/software/pdfjam/

Edd Barrett
  • 2,751
  • 2
  • 23
  • 37