Mobileread
Better Way to View Complicated PDFs on Kindle 2
#1  jimmybobby 03-24-2009, 05:05 PM
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 http://www.mobileread.com/forums/showthread.php?t=20361 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).
Code
#!/usr/bin/python
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 :
http://ireaderreview.com/2009/03/09/kindle-2-tips-kindle-2-hack-list-top-25/
Reply 

#2  wallcraft 03-24-2009, 05:13 PM
Note that .zip and .cbz files containing images also work, see Kindle2 Manga/Comic Viewing, and this may simplify file management. Something like this should probably be added as an output option to PDFRead.
Reply 

#3  kylecronan 03-25-2009, 01:46 AM
Nice, I'm going to have to try this out! A couple suggestions: the Kindle2 can do 4-bit greyscale, so you might want to make a new greyscale map file to support that. Also, I find it nice to pack the images into a .mobi file so you don't have to rely on the image viewer interface, which seems rather buggy to me (also you have the opportunity to create a table of contents). Mobiperl can do this, but it is a mess. The official mobigen program works great, and it is command line so I'm sure it would run just fine in wine.

If you haven't seen it already, check out my conversion post (unfortunately it is somewhat windows-centric). I agree, rotating is the way to go.

http://www.mobileread.com/forums/showthread.php?t=40882
Reply 

#4  srmalloy 03-30-2009, 05:10 PM
Quote kylecronan
Nice, I'm going to have to try this out! A couple suggestions: the Kindle2 can do 4-bit greyscale, so you might want to make a new greyscale map file to support that.
From fiddling with images to replace the standard screensavers, the Kindle 2 palette runs from white at index 0 to black at index 15; that's a pretty straightforward greyscale map to make (not noticing that an image had gotten an odd palette color sequence made Escher's "Ascending and Descending" turn into an almost-unrecognizable fuzz on the Kindle 2, which apparently hardcodes the palette).
Reply 

Today's Posts | Search this Thread | Login | Register