PDF 2 iPod Touch


Christmas brought an iPod Touch and it's my first ever iPod :) Really cool!
When playing with it I really liked the opportunity to read PDFs so that I can bring my coding articles around, but the fact that it reads a PDF only when online or with the document in the cache and the iPod in stand by is too bad!!!.
Googling around I found a great idea at insanely great news and, best of all, it works with clean iPods with no need to jailbreak them.

The idea is simple:
  • Encode a PDF file in base64
  • Embed it in a html file with a link to your encoded doc
  • Load it in Safari on your Mac
  • Open the embedded document clicking the link
  • Bookmark the PDF (or better the embedded data)
  • Sync your bookmarks in iTunes to setup your iPod Touch
  • Start up Safari in your iPod and just read it through your bookmars...Cool!

It works great (and not only with PDF but also with any file that you can read in Safari) and you can find a small app and a perl script at the site above.

I just translated the encoder script to Ruby, to start playing with this nice scripting language, and added another script to split PDF in smaller files so that you can load smaller documents in your iPod Touch without filling all available memory.

Here's how to use the scripts (get them at the end of this page):
  • pdfSplitter:
    • Splits a PDF in smaller documents with max N pages each (default is 50)
    • Usage: ruby pdfSplitter.rb sourceFileName destinationDir maxPagesPerDoc
    • NOTE: Needs RubyCocoa
    • Example:
      • Start terminal
      • Create a directory: mkdir mypdfs
      • Run the script on mydoc.pdf: ruby pdfSplitter.rb mydoc.pdf mypdfs 20
      • If your original doc was 30 pages you'll find, under mypdfs dir, two files: mydoc_1.pdf and mydoc_2.pdf of 20 and 10 pages
  • NOTE: The script uses the provided Readme.pdf to build each new PDF documents (i.e. it deletes the content and adds pages from source PDF)

  • dataUri:
    • Creates a set of HTML files with embedded data as a link
    • Usage: ruby dataUri.rb baseFileName workingDir
    • Example:
      • Start terminal
      • Run the script (i.e. working with previous example output): ruby dataUri.rb mydoc mypdfs
      • You should get two docs mydoc_1.pdf.html and mydoc_2.pdf.html
      • Open each doc, click the link and check the PDF is loaded in Safari then add a bookmark (and give it a nice Name :)


CREDITS:
Original idea found at: insanely great news. Thanks for sharing!
pdfSplitter.rb scripts uses RubyCocoa

NOTE:
Keep in mind both script have not been tested very much and I could try them only under Leopard.
You can do what you want with these scripts and, as usual, use them at your own risk :)

NOTE 2:
If you mailed me for some infos and you can't see any response thank all the spam that's floating around and that misteriously falls always in my mailbox :(

Here's the link to a zip file with scripts and a readme with some infos (please note the readme.pdf is used to build a new doc when splitting your original PDF file, so don't delete it and keep it in your script dir):

PDF 2 iPod Touch



Copyright BlackLizard 2008 iPod Touch is cool Apple product