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 html string 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 html parameter cannot be used simultaneously with url, markdown, or file.
  • Liquid Data Dependency: The liquid_data object will be completely ignored unless parse_liquid is set to true. Conversely, if parse_liquid is true, liquid_data is 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.