Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 03-24-2009, 05:05 PM   #1
jimmybobby
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 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/...k-list-top-25/
jimmybobby is offline   Reply With Quote
Old 03-24-2009, 05:13 PM   #2
wallcraft
reader
wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.wallcraft ought to be getting tired of karma fortunes by now.
 
wallcraft's Avatar
 
Posts: 6,979
Karma: 5183568
Join Date: Mar 2006
Location: Mississippi, USA
Device: Kindle 3 and Fire
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.
wallcraft is offline   Reply With Quote
Old 03-25-2009, 01:46 AM   #3
kylecronan
-
kylecronan began at the beginning.
 
Posts: 15
Karma: 12
Join Date: Feb 2009
Location: Chicago, IL
Device: Kindle 2
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
kylecronan is offline   Reply With Quote
Old 03-30-2009, 05:10 PM   #4
srmalloy
Enthusiast
srmalloy began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Mar 2009
Device: Kindle 2
Quote:
Originally Posted by kylecronan View Post
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).
srmalloy is offline   Reply With Quote
Reply

Tags
full screen, pdf, pictures

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
View pages with no margins on PRS 505 for PDFs craj999 Sony Reader Dev Corner 0 02-09-2010 12:23 AM
Best Device to view and work with PDFs? dionrowney Which one should I buy? 3 08-25-2009 01:01 AM
Best way to view/convert scanned PDFs? enarchay PDF 5 05-29-2009 06:31 PM
iRex Digital Reader works to view Google Pdfs amgoforth iRex 4 03-29-2009 02:16 PM
View PDFs with Metadata? Sonist iRex 2 12-13-2008 05:02 PM


All times are GMT -4. The time now is 07:34 AM.


MobileRead.com is a privately owned, operated and funded community.