Overview
This node generates PDF documents using the N8N Tools platform. It supports three main operations:
- Generate from URL: Converts a webpage at a specified URL into a PDF.
- (Other operations exist but are out of scope for this request.)
The "Generate from URL" operation is useful when you want to create a PDF snapshot of any live webpage, such as reports, invoices, or articles, without manually saving or printing them. For example, you can automate generating PDFs of daily news pages or product catalogs hosted online.
Properties
| Name | Meaning |
|---|---|
| URL | The webpage URL to convert into a PDF. |
| Options | Collection of options to customize the PDF output: |
| - Filename | Name of the generated PDF file (default: document.pdf). |
| - Format | Paper format for the PDF. Options: A4, A3, Letter, Legal (default: A4). |
| - Orientation | Page orientation. Options: Portrait, Landscape (default: Portrait). |
| - Include Header | Whether to include a header in the PDF (true/false, default: false). |
| - Include Footer | Whether to include a footer in the PDF (true/false, default: false). |
| - Margin Top | Top margin size (e.g., "1cm", "10px"; default: "1cm"). |
| - Margin Bottom | Bottom margin size (default: "1cm"). |
| - Margin Left | Left margin size (default: "1cm"). |
| - Margin Right | Right margin size (default: "1cm"). |
| - Print Background | Whether to include background graphics in the PDF (true/false, default: true). |
| - Wait Delay (ms) | Time in milliseconds to wait before generating the PDF (default: 3000 ms). |
| - Emulated Media Type | Media type to emulate during rendering. Options: Screen, Print (default: Screen). |
Output
The node outputs an array of items, each containing:
json: Metadata about the generated PDF:
success: Boolean indicating if generation succeeded.filename: The name of the generated PDF file.size: Size of the PDF in bytes.operation: The operation performed (generateFromUrl).- Additional metadata related to API usage and costs (credits used, remaining, cost in USD, operation cost, budget alerts/messages).
binary.data: The actual PDF file content encoded as binary data, ready for further use or download.
Dependencies
- Requires an API key credential for the N8N Tools platform to authenticate requests.
- The node makes HTTP POST requests to the N8N Tools API endpoints to generate PDFs.
- No other external dependencies are required within n8n.
Troubleshooting
Common issues:
- Invalid or missing API key credential will cause authentication failures.
- Incorrect or unreachable URL may result in failed PDF generation.
- Network issues or API downtime can cause request errors.
Error messages:
"No response body received from API."indicates the API did not return expected data; check network and API status."Invalid response body type"suggests unexpected API response format; verify API compatibility."Template ID is required"(not relevant here but part of other operations) means a required parameter was missing.- General
"PDF generation failed: <error message>"indicates failure during the process; inspect the error message for details.
Resolution tips:
- Ensure the API key credential is correctly configured and valid.
- Verify the URL is accessible and correct.
- Increase the wait delay if the page takes longer to load before PDF generation.
- Enable "Continue on Fail" in the node settings to handle errors gracefully in workflows.
Links and References
- N8N Documentation
- N8N Tools Platform API Documentation (hypothetical link based on context)