How To

Merging multiple PDFs in Linux

I always have trouble managing pdf files of same genre. I have recently found out there is something names pdftk, that makes life a bit easier by merging the pdfs. 🙂

PDFTK can do a lot of other cool stuff too. In this post I’ll be only writing about, how to use it for merging.


Install it

sudo apt-get install pdftk


Use it like

pdftk file1.pdf file2.pdf … cat output merged.pdf

So now, after this command, merged.pdf have both files file1, and file2 merged into one.


If you have a folder sorted genre wise, and you have a lot of files in a single folder.

use something like:

pdftk *.pdf cat output merged.pdf


The issue with the above command is this may alter the order in which the files appear in the merged file.

You can resolve this issue by naming files like, file1, file2, file3. The ls command should list the files in the same order in which you want the files to appear in the merged one.


Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s