Friday, March 7, 2008

how do i combine multiple pdf files into one?

Well,for combining multiple pdf files into one,as usual there are two approaches that i can suggest
1.The easy way in which you don't have to worry about too much of internal details
There is a nice little utility called pdftk (the pdf toolkit) which allows you to manipulate pdf files in a variety of ways(like merging files,repairing corrupted pdfs,update pdf meta data etc).
You can download the utility from the url http://www.pdfhacks.com/pdftk/#packages
download is available for windows also.For ubuntu,you can also use apt to get it installed
from your terminal,type sudo apt-get install gs pdftk.Once it is installed you can issue the command as shown in the below example
jobinwl@jobinwl-laptop:/media/sda1/videooutput/pscan$ pdftk 1.pdf 2.pdf 3.pdf 4. pdf 5.pdf 6.pdf 7.pdf 8.pdf 9.pdf 10.pdf 11.pdf 12.pdf 13.pdf 14.pdf 15.pdf 16.p df 17.pdf 18.pdf 19.pdf 20.pdf 21.pdf cat output /home/jobinwl/Desktop/full.pdf
it will combine all the pdfs into one single file called full.pdf

2.The programmatic way in which you have a full control over the process
Let us see how to make a little utility program to get this done.Since pdf files are involved,we will be using the iText java library(assuming we are making it in java,there is also a .Net implementation of the same called iTextSharp). i am sure you must have heard about iText...it is an awesome java library that helps you to do a lot of pdf related operations like dynamic pdf creation or manipulation
source code is available here :http://docs.google.com/Doc?id=dr47ftb_2gsmgm5zs

10 comments:

Puddy said...

Great recommendation, easy to use tool. I was able to download pdftk and combine and rotate my documents in less than 10 minutes. Thank you!

Unknown said...

I appreciate your post! it saved me from needlessly printing out more sheets of paper. this tool was quick and easy to use.

Anonymous said...

Thanks a lot!! this post was really helpful.

Joti said...

thank you!!!

Anonymous said...

Worked great! Download and go. Thanks very much.

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
merge pdf files said...
This comment has been removed by a blog administrator.
morris said...

Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people.. this