Template
AI-generatedOverview
This node, "The PDF Maker Generate PDF," generates PDF documents based on a selected template and input data. It is designed to transform JSON data into a formatted PDF by applying a predefined template. This is particularly useful in scenarios such as generating invoices, reports, certificates, or any document that requires consistent styling and layout.
For example, a user can select an invoice template and provide customer and transaction data as input; the node will then produce a PDF invoice ready for download or further processing.
Properties
| Name | Meaning |
|---|---|
| Template Name or ID | Choose a template from a list of available templates or specify a template ID using an expression. The selected template defines the layout and style of the generated PDF. |
Output
The node outputs JSON data representing the result of the PDF generation request. Typically, this includes metadata about the generated PDF or a link/reference to the created PDF file. If binary data output is supported (not explicitly shown in the code), it would represent the actual PDF file content.
Dependencies
- Requires an API key credential for authentication with the external PDF generation service.
- Connects to an external API endpoint at a base URL defined in the constants (
BASE_URL). - Uses HTTP POST requests to
/api/n8n/generate-pdfto generate PDFs. - Requires the n8n environment to have the appropriate credential configured for API access.
Troubleshooting
Common issues:
- Invalid or missing API key credential will cause authentication failures.
- Selecting a non-existent or invalid template ID may result in errors from the API.
- Providing malformed or incompatible JSON data as input could cause PDF generation to fail.
Error messages:
- Authentication errors typically indicate problems with the API key; verify the credential setup.
- Template not found errors suggest the chosen template ID does not exist; refresh the template list or check the ID.
- API response errors related to data format require ensuring the input JSON matches the expected structure for the template.
Links and References
- n8n Expressions Documentation
- External API documentation (not provided in source) would be needed for detailed template and data requirements.