After several years using HTML2PDF and pisa, I recently discovered (and contributed to) WeasyPrint: the most promising HTML to PDF python conversion tool available today.
WeasyPrint is a new powerful pure-python library for PDF generation, based on CSS and WEB standards, it is a great pure-python solution for HTML to PDF conversion.
As advertised on the WeasyPrint website:
WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. WeasyPrint is free software made available under a BSD license.
It is based on various libraries but not on a full rendering engine like WebKit or Gecko. The CSS layout engine is written in Python, designed for pagination, and meant to be easy to hack on.
This library is very well written, it comes with a full test suite and what amazed me most is that it was implemented from scratches from W3C standards and recommendations, believe me: this is not an easy task!
I’ve only found two useful features that are currently missing:
- HTML formatting is not available in page margin boxes
- multi column layout is not supported