Tuesday, February 9, 2010

How to merge pdf files in Linux?

I was about to submit claims for my expenses. I had to scan the receipts and email them to blah blah blah. The scanner gave me multiple pdfs and I preferred to send only one pdf. I had to merge the pdfs and did that by using the below command in my Fedora 10 box.

# gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=merged.pdf -dBATCH first.pdf second.pdf

I got this solution through a search in the web.

7 comments:

Siddhesh said...

Or you can use pdfjoin.

Anonymous said...
This comment has been removed by a blog administrator.
毅綠 said...
This comment has been removed by a blog administrator.
Solid Smoke said...

Does this method preserve the links in the PDF files? I was searching for a merge tool that doesn't mess up the links ( http://solidsmoke.blogspot.com/2009/11/merging-pdf-files-while-preserving.html ) and found pdftk.

Sadique Puthen said...

Yes, it does.

Solid Smoke said...

Not very well. I'm not talking about links to some URL, but links to sections in the same PDF files.

Sadique Puthen said...

I am also not speaking about links to other URLs. It worked well for me when I tested today!