Actions4
- Generate PDF Actions
- Generate Image Actions
Overview
This node integrates with the Pdforge API to generate documents either as PDFs or images based on predefined templates. It is particularly useful for automating the creation of customized documents such as reports, certificates, invoices, or any templated content that can be dynamically filled with variable data.
The "Generate Image" resource with the "Generate Synchronously" operation allows users to synchronously generate an image (e.g., PNG) from a selected template by providing the necessary variables. This is beneficial when immediate output is required without waiting for asynchronous callbacks.
Example use case:
You have a certificate template in Pdforge and want to generate personalized certificates as images for each user in your workflow. By selecting the template and passing user-specific variables, you can produce ready-to-use images instantly.
Properties
| Name | Meaning |
|---|---|
| Template Name or ID | The identifier of the template to use for generation. Choose from a list loaded dynamically or specify an ID directly. |
| Variables | JSON object containing key-value pairs to fill the template's variables. These customize the generated image content. |
Output
The node outputs an array of JSON objects corresponding to each input item processed. Each JSON object contains the response from the Pdforge API after generating the image. The exact structure depends on the API response but typically includes metadata about the generated image and possibly a URL or base64-encoded image data.
If binary data is returned (not explicitly shown in the code), it would represent the generated image file (e.g., PNG).
Dependencies
- Requires access to the Pdforge API.
- Needs an API authentication token configured in n8n credentials (referred generically as "an API key credential").
- Network connectivity to
https://api.pdforge.com.
Troubleshooting
- Invalid Template ID: If the template ID does not exist or is incorrect, the API will likely return an error. Verify the template ID by using the dynamic options list or checking Pdforge directly.
- Malformed Variables JSON: Ensure the "Variables" property contains valid JSON. Parsing errors will occur if the JSON is invalid.
- API Authentication Errors: Missing or incorrect API credentials will cause authentication failures. Confirm the API key is correctly set up in n8n.
- Network Issues: Connectivity problems to the Pdforge API endpoint will prevent generation. Check network settings and firewall rules.
- Unexpected API Response: If the API changes or returns unexpected data, the node might fail or produce incomplete output.
Links and References
- Pdforge API Documentation (generic link, replace with actual if available)
- n8n Expressions Documentation – for using expressions in properties like Template ID