HTML Source
Supply a raw HTML string to compile custom templates on-the-fly. You can use standard CSS, fonts, or enable Liquid template formatting.
Important Implementation Rules
- Required Tags: The
htmlstring MUST contain<head>,<title>, and<body>tags. If missing, the API will return a 422 error. - UTF-8 Encoding: Content must be properly UTF-8 encoded.
- Mutual Exclusivity: The
htmlparameter cannot be used simultaneously withurl,markdown, orfile. - Liquid Data Dependency: The
liquid_dataobject will be completely ignored unlessparse_liquidis set totrue. Conversely, ifparse_liquidistrue,liquid_datais required.
html
code
Default: "<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Invoice</title>
</head>
<body>
<div class="invoice-box">
<h1 id="main-title">Invoice</h1>
<p>Date: {{ date | default: "YYYY-MM-DD" }}</p>
<p>Customer: {{ customer_name | default: "Guest" }}</p>
<table id="items-table">
<tr>
<th>Item</th>
<th>Price</th>
</tr>
<tr>
<td>API Subscription</td>
<td>$49.00</td>
</tr>
</table>
<br>
<p id="footer-note">Thank you for your business!</p>
</div>
</body>
</html>"
Raw HTML content to render into a PDF document. Note: Mutually exclusive with url.
parse_liquid
boolean
Default: false
Enable standard Liquid template parser for parsing dynamic loops and variables within the HTML code.
liquid_data
code
Default: "{
"customer_name": "Acme Corp",
"date": "2023-11-01"
}"
JSON structured key-value variables to replace dynamic tags when parse_liquid is true.