Skip to content

wkhtmltopdf as a Service — HTML to PDF API

PdfBroker.io wraps the wkhtmltopdf tool as a cloud-based API, enabling PDF generation from HTML without requiring local installation. Supports JavaScript rendering with configurable delays.

Endpoint

POST https://api.pdfbroker.io/api/pdf/wkhtmltopdf

URL-Based Generation

Generate a PDF from an existing web page:

{
    "url": "https://www.pdfbroker.io",
    "wkHtmlToPdfArguments": {
        "viewport-size": "1280x1024",
        "grayscale": "",
        "javascript-delay": "500"
    }
}

JavaScript Delay

The javascript-delay parameter specifies milliseconds to wait for JavaScript execution to complete before PDF generation. Useful for single-page applications and client-side rendered content.

Inline HTML Generation

Generate a PDF from inline HTML with resource objects:

{
    "url": null,
    "htmlBase64String": "PCFET0NUWVBFIGh0bWw...",
    "wkHtmlToPdfArguments": null,
    "resources": {
        "image-name.svg": "PHN2ZyBpZD0i..."
    }
}

Blocked Parameters

These arguments are ignored. They are dropped silently rather than rejected, so a request that includes one still succeeds — the flag simply has no effect.

Informational flags, which would print text instead of producing a PDF:

  • manpage, help, H, h, extended-help
  • readme, license, version, V
  • debug-javascript, no-debug-javascript
  • read-args-from-stdin, htmldoc

File-access flags, because the service sets its own policy per request and grants access to exactly one temporary directory:

  • enable-local-file-access, allow

Send local images and fonts through the resources object instead — see Images in HTML templates. Other arguments are passed through to wkhtmltopdf. See the wkhtmltopdf manual for comprehensive options, and the Swagger documentation for the complete API specification.

See It in Action

Try wkhtmltopdf with our HTML Ticket Demo. Not sure which engine to use? Read our WeasyPrint vs wkhtmltopdf comparison.