Overview
This node integrates with the PDFMonkey API to generate, retrieve, download, and delete PDF documents based on predefined templates. It is particularly useful for automating document creation workflows where PDFs need to be dynamically generated from data inputs, such as invoices, reports, contracts, or certificates.
Typical use cases include:
- Generating customized PDFs from JSON or key-value pair payloads using a specific PDF template.
- Checking the status of a PDF generation process.
- Downloading the generated PDF file automatically once ready.
- Deleting unwanted or obsolete PDF documents from the PDFMonkey service.
For example, you can automate invoice generation by providing customer and order details as JSON input, triggering PDF creation, waiting for completion, and then downloading the final invoice PDF.
Properties
| Name | Meaning |
|---|---|
| Document Template ID | The ID of the PDFMonkey template used to generate the PDF document. |
| Payload Input | Method to enter the dynamic data for PDF generation: either as raw JSON or as key-value pairs. |
| Payload (JSON) | The dynamic data in JSON format for populating the PDF template (used if Payload Input is JSON). |
| Payload (Key-Value Pairs) | Dynamic data entered as multiple key-value pairs; supports JSON arrays/objects if values start with [ or {. |
| Custom Filename | Optional custom filename for the generated PDF document; if empty, a random filename is assigned. |
| Meta (JSON) | Additional metadata for the document, e.g., specifying a custom filename via the _filename property. |
| Wait For Completion | Boolean flag indicating whether to wait for the PDF generation to complete and download the PDF automatically. |
Output
The node outputs an array of items, each containing:
json: An object representing the response from the PDFMonkey API, including document details such as ID, status, and metadata.binary(optional): When the PDF is successfully generated and downloaded, this field contains the binary PDF data prepared for further use or saving within n8n workflows.
Output structure varies depending on the operation:
- Generate Document: Outputs the created document's details. If waiting for completion is enabled and successful, includes the PDF binary data.
- Get Document: Outputs the current status and details of a specified document.
- Download PDF: Outputs a success message along with the PDF binary data if the document is ready.
- Delete Document: Outputs a success confirmation message upon deletion.
Dependencies
- Requires an active PDFMonkey API key credential configured in n8n for authentication.
- Makes HTTP requests to the PDFMonkey API endpoints (
https://api.pdfmonkey.io/api/v1/documents). - Uses n8n helper methods for HTTP requests and binary data preparation.
Troubleshooting
- No API Key Provided: The node will throw an error if the required API key credential is missing or invalid. Ensure the API key is correctly set up in n8n credentials.
- Document Generation Failure: If the document status returns "failure," check the failure cause in the output JSON. Common issues include invalid template IDs or malformed payload data.
- Document Not Ready for Download: Attempting to download a PDF before generation completes results in a warning and no binary data. Use the "Wait For Completion" option or poll the document status until it is "success."
- Deletion Errors: Failures during document deletion typically indicate permission issues or invalid document IDs. Review error messages for specifics.
- Payload Parsing Issues: When using key-value pairs, ensure that JSON-like strings are properly formatted; otherwise, they may be treated as plain strings, potentially causing template rendering errors.