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

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


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


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.