WeasyPrint as a Service — Premium HTML to PDF
The WeasyPrint service provides premium HTML-to-PDF conversion with CSS paged media and HTML5 support. A paid subscription is required, though new accounts receive a 14-day trial period.
Endpoint
POST https://api.pdfbroker.io/api/pdf/weasyprint
PDF Format Support
| Format | Description |
|---|---|
| PDF up to 2.0 | Standard PDF versions |
| PDF/A-1b, 2b, 3b, 2u, 3u, 1a, 2a, 3a, 4u, 4f, 4e | Archival formats for long-term preservation. Level A also produces a tagged, accessible document. |
| PDF/UA-1, PDF/UA-2 | Universal accessibility format |
| PDF/X-1a, X-3, X-4, X-5g | Print production exchange formats |
Which variant to request, what each conformance level guarantees, and what your HTML must contain for the output to validate: see the WeasyPrint PDF variants reference.
URL-Based Generation
Generate a PDF from an existing web page by providing its URL:
{
"url": "https://www.pdfbroker.io",
"weasyPrintToPdfArguments": {
"pdf-variant": "pdf/ua-1"
}
}
Inline Markup Generation
Generate a PDF from inline HTML by providing Base64-encoded markup. Resources like images can be included separately:
{
"url": null,
"htmlBase64String": "PCFET0NUWVBFIGh0bWw...",
"weasyPrintToPdfArguments": {
"pdf-variant": "pdf/ua-1"
},
"resources": {
"pdfbroker_logo.svg": "PHN2ZyBpZD0iTGFnZXJfMS..."
}
}
Resources
Images and other files referenced in your HTML template can be provided as Base64-encoded values in the resources object. The key should match the filename used in the template.
Blocked Parameters
For security and operational reasons, the following WeasyPrint arguments are ignored:
v,verbose,versiond,debugq,quieth,helpu,f,format
See the Swagger documentation for the complete API specification.
See It in Action
Try WeasyPrint with our live demos: Invoice, Report, and Ticket. Compare engines in our WeasyPrint vs wkhtmltopdf guide.