如何将带有透明图像的 HTML 转换为 Amazon Kindle 3?

发布于 2024-12-29 18:39:34 字数 575 浏览 3 评论 0原文

我正在尝试将我的网站/书籍 (HTML+CSS) 转换为单个 PDF 以便在 Amazon Kindle 上阅读,但不幸的是 Kindle 不支持透明 GIF/PNG 图像(我的网站上有很多具有透明背景的方程) 。

我尝试了几种方法:

1)KindleGen v2.3——尽管我的html非常简单,但它包含表格、图像、CSS,并且转换的结果并不漂亮。

2)我尝试了 wkhtmltopdf 但还有另一个问题:我有我的 HTML 中的表格很宽,并且 wkhtmltopdf 没有缩放它。它只是扩展了整个 pdf 文档的尺寸,这非常烦人。

3)我尝试使用 mpdf 库从 HTML 创建 PDF,结果很好,但显示的是空白而不是透明图像。

  • 我正在尝试根据图像(方程)放置的背景来更改图像(方程)的背景。就我而言,可以通过 DOM 来完成,但这并不是真正优雅的解决方案。你会怎么做?

如何将复杂的 HTML 转换为适用于 Kindle 的 PDF? 谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

故事和酒 2025-01-05 18:39:34

您可以使用 kindlegen 从 HTML 生成 .mobi 文件(嗯,prc,但这几乎是一样的......)

如果您不满意根据结果​​,另一个需要考虑的工具是 Calibre,它是电子书编目和转换的瑞士军刀(而且它可以创造来自 HTML 的 mobi)。

关于透明图像:是的,Kindle 还不能做到这一点。推荐的解决方案是使用白色背景之类的东西......但这并不理想。您可以使用imagemagick之类的东西来准备正确的格式如此处所述

关于 Kindle 上的 PDF:IMO,它不太理想(Kindle DX 除外)...您无法以不同的字体大小重排文本。从读者的角度来看,PDF 页面上的边距毫无用处(并且那里 是在 PDF 文件中删除它们的工具)...所以我推荐.(mobi|prc)

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

吻泪 2025-01-05 18:39:34

我听说 wkhtmltopdf 是一个使用 WebKit 的好项目。

它是免费的,所以尝试一下不会有什么坏处。

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

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

£烟消云散 2025-01-05 18:39:34

我会等待 Kindle Format 8 (KF8),因为它应该提供我需要的一切,同时我将使用 PDF。

所有从 html 到 mobi 格式的转换都不够好。 ePub 格式固然很好,但 Amazon Kindle 3 不支持该格式。

谢谢大家的帮助!

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!

甜`诱少女 2025-01-05 18:39:34

如果您想要流畅的设计,我发现了一个愉快的路径,即在 Open Office 中从 ODT 转到 HTML,然后在 Sigil 中打开它并清理 HTML,然后分成章节,分配书籍封面并构建目录,所有这些都在Sigil,然后使用 Sigil 的内置验证器、FlightCrew 和 Kindle Previewer 进行检查。

如果您的漫画书对图像有严格的要求,请听取其他人的建议。

希望这有帮助!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文