Use Pdftk to Combine Your PDF Files

By René Dario Herrera

This is a short explanation of how to use the application, pdftk, to combine your PDF files.

A digital illustration of a technological landscape in the background. Three documents are combined into one.

I frequently have the need to combine, or concatenate, several PDF files into one file. Were I using Adobe Acrobat on a Windows machine I could point, drag, and click my way to PDF bliss. But I use Linux. And I don’t have Adobe Acrobat installed on my computer. I do have pdftk installed and this is how to use pdftk to combine my PDF files.

Using the bash terminal command line

It is simple to use. Let’s say I had three PDF files in a folder. There they are:

$ ls
document-1.pdf  document-2.pdf  document-3.pdf

But what I really wanted, was to have one PDF file called, my-documents.pdf, that contained those three documents. This is how to use PDFTK to concatenate pdf files. I added the verbose command to explain what pdftk is doing; I don’t usually include it.

$ pdftk document-1.pdf document-2.pdf document-3.pdf cat output my-documents.pdf verbose
Command Line Data is valid.

Input PDF Filenames & Passwords in Order
( <filename>[, <password>] )
   document-1.pdf
   document-2.pdf
   document-3.pdf

The operation to be performed:
   cat - Catenate given page ranges into a new PDF.

The output file will be named:
   my-documents.pdf

Output PDF encryption settings:
   Output PDF will not be encrypted.

No compression or uncompression being performed on output.

Creating Output ...
   Adding page 1 XNORTHX  from document-1.pdf
   Adding page 1 XNORTHX  from document-2.pdf
   Adding page 1 XNORTHX  from document-3.pdf

And I’ll list the files again to see what happened.

$ ls
document-1.pdf  document-2.pdf  document-3.pdf  my-documents.pdf

I now have a new file called my-documents.pdf that consists of each of the other documents.

Mission accomplished.

References