# WeasyPrint

> Renders HTML and CSS to PDF, from Python or the command line

Source: https://talira.ai/catalog/weasyprint-c7dnxd3b
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [documents / pdf / generation](https://talira.ai/categories/documents/pdf/generation), [languages / python](https://talira.ai/categories/languages/python)
- Platforms: linux, macos, windows, cli[^6]
- Licence: BSD-3-Clause[^5]
- Pricing: Free and open source[^4][^5]
- Pricing notes: Free under BSD-3-Clause. CourtBouillon sells consulting packages (Basic EUR 150, Essential EUR 350, Premium EUR 550 per month, billed annually), not offered in Canada or the USA.
- Free tier: yes[^4][^5]
- Self-hostable: yes[^6]
- Backed by: [CourtBouillon](https://talira.ai/orgs/courtbouillon.md)
- Creator: Kozea
- Sponsors: Spacinov, Syslifters, Kobalt, NLnet (grant)

WeasyPrint is a Python library and command-line tool that renders HTML and CSS to PDF. It is not built on a browser engine such as WebKit or Gecko: its CSS layout engine is written in Python and designed for pagination, aiming to support the web standards for printing (paged media). It suits reports, invoices, tickets, books and letters made from HTML you control. It was created by Kozea, and CourtBouillon provides maintenance and paid professional support.

## Links

- Website: https://weasyprint.org
- GitHub: https://github.com/Kozea/WeasyPrint
- Docs: https://doc.courtbouillon.org/weasyprint/

## Ways to install

### Package managers

- [APT](https://talira.ai/catalog/apt-d7essv0z.md): <https://packages.debian.org/stable/weasyprint>[^1]

## Problems it solves

- generate invoice PDFs from Django templates without running a headless browser
- I need running page headers, footers and page X of Y using CSS @page rules
- Python HTML to PDF that doesn't need Chrome installed on the server
- our xhtml2pdf output ignores half of our CSS
- build a printable report with a table of contents and different layouts per page
- make print-ready books and booklets from HTML with a separate print stylesheet
- turn a Flask view into a downloadable PDF in a few lines of code
- need hyphenation and proper page breaks in long documents generated from HTML
- render PDFs inside a slim Python container where Chromium is too heavy
- replace wkhtmltopdf in our Python app now that it's no longer maintained
- print event tickets with barcodes from HTML templates

## Features

- HTML and CSS to PDF
- CSS layout engine designed for pagination
- headers, footers and page layouts via CSS paged media
- table of contents
- PDF form inputs
- alternate print stylesheets
- command-line interface

## Limitations

- Doesn't run JavaScript in the HTML it converts[^2]
- Doesn't output images (PNG): PDF is its only output format[^3]

## Capabilities

- Has a command line tool: plan not known
- Has official SDKs: plan not known

## Trust

Overall: 0.80 out of 1.
Signals: maintenance 1.00, adoption 0.80, momentum 0.52, community 0.92, backing 0.85, extensibility 0.20.

- last commit 10 days ago
- 132 commits in the last 90 days
- latest release v70.0 2 months ago
- 9.8k GitHub stars
- 198 contributors
- accepts sponsorship (Open Collective)
- backed by CourtBouillon
- created by Kozea
- sponsored by Spacinov, Syslifters, Kobalt, NLnet (grant)
- used by IETF, Unicode, GOV.UK, MetLife

## Alternatives

- [ironpress](https://talira.ai/catalog/ironpress-g94sb527.md): HTML to PDF. In process. In pure Rust.
- [DocRaptor](https://talira.ai/catalog/docraptor-qrzzachz.md): The World's Most Advanced HTML to PDF API
- [ReportLab](https://talira.ai/catalog/reportlab-389sa2r4.md): The print button for eBusiness
- [Prince](https://talira.ai/catalog/prince-cbgkkxts.md): Convert HTML to PDF. Beautiful printing with simple CSS.
- [Gotenberg](https://talira.ai/catalog/gotenberg-pxa4k262.md): A Docker-based API for PDF
- [Puppeteer](https://talira.ai/catalog/puppeteer-vbv4zakx.md): JavaScript API for Chrome and Firefox

## Sources

[^1]: https://deb.debian.org/debian/dists/stable/main/source/Sources.xz (checked 21 Nov 2026)
[^2]: https://doc.courtbouillon.org/weasyprint/stable/going_further.html (checked 17 Nov 2026)
[^3]: https://doc.courtbouillon.org/weasyprint/stable/changelog.html (checked 17 Nov 2026)
[^4]: https://weasyprint.org (checked 17 Nov 2026)
[^5]: https://github.com/Kozea/WeasyPrint/blob/main/LICENSE (checked 17 Nov 2026)
[^6]: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html (checked 17 Nov 2026)
[^7]: https://github.com/Kozea/WeasyPrint (checked 17 Nov 2026)
