Python HTML to PDF with full CSS3 and HTML5 support

I am working on a Python / Django project where I need to convert some of my high-level html content to PDF. I am currently using the wkhtmltopdf library. Although the conversion works almost perfectly, there are some issues with CSS3 and HTML5 support. Some of these styles do not convert correctly to pdf, and I need to change CSS and HTML to make it more printable, so I can convert it to PDF correctly. Until recently, I thought there was no tool that could do a 100% conversion, but I found this with an online demo of http://www.html-to-pdf.net/free-online-pdf-converter. aspx , which has much higher support for HTML5 and CSS3, but it is written for .NET. Is there anything with this level of conversion that supports Python?

Note. I will have many HTML pages that need CSS conversion and customization for each of them, this is not a good option for me. I need something that could do a 100% style conversion from HTML to PDF.

+6
source share
1 answer

If you or someone else is looking for some solutions, check out the following: Rendering HTML to PDF on the Django website

and https://github.com/chrisglass/xhtml2pdf or https://github.com/JazzCore/python-pdfkit

Hope this helps most of you.

+1
source

Source: https://habr.com/ru/post/980153/


All Articles