cURL
curl --request POST \ --url https://api.iyzpdf.com/v1/convert/html-to-pdf \ --header "X-API-Key: $IYZPDF_API_KEY" \ --header "Content-Type: application/json" \ --data '{ "html": "<!doctype html><html><body><h1>Invoice #1042</h1><p>Total: $99.00</p></body></html>", "options": { "format": "A4", "marginTop": "2cm", "marginBottom": "2cm", "printBackground": true } }' \ --output invoice.pdf
{ "fileName": "output.pdf", "size": 183240, "creditsUsed": 1, "creditsRemaining": 49, "contentType": "application/pdf" }
Render inline HTML, uploaded HTML files, or public URLs into PDF.
1
2
html
url
http
https
10 MB
Send your server-side API key in the X-API-Key header.
Show child attributes
{ "format": "A4", "marginTop": "2cm", "marginBottom": "2cm", "printBackground": true}
Successful response. Send Accept: application/json to receive file metadata instead of the binary payload.