WeasyPrint alternative
WeasyPrint Alternative for Python Teams That Need JavaScript and Chrome Accurate PDFs
WeasyPrint is a good library right up to the day a template needs JavaScript. Charts come out as empty boxes, a layout that is perfect in Chrome shifts by a few pixels, and the Pango and font packages you installed to make it run become part of every Docker image you ship. A WeasyPrint alternative that renders in real Chromium fixes all three without making you run a browser yourself. SitePDF takes your HTML or URL in one HTTP request and returns the PDF, and keeps a dated copy of every render if you ask it to.
- PDF and archive in one call
- Plans from $49 a month
- Your HTML stays yours
Short answer
People search for a WeasyPrint alternative when a document that looks right in Chrome comes out wrong from WeasyPrint. The usual cause is structural: WeasyPrint is its own layout engine and runs no JavaScript, so Chart.js, Plotly, ApexCharts and anything a framework draws after page load never appear. The alternatives are Playwright or Puppeteer on your own servers, or a rendering API such as SitePDF that runs Chromium for you. If your templates are static HTML and CSS, keep WeasyPrint. If they contain scripts or must match what a customer sees in Chrome, use a Chromium renderer.
Written and fact checked by the SitePDF team.
WeasyPrint and the alternatives, compared on what decides the choice
WeasyPrint, Playwright and Puppeteer are free open source projects. The SitePDF API figures come from our pricing page. The row that surprises most Python teams is the infrastructure one.
| WeasyPrint | Playwright or Puppeteer (self-host) | SitePDF API | |
|---|---|---|---|
| Rendering engine | Its own layout engine, built for print CSS | Real Chromium | Managed Chromium |
| Runs JavaScript | No, by design | Yes | Yes |
| Charts from Chart.js or Plotly | Empty box unless pre-rendered to an image | Yes, once the page settles | Yes, with a wait condition |
| Matches what Chrome shows | Close for simple CSS, differs on complex layouts | Yes | Yes |
| Print CSS (@page, running headers) | Strong. Its best feature. | Good, header and footer templates | Good, header and footer options |
| Install and runtime | pip install plus Pango and font libraries | Node or Python, Chromium download, shared memory and sandbox flags in Docker | None, it is an HTTP call |
| Cost | Free | Free plus server and engineering time | API from $49/mo ($288 billed yearly) for 10,000 renders, $99/mo for 50,000 |
| Dated archive of every render | No | No | Yes. archive=true, 90 days to 7 years by tier |
WeasyPrint is the better tool when the document is static HTML and the job is precise print layout: running page numbers, footnotes, CSS paged media. This page is for the case where the template has outgrown it.
When to keep WeasyPrint
WeasyPrint earns its place. It installs with pip, renders a page in milliseconds rather than seconds, and implements a good deal of the CSS paged media specification that Chromium handles less gracefully: named pages, running elements, footnotes and cross references. A report built around @page margin boxes and a real table of contents is a job WeasyPrint does well. It can also write PDF/A and PDF/UA variants, which matters if an auditor asks for them. If your template is plain HTML and CSS generated on the server and nothing on the page needs a script, there is no reason to leave. Read the WeasyPrint documentation for the current CSS support list before you decide anything.
The three things that push teams off WeasyPrint
JavaScript. The project states it plainly: no user interaction, no JavaScript, no live rendering. Any chart, map or component that draws itself after load renders as whatever was in the raw HTML, usually an empty container. We walk through the failure and the four ways to work around it in why WeasyPrint charts do not render. Pre-rendering charts to SVG in matplotlib is a sound fix when the chart only has to exist in the PDF. It is a poor one when the same visualization already lives in your web app and you would be maintaining it twice.
Fidelity to the browser. Product, finance and legal teams review the web page in Chrome and expect the PDF to match. WeasyPrint is a separate layout engine, so complex flexbox and grid layouts, web fonts and sticky or transformed elements can land a few pixels or a whole line off. Each mismatch is a ticket that says "the PDF looks different", and each one costs an engineer an afternoon.
Operations. WeasyPrint needs Pango and a set of system font libraries. That is easy on a laptop and a recurring chore in slim containers, Alpine images, AWS Lambda and CI runners, where a missing font package silently changes the typeface of every invoice.
Playwright and Puppeteer, and what running them really means
The obvious fix is Playwright. Its page.pdf() prints through Chromium, so scripts run and layout matches Chrome. It works well, and it moves the problem rather than removing it. You now ship a browser in your image, size memory for each concurrent page, handle the case where Chromium crashes mid-render, wait correctly for fonts and charts, and patch the browser as security fixes land. At a few documents an hour that is a small tax. At thousands a day it is a service you own. We priced that trade in HTML to PDF library vs API, and the Puppeteer alternative page covers the Node side of the same decision.
How SitePDF fits a Python codebase
You keep the template you already have, whether it is a Jinja2 file, a Django template or a page your app already serves. Instead of calling HTML(string=html).write_pdf(), you post the HTML or URL to the render endpoint and get a PDF URL back. Charts render because the page runs in Chromium; you pass a wait_for selector so the print starts only once the chart is drawn. Nothing about your Python deployment changes, and Pango can come out of your Dockerfile. Django specifics are on the HTML to PDF in Django page, and the wider library comparison is on Python PDF generation.
Each render can also be archived. If you generate invoices, contracts or statements, you get a timestamped copy of exactly what was rendered, retained from 90 days on the Starter API tier to 7 years on Enterprise. WeasyPrint has no equivalent, so teams usually bolt on object storage and a retention job. Plan details are on the pricing page.
A practical way to decide
Open your three most complex templates and ask two questions. Does any element depend on a script to appear? Would a reviewer comparing the PDF to Chrome notice a difference? If both answers are no, WeasyPrint is the right tool and the cheapest one. If either is yes, run the same template through the API and compare the output side by side. Our PDF API pricing comparison lays out what other rendering services charge for the same job so you can price it before you commit.
import requests
resp = requests.post(
'https://api.sitepdf.com/v1/render',
headers={'Authorization': f'Bearer {SITEPDF_KEY}'},
data={
'html': render_template('report.html', data=data),
'format': 'A4',
'wait_for': '#revenue-chart', # selector that exists once the chart is drawn
'archive': 'true', # keep a dated copy of this render
},
timeout=60,
)
pdf_url = resp.json()['pdf_url']
This is the documented API call shape. Full request and response walkthrough.
Questions about this job
What is the best alternative to WeasyPrint?
Does WeasyPrint support JavaScript?
Is WeasyPrint faster than Puppeteer?
Is WeasyPrint free for commercial use?
Can I replace WeasyPrint without running my own browser?
How much does a WeasyPrint alternative cost?
Index
More PDF and archiving tools
- Convert HTML to PDF
- Webpage to PDF
- URL to PDF API
- Website archiving
- Monitor website changes
- Screenshot API
- React to PDF
- Java PDF library
- C# PDF library
- Python PDF generation
- HTML to PDF Node.js
- Laravel HTML to PDF
- Vue to PDF
- Next.js PDF generator
- Angular to PDF
- Markdown to PDF API
- Django HTML to PDF
- Blazor HTML to PDF
- Spring Boot HTML to PDF
- Airtable to PDF
- Svelte to PDF
- Rotativa alternative
- Zapier and Make HTML to PDF
- Golang HTML to PDF
- Rails HTML to PDF
- PDF generator API
- Website archiving software
- Document generation API
- Legal document automation software
- Document automation software
- Bulk HTML to PDF
- Accessible PDF generation
- ADA compliance audit cost
- 508 compliance testing
- PDF remediation
- VPAT and ACR
- PDF accessibility checker
- Wayback Machine alternative
- Best HTML to PDF API
- DocRaptor alternative
- Puppeteer alternative
- Wkhtmltopdf alternative
- PDFShift pricing and alternative
- Urlbox pricing and alternative
- PDFCrowd alternative
- Api2Pdf alternative
- Browserless alternative
- APITemplate alternative
- CraftMyPDF alternative
- PDFMonkey alternative
- dompdf alternative
- jsPDF alternative
- mPDF alternative
- Website archiving pricing comparison
- HTML to PDF API for ecommerce
- HTML to PDF API for SaaS
- HTML to PDF API for accounting software
- PHP convert HTML to PDF
- PrinceXML alternative
- PDFreactor alternative
- PDF integrity check
- Invoice PDF archive
- PDF page numbers, headers and footers
- PDF of pages behind a login
- Website archiving for law firms
- React PDF renderer alternative
- Gotenberg alternative
- GrabzIt alternative
- Adobe PDF Services API
- PDF SDK pricing
- HTML to image API pricing
- Adobe Document Generation API pricing
- jsreport pricing
- PDFBolt pricing
- PDFEndpoint pricing
- Formstack Documents pricing
- Documint pricing
- iLovePDF API pricing
- Browserless pricing
- PandaDoc API pricing
- CloudConvert API pricing
- Encodian pricing
- IronPDF pricing
- Salesforce document generation pricing
- Winnovative pricing
- SelectPdf, HiQPdf and EvoPdf pricing
- CloudConvert alternative
- Direct mail API pricing
- E-signature API pricing
- Sparticuz Chromium Lambda cost
- Browserbase pricing
- Aspose PDF pricing
- PDF API pricing
- How it works
- Features
- Pricing
Get started
Render and archive with one API call
A pixel perfect PDF and a dated copy of the page from the same request. Plans from $49 a month, half price billed yearly.