2

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

 2 years ago
source link: https://www.codesd.com/item/how-to-convert-html-with-transparent-images-to-amazon-kindle-3.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

advertisements

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!


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).


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK