HTML to PDF
HTMLtoPDFHTML to PDF: This HTML to PDF API renders raw HTML markup into downloadable PDF files. Send your escaped HTML string to receive a signed download link, an expiration timestamp, and the generated document filename. (Cost: 20 credits)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"html": "<html>"
},
"name": "HTMLtoPDF"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | Yes | The HTML content to convert to PDF. Ensure that the HTML is escaped properly | |
| scale | No | Zoom applied to the page content, 0.1 to 2 | |
| format | No | Paper size | A4 |
| landscape | No | Set to true for landscape orientation | |
| marginTop | No | The top margin of the PDF in inches (e.g., 0.5) | 0.4 |
| marginLeft | No | The left margin of the PDF in inches (e.g., 0.5) | 0.4 |
| pageRanges | No | Only these pages, e.g. 1-3, 5 | |
| marginRight | No | The right margin of the PDF in inches (e.g., 0.5) | 0.4 |
| marginBottom | No | The bottom margin of the PDF in inches (e.g., 0.5) | 0.4 |
| footerTemplate | No | HTML printed at the bottom of every page, with the same placeholders as headerTemplate, e.g. <span class="pageNumber"></span> of <span class="totalPages"></span> | |
| headerTemplate | No | HTML printed at the top of every page. Spans with class pageNumber, totalPages, date, title or url are filled in. Use inline styles with a font-size (Chromium defaults to a tiny font) and leave room with marginTop | |
| printBackground | No | Print background colours and images; set false for an ink-saving document |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| error | No | Error message, null on success | |
| status | No | "ok" on success |