Merging multiple PDF files in Linux

I always had trouble maintaining multiple PDF’s of same genre. A simple command – pdftk will do the trick of merging them together into a single PDF file. pdftk is present in Ubuntu repository itself.

Using the command is also very simple.

pdftk input1.pdf input2.pdf … cat output output.pdf

so if a.pdf, b.pdf so on are the pdf files u want to merge and the output file is combined.pdf then the command will be

pdftk a.pdf b.pdf cat output combined.pdf

Now if you a folder full of pdf files that you have to merge into a single pdf file , you can give something like

pdftk *.pdf cat output combined.pdf

The only problem being that *.pdf might not take the input in the order you want. So you have to name the files such that doing an ls in the directory gives the files in the order in which you wanted them to be merged in the final output pdf file. say file00.pdf file01.pdf and so on.

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 )

Connecting to %s