pdftk PDF Merge binary helper script

I use pdftk a lot. If you use Adobe Acrobat in Windows, you know that it has a function for merging pdf files. I often download chapters of Medical Textbooks and need to combine them into a book.

The basic format for pdftk is:

pdftk 003.pdf 004.pdf 005.pdf 006.pdf 007.pdf 008.pdf 009.pdf 010.pdf 011.pdf 012.pdf 013.pdf 014.pdf 015.pdf 016.pdf 017.pdf 018.pdf 019.pdf 020.pdf 021.pdf 022.pdf 023.pdf 024.pdf 025.pdf 026.pdf 027.pdf 028.pdf 029.pdf 030.pdf 031.pdf 032.pdf 033.pdf 034.pdf 035.pdf 036.pdf 037.pdf 038.pdf 039.pdf 040.pdf 041.pdf 042.pdf 043.pdf 044.pdf 045.pdf 046.pdf 047.pdf 048.pdf 049.pdf 050.pdf 051.pdf 052.pdf 053.pdf 054.pdf 055.pdf 056.pdf 057.pdf 058.pdf 059.pdf 060.pdf 061.pdf 062.pdf 063.pdf 064.pdf 065.pdf 066.pdf 067.pdf 068.pdf 069.pdf 070.pdf 080.pdf 081.pdf 082.pdf 083.pdf 084.pdf 085.pdf 086.pdf 087.pdf 088.pdf 089.pdf 090.pdf cat output out.pdf[/code]

which is the command for combining the seperate files named 003.pdf through 090.pdf, into a merged pdf named out.pdf

Manually typing these out is a headache, so I made a wrapper for pdftk which can ask you about the basic file formatting, and create the command on its own, and even execute it in bash.

The binary is downloadable here and has been compiled for Ubuntu on a 32 bit Intel Q6600 machine. Obviously, you have to either install pdftk or compile it and add it to your BASH $PATH yourself.
[Download not found]

I just made a second binary, which reads the list of files in a directory, sorts it in ascending order (page order), and executes pdftk. It even allows you to choose start and end page. I decided to write this code as I found that pdftk did not give an intelligible response on faltering on a batch.
[Download not found]

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.