Working with PDF the free and easy way.

Since I got the Apple iPad a while back, I now deal with lots more PDF then I used to.

Very often we would like to do some simple work with PDFs, example: add/remove/swap pages/cover, split large PDF to multiple parts etc.

I tried quite some different freeware to work with PDFs, not as simple and as good as my need, some freeware has difficultly working with large PDFs (file size larger than 100MB or so), some of them do not work well on different/multiple pages resolution, some occupied crazy amount of memory (3GB+ for a 150 pages PDF)..

If you paid for the great Adobe Acrobat, things are a little bit better, their price do worth what it can do, but since my need was way too simple for that price, so it came to my interest to find a free and easier way to get my simple task done.

In the search, I found a program call pdftk, PDF Toolkit at which suits my needs.
First of all, the price is just right, it is free, and it does the simple job I want easily, especially I just love command line (CLI) programs, which I can do batch file processing.

Here is some examples:
To remove page 1,3 and page 301 from a PDF with 350 pages:
>pdftk INPUT.PDF cat 2 output TMP.002.PDF
>pdftk INPUT.PDF cat 4-300 output TMP.004-300.PDF
>pdftk INPUT.PDF cat 302-350 output TMP.302-350.PDF
>pdftk TMP.002.PDF TMP.004-300.PDF TMP.302-350.PDF cat output OUTPUT.PDF

To join all pdf in current directory to one PDF file:
>pdftk *.pdf cat output OUTPUT.PDF

I now use pdftk, imagemagick with a simple PERL script to process comics downloaded from the net.
Why so complicated you may ask, but handling downloaded comic images are a bit more work than you think, first many of these scans are in multiple page (2 page join in 1 image), which I do not like to see that on the iPad.
First the PERL script unzip the images into a tmp folder, using Image:Size, it tries to guess was the image merged from multiple pages (by width/height ratio), if split is needed it is then passed to imagemagick for splitting (left/right split), then resize is done too since we do not need very large image on the iPad, each page is then converted to a single PDF in imagemagick, finally we merge the PDFs into the final output by PDFTK.

Converting a 150 pages comic zip file from merged jpg/png to a single PDF is simple and quick (about 1~2 mins depends on how much work is needed on the resize and crop).