pdf-for-kindle-touch
1 How to get your pdf Kindle-touch-ready (using open source tools)
PDF reading on Kindle touch is suffer. Googling "pdf kindle touch" will show you how many other people also thinks so.
With the help of some open source tools (mainly pdfjam), you can actually get a lot better experience reading pdf on your Kindle touch.
Below I will talk about how to get you pdf file kindle-touch-ready on 2 situations:
- you already got a pdf
- you are about to print (such as an html) into pdf
1.1 Already got a pdf
When you already got a pdf, there is not much you can do except to sacrifice something: you need cut every page into halves so that it looks large enough on kindle touch and do not strain your eyes so much.
With the help of pdfjam, you can achieve this like the following.
- Get rid of the margin
pdfnup --no-landscape --nup 1x1 --papersize '{210mm,297mm}' --trim '18.5mm 18.5mm 18.5mm 25.5mm' 1.pdf
How much you need to cut off? You may need to try and error for it. If you cut too little, the pages would not be as big as it can be when displayed on the Kindle touch, thus still strains your eyes out a little bit. But if you cut off too much, then useful text might be cut off, which is surely not wanted, either.
- split it to top and bottom halfs (so that we can read in landscape on kindle touch)
pdfnup --no-landscape --nup 1x1 --papersize '{210mm,154mm}' --trim '0 143mm 0 0' --suffix top 1-nup.pdf pdfnup --no-landscape --nup 1x1 --papersize '{210mm,154mm}' --trim '0 0 0 143mm' --suffix bot 1-nup.pdf
Note that I'm not cutting right through the center of the page, for an A4 (210mm x 297mm) page, that will be 148mm cut off and 149mm remaining. Instead, for each half, I cut off 143mm and 154mm remained. This is because we do not want part of a line of text show in the top half while the other part of the same line of text show in the bottom half. With the extra space we reserved, if a line of text is only partially shown in the top half, for e.g., it will almost certainly show completely in the bottom half.
At the end of this, you get 2 pdf files, one consist all the pages for the top half, and one all the pages of the bottom half. This is mostly not what we want, we want the top half pages and bottom half pages interwined in the correct order. To achieve this, we need 2 steps.
- split and interwine the top and bot pdf files page by page
for x in $(seq 1 530); do pdfjoin 1-nup-top.pdf $x 1-nup-bot.pdf $x; done
At the end of this, we get as many pdf files as there are pages in the original pdf file, each new file contains exactly 2 pages, the top half page and the bottom half page.
So we need to join them.
- join all the new pdfs
for x in $(seq 1 528); do echo 1-nup-bot-$x-joined.pdf; done|xargs pdfjoin
- rotate the pages
pdf90 /home/bhj/today/1-nup-bot-528-joined-joined.pdf
After all these steps, you can view your pdf in landscape mode on your Kindle touch. Finally.
This seems a lot of ordeal, so I have put together 2 scripts to automate them, you can find it at pdf-cut and pdf-for-kindle. The former is for trial and error when you need to determine how much to cut off each page, and after you get the perfect set of parameters, you can change
pdf-cut
topdf-for-kindle
to get the converted Kindle-Touch-Ready version of pdf.
1.2 When you can print to a pdf
There is a very simple way to get a Kindle-Touch-Ready pdf in this situation, customize your cups-pdf page size!
For e.g., I have my pdf pseudo printer page size to be set up as 8.5in x 6in.
After you got the pdf printed, you can use the same tricks to cut out the margins and rotate it for landscape viewing on Kindle.
Another pitfall in this solution though: Kindle-Touch will easily display out-of-memory for pdf thus created. I believe its because the ghostscript backend used in cups-pdf printer use a lot of Type-3 fonts which is memory hungry.
My solution, is to root my Kindle-Touch and turn swapping on, so it can get 512M extra virtual memory!