WeasyPrint
$ weasyprint Community Low RiskWeasyPrint (weasyprint) converts HTML and CSS directly into publication-grade PDF documents using CSS Paged Media (@page, running headers, page counters) without needing headless Chrome or LaTeX. Pure Python + Pango/Cairo rendering makes automated PDF generation fast and reproducible.
brew install weasyprint weasyprint renders local HTML+CSS directly to PDF files synchronously via stdin/file paths.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Clean weasyprint input.html output.pdf CLI supporting stdin/stdout (-), --info, --quiet, and deterministic exit codes.
- Non-interactive file or stdin-to-PDF rendering
weasyprint --infoverifies system libraries clearly
Does not execute JavaScript in HTML inputs, eliminating browser JS XSS/execution vectors during PDF generation.
- Zero JavaScript engine execution
- No credentials needed
Easy via brew install weasyprint on macOS; pip install weasyprint requires native Pango/HarfBuzz/Cairo libraries on Linux/Windows.
- Depends on system Pango/Cairo shared libraries
Best-in-class for HTML+CSS print layouts (@page headers/footers, PDF/A, attachments) without Chromium bloat.
- Full CSS Paged Media support
Actively maintained by CourtBouillon (Kozea/WeasyPrint) under BSD-3-Clause.
- Consistent releases and enterprise sponsorship
Well-documented CLI options and CSS Paged Media support matrix at doc.courtbouillon.org.
- Official docs at doc.courtbouillon.org/weasyprint/stable/
Security, Auth & Guardrails
No credentials required; offline HTML/CSS-to-PDF engine.
Free open-source software (BSD-3-Clause).
# WeasyPrint Agent Rules - Run `weasyprint --info` first if Pango/Cairo shared-library errors occur. - Keep input HTML local and pass `--base-url` explicitly when resolving relative assets. - Remember WeasyPrint does not execute JavaScript—render static HTML/CSS only.
Agent-Ready Command Recipes
Safe Read-Only Queries
weasyprint --info
Prints installed WeasyPrint, Pango, Cairo, and GDK-PixBuf library versions.
Controlled Writes & Previews
weasyprint report.html dist/report.pdf
Compiles report.html and its linked CSS into a paged PDF at dist/report.pdf.
Strengths for Agents
- + Browser-free HTML/CSS-to-PDF engine with full CSS Paged Media (
@page) support. - + Never executes JavaScript inside HTML documents, improving safety over headless Chromium.
- +
weasyprint --infosimplifies debugging native Pango/Cairo dependencies.
Caveats & Pitfalls
- ! Requires native Pango/Cairo system libraries when installed via
pipon minimal Linux containers. - ! Does not evaluate client-side JavaScript (SPAs or client-rendered charts must be pre-rendered to static HTML/SVG).