How to convert HTML with transparent images to Amazon Kindle 3?

1.9k Views Asked by At

I'm trying to convert my website/book (HTML+CSS) to a single PDF for reading on Amazon Kindle but unfortunately Kindle does not support transparent GIF/PNG images (I have a lot of equations on my website that have transparent background).

I tried several approaches:

1) KindleGen v2.3 -- even though my html is quite simple it contains tables, images, CSS and the result of conversion is not pretty.

2) I tried wkhtmltopdf but there was another problem: I have a table in my HTML that is wide and wkhtmltopdf didn't scale it. It just extended dimensions of the whole pdf document which is quite annoying.

3) I tried mpdf library for creating PDF from HTML and the result is nice but blank spaces are shown instead of transparent images.

  • I'm trying to change background of images (equations) according to the background on which they are placed. It can be done, in my case, via DOM but it is not really elegant solution. How would you do that?

How do you convert complex HTML to PDF for Kindle? Thanks!

4

There are 4 best solutions below

0
On BEST ANSWER

I'll wait for Kindle Format 8 (KF8) because it should provide everything I need and I'll use a PDF meanwhile.

All conversions from html to mobi format are simply not good enough. ePub format would be great but that is not supported on Amazon Kindle 3.

Thank you all for help!

5
On

I've heard wkhtmltopdf is a good project that uses WebKit.

It's free, so it won't hurt to try it.

7
On

You can generate .mobi files from HTML with kindlegen (well, prc, but that's almost the same...)

If you are not satisfied with the results, another tool to consider is Calibre which is the swiss army knife of ebook cataloging and conversion (and it can create mobis from HTML).

Regarding transparent images: yeah, Kindle can't do that (yet). A recommended solution is to use something like white background... but that's not ideal. You can use something like imagemagick, to prepare to the proper format as described here.

About PDFs on the Kindle: IMO it's less than ideal (except Kindle DX)... You can't reflow the text with different font size. The margins on PDF pages are useless from a reader point of view (and there are tools the get rid of them in PDF files)... So I'd recommend .(mobi|prc).

0
On

If you want a fluid design, I've found the happy path to be going from ODT to HTML in Open Office, then opening that in Sigil and cleaning up the HTML, then breaking into chapters, assigning book cover and building TOC, all in Sigil, then checking with Sigil's built in validator, FlightCrew, and Kindle Previewer.

If you've got a comic book with exacting requirements for images, take someone else's advice.

Hope this helps!