POST /convert/html-to-pdf supports three practical workflows:
- Send inline HTML as JSON
- Upload an HTML file as multipart form data
- Render a public URL and capture the result as PDF
When To Use Each Mode
| Mode | Best for | Content type |
|---|---|---|
| Inline HTML | Server-rendered templates, receipts, invoices, reports | application/json |
| HTML file upload | Existing .html assets on disk | multipart/form-data |
| URL mode | Public pages you want to render remotely | application/json |
JSON Contract
html or url, never both in the same request.
Important Limits
- Authenticated HTML payloads and HTML uploads are limited to 10 MB
- URL mode only accepts public
httpandhttpsaddresses - Private or internal URLs are blocked
waitTimeoutcannot exceed 30000 ms- Credit cost is 1 for inline HTML or file upload, 2 for URL mode
Common PDF Options
| Field | Meaning |
|---|---|
format | Paper size such as A4 or Letter |
landscape | Horizontal page layout |
printBackground | Include CSS backgrounds and colors |
scale | Page scale multiplier |
waitForSelector | Wait until a selector exists before rendering |
waitTimeout | Maximum wait time in milliseconds |
Multipart Upload Shape
When uploading an HTML file, send:file: the HTML fileoptions: optional JSON string with the samePdfOptionsobject