{"schemaVersion":"1.0","record":{"label":"WeasyPrint","description":"HTML and CSS renderer for generating paginated PDF documents through Python or a command-line interface.","aliases":[],"kind":"software","website":"https://weasyprint.org/","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.","license":"BSD-3-Clause","lifecycle":"active","example":false,"features":[{"name":"CSS pagination","status":"supported","detail":"Page dimensions and margins are specified through CSS @page rules.","useCase":"Generating paginated PDFs from HTML and CSS","platforms":["Linux","macOS","Windows"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://doc.courtbouillon.org/weasyprint/stable/common_use_cases.html","locator":"Page dimensions, PDF variants and conformance caveat","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"}]},{"name":"Client-side JavaScript rendering","status":"unsupported","detail":"The engine's documented scope excludes JavaScript and interactive browser behavior.","useCase":"Generating paginated PDFs from HTML and CSS","platforms":["Linux","macOS","Windows"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://doc.courtbouillon.org/weasyprint/stable/going_further.html","locator":"Static paged content without JavaScript execution","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"}]},{"name":"PDF/A and PDF/UA output","status":"limited","detail":"Variant options exist, but conformance depends on document content and is not guaranteed.","useCase":"Generating paginated PDFs from HTML and CSS","platforms":["Linux","macOS","Windows"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://doc.courtbouillon.org/weasyprint/stable/common_use_cases.html","locator":"Page dimensions, PDF variants and conformance caveat","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"}]}],"alternatives":[],"slug":"weasyprint","draftAlternatives":[{"targetSlug":"prince","status":"limited","detail":"Can cover HTML/CSS-to-PDF generation; engine-specific layouts and scripting requirements need separate checks.","useCase":"Generating paginated PDFs from HTML and CSS","platforms":["Linux","macOS","Windows"],"region":"Version, build and integration requirements apply","evidence":[{"url":"https://doc.courtbouillon.org/weasyprint/stable/","locator":"HTML/CSS pagination engine and BSD-3-Clause licensing","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"},{"url":"https://doc.courtbouillon.org/weasyprint/stable/going_further.html","locator":"Static paged content without JavaScript execution","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"},{"url":"https://www.princexml.com/","locator":"HTML/CSS PDF generation and paged layout","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"}]}],"evidence":[{"url":"https://doc.courtbouillon.org/weasyprint/stable/","locator":"HTML/CSS pagination engine and BSD-3-Clause licensing","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"},{"url":"https://doc.courtbouillon.org/weasyprint/stable/first_steps.html","locator":"Platform dependencies, URL fetchers and untrusted-input risks","retrievedAt":"2026-10-07T12:36:26.169Z","kind":"vendor"}],"document":{"version":1,"references":[{"url":"https://doc.courtbouillon.org/weasyprint/stable/","locator":"HTML/CSS pagination engine and BSD-3-Clause licensing","retrievedAt":"2026-10-07T12:36:26.169Z","id":"intro","title":"WeasyPrint documentation","kind":"vendor"},{"url":"https://doc.courtbouillon.org/weasyprint/stable/first_steps.html","locator":"Platform dependencies, URL fetchers and untrusted-input risks","retrievedAt":"2026-10-07T12:36:26.169Z","id":"steps","title":"WeasyPrint first steps","kind":"vendor"},{"url":"https://doc.courtbouillon.org/weasyprint/stable/common_use_cases.html","locator":"Page dimensions, PDF variants and conformance caveat","retrievedAt":"2026-10-07T12:36:26.169Z","id":"cases","title":"WeasyPrint common use cases","kind":"vendor"},{"url":"https://doc.courtbouillon.org/weasyprint/stable/api_reference.html","locator":"Versioning and rendering changes","retrievedAt":"2026-10-07T12:36:26.169Z","id":"api","title":"WeasyPrint API reference","kind":"vendor"},{"url":"https://doc.courtbouillon.org/weasyprint/stable/going_further.html","locator":"Static paged content without JavaScript execution","retrievedAt":"2026-10-07T12:36:26.169Z","id":"scope","title":"WeasyPrint design scope","kind":"vendor"},{"url":"https://www.princexml.com/","locator":"HTML/CSS PDF generation and paged layout","retrievedAt":"2026-10-07T12:36:26.169Z","id":"prince","title":"Prince overview","kind":"vendor"}],"overviewCitations":["intro","steps"],"licenseCitations":["intro"],"sections":[{"id":"layout","heading":"Template-driven pagination","paragraphs":[{"id":"layout-detail","content":[{"text":"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."}],"citations":["cases","intro"]}]},{"id":"scope","heading":"Static rendering and release changes","paragraphs":[{"id":"scope-detail","content":[{"text":"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."}],"citations":["scope","api"]}]},{"id":"resources","heading":"Resource access and untrusted input","paragraphs":[{"id":"resources-detail","content":[{"text":"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."}],"citations":["steps"]}]},{"id":"profiles","heading":"Specialized outputs","paragraphs":[{"id":"profiles-detail","content":[{"text":"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."}],"citations":["cases"]}]},{"id":"availability","heading":"Distribution and substitution","paragraphs":[{"id":"availability-detail","content":[{"text":"The BSD-3-Clause engine has documented Linux, macOS and Windows installation routes, with Python and Pango among its dependencies. It can substitute for "},{"text":"Prince","targetSlug":"prince"},{"text":" 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."}],"citations":["intro","steps","api","scope","prince"]}]}]},"id":"Q411","revision":397,"updatedAt":"2026-10-11T20:46:10Z","sourceUrl":"https://substitutefor.net/entities/Q411?revision=397"}}