Actions2
Overview
This node converts HTML content or captures website screenshots and generates PDF files. It supports two main operations:
- HTML to PDF: Converts provided HTML and CSS content into a styled PDF document.
- URL to PDF: Captures a screenshot of a specified webpage URL and outputs it as a PDF.
Common use cases include generating PDF reports from dynamic HTML content, archiving web pages as PDFs, or creating printable versions of websites automatically. For example, you could convert an invoice rendered in HTML/CSS into a PDF for emailing, or capture a full-page screenshot of a product page for documentation purposes.
Properties
| Name | Meaning |
|---|---|
| Operation | Choose between "HTML to Pdf" (convert HTML/CSS to PDF) or "URL to Pdf" (capture website screenshot as PDF). |
| HTML Content | The raw HTML markup to render when using the "HTML to Pdf" operation. |
| CSS Content | CSS styles to apply to the HTML content for styling the PDF output (only for "HTML to Pdf"). |
| Viewport Width | Width in pixels of the viewport used for rendering the HTML or capturing the webpage. |
| Viewport Height | Height in pixels of the viewport used for rendering or capturing. |
| Response Format | Format of the response for "HTML to Pdf": can be URL, PNG image, or Base64 string. |
| URL | The website URL to capture as PDF (only for "URL to Pdf"). |
| Full Page | Whether to capture the entire scrollable page or just the visible viewport (only for "URL to Pdf"). |
| Wait Till | Time in milliseconds to wait before capturing the screenshot, allowing the page to load fully (only for "URL to Pdf"). |
Output
The node outputs JSON data containing the result from the external PDF generation API. This typically includes:
- A URL to the generated PDF file or the PDF content encoded in the requested format (depending on the operation and response format).
- Metadata about the PDF generation process if available.
If the node encounters an error during processing, the output JSON will contain an error field with the error message.
The node does not directly output binary data but provides URLs or base64 strings representing the PDF or image content.
Dependencies
- Requires an API key credential for accessing the external PDF generation service at
https://pdfmunk.com/api/v1/generatePdf. - The node uses HTTP requests with authentication to communicate with this external API.
- No additional environment variables are explicitly required beyond the configured API credential.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication failures.
- Providing malformed HTML or CSS may result in incorrect or failed PDF generation.
- Specifying an unreachable or invalid URL for the "URL to Pdf" operation will cause errors.
- Insufficient wait time (
wait_till) might lead to incomplete page rendering before capture.
Error messages:
- Errors returned by the external API will be surfaced in the node's output under the
errorfield. - Network or authentication errors will throw exceptions; enabling "Continue On Fail" allows workflow continuation with error details.
- Errors returned by the external API will be surfaced in the node's output under the
Resolutions:
- Verify API credentials and permissions.
- Validate HTML/CSS input correctness.
- Ensure URLs are accessible and correct.
- Increase the wait time if the page loads slowly.
Links and References
- PDFMunk API Documentation (for detailed API usage and options)
- n8n HTTP Request Node Documentation (for understanding HTTP request handling in n8n)