View Single Post
Old 03-24-2009, 06:05 PM   #1
Junior Member
jimmybobby began at the beginning.
Posts: 1
Karma: 10
Join Date: Mar 2009
Device: kindle 2
Better Way to View Complicated PDFs on Kindle 2

The problem with viewing PDFs on the Kindle 2 (do not own kindle 1) come from two factors.
(a) Reformatting PDFs is hard to do, since there are a wide variety of PDFs out there created by totally different means (created from compiled latex, from word, from scanned images, etc). The free kindle conversion often works ok, but is horrible with equations and special symbols that aren't embedded as images. [Which is bad for those of us in the sciences who wanted to read scientific documents littered with equations.]
(b) The kindle screen is relatively small (800x600), so it is hard to read two column PDFs without reformatting as a full page.

Previous solutions basically have you convert the PDF to images on your own computer (by some means), and then create a mobi e-book file. The best solutions of these that I found, would work by rotating the image 90 degrees and splitting each PDF page into two pages. I found those solutions sub-optimal as when I am looking at the e-book on the kindle, I lost a lot of the screen space to margins at the top and bottom, telling me (a) the title of the PDF document, and (b) my progress through the PDF document. However since I was viewing in a land scaped mode, these were unreadable and pretty much useless.

My Solution? Simply convert PDF to rotated images (see python script below for which works in linux for imagemagick -- trivial changes should get it to work in windows or mac os x if you can install imagemagick on them -- though I do not own computers with them so cannot try it out).
Hook up your kindle 2 to your computer, and make a directory on your kindle called "pictures" (no quotes). Create a subfolder within the pictures directory to the name of the pdf you want (say "My Pdf File"), and drag and drop the pdf page images inside that subdirectory.
Disconnect your kindle from your computer and press "Alt-Z"
You should see a new book pop up on your home screen, called "My PDF File". Start viewing it, and go to the menu. Enable Full Screen Mode, and Enable Actual Size. (You only have to change these settings once -- its saved for all picture books). Next Page/Previous page, pages through the document.

This script requires kindle.gif obtained from and the original settings I used were based on the settings from that thread. They are not perfectly optimized (some tweaking could improve them), but work great so far. You can also use the bash script from that thread, however I find it easier to read files, if I rotate the book so prev page, next page is at the bottom of the page (near where I hold it); and I like plenty of text overlap between top and bottom of a PDF page (easier to read) and a decent border (so I do not have to worry about shadows from alternating lighting sources).

import commands
import sys
import os

myargs = sys.argv
print myargs[1:]

for filename in myargs[1:]:
    shortname = filename.replace('.pdf','')
    commands.getoutput('mkdir %s' % shortname)
    print filename
    output = commands.getoutput('rm %s/*.png' % shortname)
    output = commands.getoutput(
        ('convert -density 166x166  %s -trim +repage -resize 750 ' % filename) +
        '-rotate +90 -colorspace gray -type Grayscale -level 34\%,100\%,1.2 ' +
        '+dither -map kindle.gif %s/%s.png' % ((shortname,)*2) )
    print output
    image_files = os.walk(shortname).next()[2]
    for image_file in image_files:
        print image_file
        short_image_name = image_file.replace('.png','')
        output = commands.getoutput(
            "convert %s/%s.png -bordercolor white -border 10x35 -gravity northeast -crop 595x800+0 +repage %s/%s-a.png" % ((shortname,short_image_name,)*2))
        print output

        output = commands.getoutput(
            "convert %s/%s.png -bordercolor white -border 10x35 -gravity northwest -crop 595x800+0 +repage %s/%s-b.png" % ((shortname,short_image_name,)*2))
        print output

        output = commands.getoutput(
            "rm %s/%s.png" % (shortname, short_image_name))
        print output
Method of putting pictures on gotten from :
jimmybobby is offline   Reply With Quote