Actions28
- Conversion Actions
- Document Actions
- PDF Service Actions
- Template Actions
- Workspace Actions
Overview
The node integrates with a PDF Generator API to manage PDF templates, generate documents, convert HTML or URLs to PDFs, and perform various PDF-related operations. Specifically, the Template - Update operation allows users to update an existing PDF template by providing its ID and a complete JSON configuration describing the template's structure and settings.
This operation is useful when you want to modify the design, layout, or data settings of a PDF template used for generating documents dynamically. For example, you might update a template to change page size, add new components, adjust margins, or update data transformation rules without recreating the template from scratch.
Practical scenarios include:
- Updating invoice or report templates as branding or formatting requirements evolve.
- Modifying label or certificate templates to reflect new layouts or content.
- Adjusting multi-page document templates with complex layouts and conditional formatting.
Properties
| Name | Meaning |
|---|---|
| Template | Select the template to update. You can choose from a list of existing templates or specify the template ID directly (must be numeric). |
| Template Configuration JSON | The full JSON object representing the updated template configuration. This must include all required fields such as name, layout, pages array, dataSettings, and editor. It defines the entire template structure and settings. |
Details on "Template" property modes:
- From List: Pick a template from a searchable list fetched from the API.
- By ID: Enter the numeric template ID manually.
Template Configuration JSON
This JSON should represent the complete template object, for example:
{
"name": "My Template",
"tags": [],
"isDraft": true,
"layout": {
"format": "A4",
"unit": "cm",
"orientation": "portrait",
"rotation": 0,
"margins": {
"top": 0,
"left": 0,
"right": 0,
"bottom": 0
},
"emptyLabels": 0,
"width": 21,
"height": 29.7,
"repeatLayout": null
},
"pages": [
{
"width": 21,
"height": 29.7,
"conditionalFormats": [],
"backgroundImage": null,
"layout": [],
"components": [],
"margins": {
"right": 0,
"bottom": 0
},
"border": false
}
],
"dataSettings": {
"sortBy": [],
"filterBy": [],
"transform": []
},
"editor": {
"heightMultiplier": 1
},
"fontSubsetting": false,
"barcodeAsImage": false
}
Output
The output JSON contains the response from the API after updating the template. Typically, this will include details about the updated template such as its ID, name, status, and other metadata confirming the update was successful.
Example output structure (simplified):
{
"id": "12345",
"name": "My Template",
"isDraft": false,
"updatedAt": "2024-01-01T12:00:00Z",
...
}
No binary data is produced by this operation.
Dependencies
- Requires an active connection to the PDF Generator API service.
- Requires an API key credential configured in n8n for authentication.
- The node uses the base URL from the credential or defaults to
https://us1.pdfgeneratorapi.com/api/v4. - The user must provide valid JSON for the template configuration.
Troubleshooting
- Invalid JSON error: If the template configuration JSON is malformed or invalid, the node throws an error indicating the JSON must be valid. Ensure the JSON syntax is correct and all required fields are included.
- Template ID errors: The template ID must be numeric. Providing a non-numeric ID will cause validation errors.
- API errors: Errors returned from the API (e.g., unauthorized, not found) will be surfaced. Check that the API key is valid and the template ID exists.
- Missing required fields: The template configuration must include mandatory fields like
name,layout,pages,dataSettings, andeditor. Omitting these will cause the API to reject the update. - Network issues: Connectivity problems to the API endpoint will cause request failures.
Links and References
- PDF Generator API Documentation — Official API docs for templates and document generation.
- n8n Documentation — General information on using credentials and nodes in n8n.
- JSON Schema for Template Configuration (refer to API docs for detailed schema).
This summary covers the static analysis of the node's execute method focusing on the Template resource's Update operation, based on the provided source code and input properties.