One of the great features of the iPhone is the ability to load PDF files into the iBooks application… why lug paper around when you can have a huge amount of reading material right on your phone?
One of the challenges of this is that many freely available materials come as 1 chapter per PDF file: Linux Device Drivers is just one example. The iBooks application remembers where you last left off when reading a PDF file, it also supports bookmarks. As such, it makes for too much clutter to have multiple books with multiple files per chapter, too confusing to navigate and manage.
Using the GhostScript (gs) and pdftk tools we can easily combine multiple PDF files into one. Both these tools are freely available on Linux. The steps here were performed on Ubuntu 10.10
1. Install GhostScript and pdftk:
sudo apt-get install gs pdftk
2. Download the tarball of files:
wget http://lwn.net/images/pdf/LDD3/ldd3_pdf.tar.bz2
3. Unzip using bunzip2:
bunzip ldd3_pdf.tar.bz2
4. Un tar:
tar -xvf ldd3_pdf.tar
5. Change to newly created dir:
cd ldd3_pdf
6. Combine using GhostScript:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=ldd3.pdf -dBATCH TITLE.pdf ch01.pdf ch02.pdf ch03.pdf
(not all files listed)
7. There will now be an output file named ldd3.pdf that combines all the listed files in the order they were listed in the command arguments!