Utilities
Turn styled HTML into paginated PDF output
HTML and CSS in, a paginated PDF out.
overview
What weasyprint does
WeasyPrint loads one connected HTML document, applies its embedded styles and an optional --stylesheet file, then writes a PDF artifact. CSS print rules control page size, margins, breaks, headers, and other paged-media behavior.
Enable --presentational-hints when legacy HTML attributes such as width, align, or bgcolor should influence rendering. Modern documents should express those choices in CSS instead.
This is an HTML/CSS renderer, not a browser automation node. It does not execute application interactions or wait for client-side JavaScript to populate a page.
source github.com/Kozea/WeasyPrint
use cases
Where weasyprint fits
Render workflow reports
Turn generated HTML findings into a fixed PDF deliverable.
Create evidence bundles
Apply a shared print stylesheet to consistent review and audit documents.
Generate invoices or summaries
Render structured HTML records with CSS page headers, footers, and page breaks.
reference
weasyprint inputs and flags
| Name | Type | Flag | Description |
|---|---|---|---|
| input | FILE | --input | Input HTML document. |
| stylesheet | FILE | --stylesheet | Additional CSS stylesheet. |
| presentational-hints | BOOLEAN | --presentational-hints | Honor HTML presentational attributes. |
Showing key inputs. weasyprint exposes 3 inputs in total.
example
Run weasyprint
weasyprint report.html report.pdf%PDF-1.71 0 obj<</Type /Pages/Count 1>>guidance
Choosing weasyprint
Use WeasyPrint when HTML and CSS are the source of truth for a PDF. Use LibreOffice for office-document conversion.
libreoffice
Converts office documents through LibreOffice import and export filters.
pandoc
Converts document structure between markup and text-oriented formats.
browser-fetch
Renders JavaScript-driven web pages and captures browser output.
faq
weasyprint questions
related
More Utilities tools
browser-fetch
Headless Chromium render: requested URL, final URL, status, and title next to the page.
cewl
Spider a URL and return a wordlist for password crackers.
csvkit
SQL on one CSV. The table name is the file stem.
dnsgen
Wordlist and mined-word subdomain permutation.
duckdb
In-process SQL on CSV, JSON, and Parquet. No server.
edge-tts
Microsoft Edge neural speech from text or a script file. No API key.
Run weasyprint yourself
A styled HTML fixture is rendered to one PDF page and checked for a valid PDF signature.
Facts on this page come from the live Trickest tool library.