Skip to content Skip to sidebar Skip to footer

Python: Create Automated Strictly-designed Multi-page .pdf Report From .html

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

Solution 1:

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


Solution 2:

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.


Post a Comment for "Python: Create Automated Strictly-designed Multi-page .pdf Report From .html"