generate_document
Generate PDF documents from templates and data. Create invoices, contracts, reports, and certificates by injecting data into HTML/Handlebars templates with custom paper sizes and filenames.
Instructions
Generate a PDF document from a template and data. Returns a download URL for the generated PDF. Provide either template_id (to use a saved template) or markup (inline HTML/Handlebars template). The data object is injected into the template to produce the final document. Supports custom paper sizes, orientation, and filenames.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template_id | No | ID of a saved template to use. Mutually exclusive with markup. | |
| markup | No | Inline HTML/Handlebars markup template. Use when you don't have a saved template. | |
| data | Yes | Key-value data to populate the template placeholders. | |
| paper_size | No | Paper size for the PDF. Defaults to A4. | |
| orientation | No | Page orientation. Defaults to portrait. | |
| filename | No | Custom filename for the generated PDF (e.g. 'invoice-2024.pdf'). |