Docweave vs WeasyPrint
Docweave is a hosted, MCP-native PDF API: one REST call turns HTML, a URL, or a template + JSON into a PDF. The single biggest reason to consider it over WeasyPrint — an open-source Python library you install and self-host — is that Docweave removes the runtime you would otherwise own, and adds a first-class generate_pdf tool for AI agents with per-document pricing instead of managing servers yourself.
Where Docweave differs
| Docweave | WeasyPrint | |
|---|---|---|
| MCP-native tool | generate_pdf, open source (npx @docweave/mcp) | None — called as a Python library |
| Pricing model | Per document | Free/open source; you pay for your own hosting — see project docs |
| Sources | HTML, URL, template + JSON | HTML/CSS (self-assembled) |
| Rendering | Chromium | Own CSS layout/rendering engine — see provider docs |
Switching from WeasyPrint
Instead of installing WeasyPrint and calling it in-process, POST the same HTML to Docweave and get a PDF file back:
curl https://docweave.dev/api/v1/pdf \
-H "Authorization: Bearer dw_live_your_key" \
-H "Content-Type: application/json" \
-H "Accept: application/pdf" \
-d '{
"source": { "type": "html", "html": "<h1>Invoice #1024</h1>" },
"options": { "format": "A4", "margin": "20mm" }
}' \
--output invoice.pdfFAQ
Is Docweave a drop-in WeasyPrint alternative?
For the core job — HTML/CSS in, a PDF out — yes. WeasyPrint is a Python library you call in-process and self-host; Docweave is a hosted API you call with a single POST to /api/v1/pdf. You send HTML, a URL, or a template + JSON, and get a rendered PDF back, so there is no library version, system font stack, or worker process to maintain yourself.
Why would I use a hosted API instead of a self-hosted library like WeasyPrint?
WeasyPrint gives you full control but you own the runtime: installing it, keeping fonts and dependencies in sync, and scaling render workers as volume grows. Docweave removes that operational surface — you send a request and get a PDF, billed per document, with Chromium handling modern CSS rendering.
Can I use Docweave from an AI agent, unlike a plain Python library?
Yes. Docweave ships an open-source, MCP-native generate_pdf tool (npx @docweave/mcp) that any MCP client — Claude, Cursor, and others — can call directly as a tool, with no HTTP client or Python runtime required on the agent side.
How does pricing compare to WeasyPrint?
WeasyPrint itself is free and open source — you pay only for the infrastructure you run it on, plus your own time maintaining it. Docweave is a paid hosted service billed per document rather than per page or per server. Check WeasyPrint's docs for current install and hosting guidance if you are comparing total cost of ownership.
Try the MCP-native PDF API.
Get an API key