|03-03-2009, 05:30 AM||#1|
Join Date: Feb 2009
Location: Chicago, IL
Device: Kindle 2
Convert PDFs to landscape mode .mobi/.prc file
Ok, so I believe I've tried all the different options out there short of writing a completely new program. And my conclusion is that if you're dealing with something formatted for (apprx) letter size paper, and it has lots of equations or complex formatting, you must convert to images to be able to read it on a Kindle. You then have to decide between regular portrait or landscape, in which you're holding the device rotated 90 degrees. For the former, I think the best option is probably PDFRead with prc-mobi-p, maybe combined with the 'pi' reformatter. The screen is really just too narrow, so it is hard to get the font size big enough (pi helps with this?).
So that leaves landscape mode: obviously each page will need to become 2 pages on the Kindle. This should be done with as much overlap as possible, so that content near the middle of the original page is hopefully still readable on one page or the other. The best tool I've found for this is Just Another Printer, which is here:
Another very important factor is whether the images are encoded as JPG or GIF in the prc file. GIF is much better for text, but I couldn't get the GIF output in Just Another Printer to work, so here's what I did:
Open up the PDF in Just Another Printer and set up two overlapping frames that crop out as much margin as possible (NB: you have to set it up first for the odd pages, then do something similar again for the even). The aspect ratio should say AR=1.23 or very close to this. Choose Export as Images+HTML from the menu and save as BMP, 8-bit greyscale with a custom size of X=520 and Y=640. Do this in a newly created directory, which will be filled with .bmp files.
Next I installed cygwin and chose to install the netpbm package under graphics. You also need to get mobigen from www.mobipocket.com/dev/.
Then do the following commands in your new directory, to convert everything to 4-bit GIF format (for Kindle 2) and assemble them into a mobi/prc file:
pgmramp -lr -maxval=15 16 1 > ramp.pnm
for n in *.bmp ; do m=`echo $n | sed 's/\.bmp//'` ; bmptopnm $n > $m.pbm ; pnmremap -mapfile ramp.pnm $m.pbm > $m.pbm2 ; ppmtogif $m.pbm2 > $m.gif ; rm $m.pbm $m.pbm2 ; done
cat *.html | sed 's/\.bmp/.gif/' > Name\ of\ File.html
../mobigen/mobigen Name\ of\ File.html -c2
And you will have a new file with a .mobi extension that you can transfer to the Kindle (even via the web browser!). I found that the file size was only about 4 times bigger than the original PDF for the file I tried. And the output looks very nice. Except for creating the original images in Just Another Printer, which could be done differently, this method should also be easy to port to Linux or MacOS.
Last edited by kylecronan; 03-03-2009 at 05:43 AM.
|03-09-2009, 12:55 PM||#2|
Join Date: Mar 2009
Device: Kindle 2
You are awesome
Wow, thank you kylecronan. I was looking around all of the posts explaining how complicated pdf conversion can be and here you've done all of the ground work. I've bookmarked your post.
|Thread Tools||Search this Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Convert .prc / .mobi to epub||goldberry||Calibre||3||09-12-2010 03:56 PM|
|Do you load pdfs on K2, or convert to mobi?||Sydney's Mom||Amazon Kindle||12||01-27-2010 02:49 PM|
|Using BD to convert prc file to Sony Reader||bbrotherton||Workshop||6||11-15-2008 10:11 AM|
|Bug when trying to convert a PRC file||Alfy||Calibre||3||10-18-2008 12:23 PM|
|Can you convert mobi prc to html?||Stuart Young||Bookeen||6||02-12-2008 03:34 AM|