Convert beautiful HTML/CSS template to PDF report

312 Views Asked by At

I have a beautiful HTML/CSS template that I would like to convert to a PDF

Amongst the many challenges I have encountered - I would like to retain all the CSS styling and also the page should break at specific parts so that the report does not look malformatted.

I am using Python to dynamically generate the HTML/CSS page based on some database inputs which are then inserted into the HTML/CSS template to generate the report.

What would be the best way to achieve this? I have tried online solutions but they seem rubbish and do not honor HTMl/CSS also I have tried various Python libraries which have mostly been crappy for the same reasons.

1

There are 1 best solutions below

1
Viiiinie On

Use that: https://html2pdf.com/de/ Also for CSS Search before you ask something