Actions28
- Conversion Actions
- Document Actions
- PDF Service Actions
- Template Actions
- Workspace Actions
Overview
This node integrates with a PDF generation API to convert HTML content or public URLs into PDF documents. It supports specifying page size, orientation, and output format (either base64-encoded JSON or binary file). This node is useful when you need to programmatically generate PDFs from dynamic HTML content or web pages without using templates.
Common scenarios:
- Generating invoices, reports, or receipts as PDFs from custom HTML.
- Archiving web pages or online content as PDF files.
- Creating printable documents from styled HTML content in workflows.
Example:
You provide an HTML string containing a styled invoice, specify the filename and page layout options, and the node returns a PDF either as a base64 string for further processing or as a downloadable binary file.
Properties
| Name | Meaning |
|---|---|
| Filename | The name of the generated PDF file (without the .pdf extension). Must contain only letters, numbers, dots, hyphens, and underscores. |
| Additional Options | Collection of optional settings: |
| - Paper Size | PDF page size. Options: A0, A1, A2, A3, A4 (default), Legal, Letter, Tabloid |
| - Orientation | Page orientation. Options: Portrait (default), Landscape |
| - Output Format | Output format of the PDF. Options: Base64 (JSON) returns a JSON response with a base64 string; File (Binary) returns binary file data suitable for download or attachment |
Output
The node outputs an array of items, each containing:
json:success: Boolean indicating if the operation succeeded.filename: The full filename including.pdfextension.format: The output format chosen (base64orfile).- If output is base64, the JSON includes the base64-encoded PDF string and possibly other metadata returned by the API.
- If output is binary, the JSON includes success info and file metadata like file size.
binary(only if output format is "File (Binary)"):- Contains the actual PDF file data keyed by the filename, ready for downstream nodes to use as a file attachment or download.
Dependencies
- Requires an API key credential for the external PDF Generator API service.
- The node makes authenticated HTTP requests to the API endpoint (default base URL:
https://us1.pdfgeneratorapi.com/api/v4). - No additional environment variables are required beyond the API credential configuration.
Troubleshooting
- Filename validation errors: Ensure the filename is not empty and contains only allowed characters (letters, numbers, dots, hyphens, underscores).
- HTML content length: For HTML to PDF conversion, the HTML content must be at least 10 characters long.
- URL validation: For URL to PDF conversion, the URL must start with
http://orhttps://. - API authentication errors: Verify that the API key credential is correctly configured and has necessary permissions.
- Output format issues: If choosing binary output, ensure downstream nodes can handle binary data.
- General API errors: The node throws descriptive errors if the API returns invalid responses or if required parameters are missing.
Links and References
- PDF Generator API Documentation
- n8n Documentation on Custom Nodes
- HTML to PDF Conversion Best Practices
If you want me to analyze other resources or operations, just let me know!