/v1/convert/htmlConvert HTML to PDF
Send raw HTML content directly and get a base64-encoded PDF response. Best for server-rendered templates, email receipts, and generated markup where you want full control over the rendered payload.
Parameters
htmlComplete HTML document (recommended) or HTML fragment. Use inline CSS or embedded <style> tags for deterministic rendering.
configOptional render configuration. Include page dimensions, margins, timing controls, and output metadata.
cssOptional stylesheet content uploaded alongside the HTML payload. Use this when you want to keep styles separate from the markup instead of embedding <style> tags.
headerOptional complete HTML document rendered in the top margin area of each page. Use inline styles because it renders separately from the main document.
footerOptional complete HTML document rendered in the bottom margin area of each page. Same isolation rules as header apply.
Common HTML flow
- 1Generate HTML using your backend template engine.
- 2Pass styles either inline, inside
<style>, or through the optionalcssfield. - 3Add
headerandfooterHTML when you need repeated page chrome. - 4Pass
print_backgroundfor full visual parity with web output. - 5Decode and persist the PDF bytes where needed.