A simple, Docker-ized (def not required) snippet of code to test performance and CSS support for weasyprint's HTML to PDF conversion.
Using this simple template with this CSS, on my 2015 MacBook Pro I generated 100 PDFs in ~24 seconds!
I did note that the performance decreased dramatically from my first, very simple test to the HTML & CSS I have now.. so I recommend testing with a realistic sample.
I proved to myself that print margins and page breaks, as well as more "advanced" CSS like flexbox layout and transform: rotate() are supported by weasyprint.
Unfortunately, writing-mode: vertical-lr
wasn't supported yet, but weasyprint graciously let me know!
weasyprint - WARNING - Ignored `writing-mode: vertical-lr` at 29:3, unknown property.
Since HTML & CSS is squarely in the skillset of (dare I say) most developers, and allows us to render both in the browser and as a PDF document (reuse, baby!) reasonably quickly, I see weasyprint in my teams' futures =)
If you have Docker installed, clone this repo, run docker-compose up
and check your templates\output
directory.