Skip to main content
WeasyPrint ships with the pdf extra. It converts HTML and CSS to PDF, letting you use familiar web technologies for document layout.

Basic usage

Render the HTML with a Jinja2 template instead of an f-string once the document grows past a few elements. You get the same escaping and partials as the rest of your views.

Saving to storage

Generating in the background

PDF rendering is slow enough to be worth moving off the request.