Skip to content

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 1.7 Standard PDF versions
PDF/A-1b, 2b, 3b, 4b Archival formats for long-term preservation
PDF/UA-1 Universal accessibility format

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, version
  • d, debug
  • q, quiet
  • h, help
  • u, 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.