Python: Create automated strictly-designed multi-page .pdf report from .html

后端 未结 2 644
一个人的身影
一个人的身影 2021-01-31 21:36

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
相关标签:
2条回答
  • 2021-01-31 21:54

    You can see this Python package: weasyprint

    Web page: http://weasyprint.org/

    Official 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

    0 讨论(0)
  • 2021-01-31 22:08

    I recently used weasyprint and jinja to do automated report generation from html. It worked well and I believe would be capable of meeting your strict format requirements. I haven't used any of the others though.

    My report had images, including graphs converted to images, normal dynamically generated text, as well as large tables. All of this was constrained to an 9x11 page size. Weasyprint does a good job of pagination automatically, but also has configurability in that regard.

    I found this guide to be very useful: http://pbpython.com/pdf-reports.html

    Although I think pandas is total overkill for html generation of graphs and you lose a lot of configurability using it.

    0 讨论(0)
提交回复
热议问题