gpt4 book ai didi

python - 将XHTML转换为PDF的纯python解决方案

转载 作者:太空狗 更新时间:2023-10-29 16:56:29 25 4
gpt4 key购买 nike

我正在寻找一个纯 Python 解决方案(用于 GAE)将网页转换为 pdf。

我看过reportlab但文档侧重于从头开始生成 pdf,而不是从 HTML 转换。

您有什么建议? - pisa

编辑:我的用例是我有一个 HTML 报告,我也想以 PDF 格式提供。我将更新此报告结构,因此我不想维护单独的 PDF 版本,但(希望)自动转换。
此外,因为我生成了报告 HTML,所以我可以确保它是格式正确的 XHTML,从而使 PDF 转换更容易。

最佳答案

Pisa声称支持我想做的事情:

pisa is a html2pdf converter using the ReportLab Toolkit, the HTML5lib and pyPdf. It supports HTML 5 and CSS 2.1 (and some of CSS 3). It is completely written in pure Python so it is platform independent. The main benefit of this tool that a user with Web skills like HTML and CSS is able to generate PDF templates very quickly without learning new technologies. Easy integration into Python frameworks like CherryPy, KID Templating, TurboGears, Django, Zope, Plone, Google AppEngine (GAE) etc.

所以我会进一步调查

关于python - 将XHTML转换为PDF的纯python解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1598715/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com