software · Q411
WeasyPrint
HTML and CSS renderer for generating paginated PDF documents through Python or a command-line interface.
Overview
WeasyPrint renders HTML and CSS into paginated PDF documents for applications such as reports, invoices and books. Its Python layout engine is designed for print-oriented web standards rather than a full interactive browser. It is available as open-source software with command-line and Python interfaces.[1][2]
Template-driven pagination
Documents can be generated from HTML templates with CSS controlling their printed layout. The common-use guide places page size and margins in @page rules and describes page numbering and headers. This lets a web-oriented template produce discrete pages rather than merely capture a scrolling screen. The resulting pagination still depends on the renderer's supported CSS and the actual content supplied.[1][3]
Static rendering and release changes
WeasyPrint does not execute the JavaScript that an interactive website might use to populate its content. Required text and graphics must therefore be available through the input and supported resources. The API reference also warns that rendered output can change between releases even when calling code still works. Keeping templates compatible requires checking representative output, not only whether an upgrade completes without an API exception.[4][5]
Resource access and untrusted input
The default fetcher can read file and HTTP URLs, but does not automatically provide browser-style cookies or authentication. Applications may need a custom fetcher for controlled resources. The security guide warns that untrusted HTML or CSS can cause excessive processing and expose accessible files. Deployment should constrain resources, filesystem and network access rather than assume that generating a PDF is an inherently isolated operation.[2]
Specialized outputs
The renderer exposes options for specialized PDF variants, including archival and accessibility-oriented outputs. Its documentation explicitly declines to guarantee conformance for arbitrary inputs: the HTML structure, styles and chosen PDF features must also satisfy the relevant requirements. Selecting a profile is therefore part of producing a compliant document, not a substitute for checking the finished output against the required specification.[3]
Distribution and substitution
The BSD-3-Clause engine has documented Linux, macOS and Windows installation routes, with Python and Pango among its dependencies. It can substitute for Prince for suitable HTML/CSS document-generation workloads. A switch requires validating pagination and fonts and replacing any unsupported scripting or engine-specific styles. This comparison establishes a shared production task, without claiming identical typesetting or a measured performance advantage.[1][2][4][5][6]
Capabilities & limitations
CSS pagination
supportedPage dimensions and margins are specified through CSS @page rules.[3]
Generating paginated PDFs from HTML and CSS · Linux, macOS, Windows · Version, build and integration requirements apply
1 source · check evidence
Page dimensions, PDF variants and conformance caveat
vendor · checked 2026-10-07Client-side JavaScript rendering
unsupportedThe engine's documented scope excludes JavaScript and interactive browser behavior.[5]
Generating paginated PDFs from HTML and CSS · Linux, macOS, Windows · Version, build and integration requirements apply
1 source · check evidence
Static paged content without JavaScript execution
vendor · checked 2026-10-07PDF/A and PDF/UA output
limitedVariant options exist, but conformance depends on document content and is not guaranteed.[3]
Generating paginated PDFs from HTML and CSS · Linux, macOS, Windows · Version, build and integration requirements apply
1 source · check evidence
Page dimensions, PDF variants and conformance caveat
vendor · checked 2026-10-07Can substitute for
These are products or services this entry can replace. Check the task and limitations for each comparison.
References
- WeasyPrint documentation
HTML/CSS pagination engine and BSD-3-Clause licensing
vendor · retrieved 2026-10-07 - WeasyPrint first steps
Platform dependencies, URL fetchers and untrusted-input risks
vendor · retrieved 2026-10-07 - WeasyPrint common use cases
Page dimensions, PDF variants and conformance caveat
vendor · retrieved 2026-10-07 - WeasyPrint API reference
Versioning and rendering changes
vendor · retrieved 2026-10-07 - WeasyPrint design scope
Static paged content without JavaScript execution
vendor · retrieved 2026-10-07 - Prince overview
HTML/CSS PDF generation and paged layout
vendor · retrieved 2026-10-07
Discussion & disputes
Ask about unclear claims or explain a concern with supporting sources. If you have a specific fix, suggest a correction.
No discussion yet.
Revision history
Open a revision to read an earlier version of this article.
| Revision | Timestamp | Edit summary |
|---|---|---|
| 397 | 2026-10-11 20:46:10 | /* wbeditentity-create-item:0| */ sf:b55d91e6-5a55-4525-8a77-86c0a05ea315:v1 | Add WeasyPrint with pagination, untrusted-input controls and non-guaranteed PDF profile conformance; documentation research only. | attribution: /proposals/b55d91e6-5a55-4525-8a77-86c0a05ea315 |