WorkflowsFunctionsSystem Functions
Generate PDF from HTML Template
Convert HTML templates to PDF documents with support for template resolution and data binding
Generate PDF from HTML Template
Convert HTML templates to PDF documents using Pebble templates. This function automatically resolves reference and picklist fields, binds your data to the template, and generates professional PDF documents.
Technical Name: HTMLToPDFFunc
Properties
- Execution Mode: SYNC
- Type: NATIVE
- Category: System Functions
- Function ID:
3d26f546-324b-4bb6-89d5-48064a95fbed
Input Schema
Required Parameters
| Parameter | Type | Description |
|---|---|---|
templateId | string (uuid) | ID of the HTML template to use for PDF generation |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
dataObject | object | Data object for template resolution. Fields with __r suffix are automatically resolved for reference and picklist fields |
fileName | string | Name of the PDF file to generate (without extension). Defaults to "document" |
Input Example
{
"templateId": "invoice-template-uuid",
"dataObject": {
"invoiceNumber": "INV-2024-001",
"customerName": "John Doe",
"items": [
{"name": "Product A", "quantity": 2, "price": 50.00},
{"name": "Product B", "quantity": 1, "price": 75.00}
],
"total": 175.00,
"status__r": "Active"
},
"fileName": "invoice-INV-2024-001"
}Output Schema
| Field | Type | Description |
|---|---|---|
fileId | string (uuid) | ID of the generated PDF file in the file storage system |
Output Example
{
"fileId": "a7b9c4d2-3e5f-4a1b-9c8d-7e6f5a4b3c2d"
}Template Syntax
HTMLToPDF uses Pebble templates with support for:
- Variables:
{{ variableName }} - Conditionals:
{% if condition %}...{% endif %} - Loops:
{% for item in items %}...{% endfor %}
The function automatically resolves reference and picklist fields. Use {{ field__r }} for resolved values or {{ field }} (which will show resolved value if __r exists).
Use Cases
Invoice Generation
Generate PDF invoices from order data:
{
"templateId": "invoice-template-uuid",
"dataObject": {
"invoiceNumber": "INV-2024-001",
"customerName": "John Doe",
"items": [
{"description": "Product A", "quantity": 2, "unitPrice": 50.00, "total": 100.00}
],
"subtotal": 100.00,
"tax": 8.00,
"total": 108.00
},
"fileName": "invoice-INV-2024-001"
}Report Generation
Create formatted reports with resolved field values:
Start → FetchMData → HTMLToPDF → EmailNotification(attach PDF) → EndRelated Functions
- EmailNotification - Attach generated PDFs to emails
- FetchMData - Retrieve data before PDF generation