What it does
WeasyPrint creates PDFs from HTML and CSS. Its command-line interface accepts a document or URL, while the Python interface exposes page-level rendering and custom resource fetching.
Start with an HTML source and a print stylesheet, then review font availability and warnings about unsupported CSS. The CLI writes a named PDF; Python can return PDF bytes or select rendered pages. Choose the output filename carefully because an existing file is overwritten without a prompt. Default fetching does not handle cookies or authentication. Services accepting untrusted HTML or CSS need explicit limits on rendering time, memory, network access and local files. The engine is BSD-licensed; professional support is offered separately.
Strengths
- Supports both simple command-line conversion and programmable rendering.
Watch out for
- Untrusted input requires explicit resource, network, and filesystem restrictions.
Best for
- Generating styled PDF reports from controlled HTML sources
Sources
- First Steps - WeasyPrint 70.0 documentation (Oct 26, 2026)
- WeasyPrint70 overview and BSD licensing (Oct 26, 2026)