Python:从.html创建自动严格设计的多页.pdf报告 [英] Python: Create automated strictly-designed multi-page .pdf report from .html
问题描述
什么是基于Python的选项来创建.html中严格设计的.pdf报告?
我附上了草稿.pdf以说明以下几点:
- 报告的设计非常严格。换句话说,看起来很重要。
- 报告包含复杂的矢量图形(包:的一些示例解决方案
你可以看到这个Python包: weasyprint
官方文档: http://weasyprint.readthedocs.io/en/latest/
这很棒,因为您可以从PDF中生成PDF一个网页或一个html文件,你可以与一些CSS(在文档中指定)发生冲突,但它提供了你需要的东西。
What are good Python-based options to create strictly designed .pdf reports from .html?
I've attached a draft .pdf to illustrate the following points:
- The design of the report is rather strictly designed. In other words "Looks matter".
- The report contains complex vector graphics (package: Matplotlib).These may slightly differ in size .
- The report contains images.
- The report contains a large number of numbers / strings filled in dynamically.
- Optimally, the solution would use open source packages.
- We create our .html with Django.
- The report may span multiple pages.
It looks as if there was already a good amount of very diverse packages facilitating reporting. Just to name a few, there are xhtml2pdf, weasyprint, django-wkhtmltopdf.
In my experience, it’s easy with these tools to create a .pdf from your content. The hard part comes when the .pdf needs to fall into a highly-defined design structure as in our case. Unfortunately, I was not able to find example .pdfs for the different pdf generation packages that have a highly designed structure.
What is your experience with this? Which options worked well for you? Are there well done complex examples that I’ve overlooked?
解决方案You can see this Python package: weasyprint
Web page: http://weasyprint.org/
Oficial doc: http://weasyprint.readthedocs.io/en/latest/
It's great, because you can generate the PDF from a web page or an html file, you can have conflicts with some CSS (which are specified in the documentation), but it provides what you need
这篇关于Python:从.html创建自动严格设计的多页.pdf报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!