Actions8
Overview
This node integrates with the HeadlessX API to generate PDFs from web pages. It allows users to specify a URL and customize PDF generation options such as page format, orientation, and whether to print background graphics. This is useful for automating the creation of PDF documents from dynamic or static web content, for example:
- Archiving web pages as PDFs for offline reading.
- Generating reports or invoices from web-based dashboards.
- Creating printable versions of online articles or documentation.
The node supports advanced customization including waiting for specific page states before generating the PDF, controlling timeouts, and adjusting viewport settings.
Properties
| Name | Meaning |
|---|---|
| URL | The web page URL to convert into a PDF. Must be a valid URL string. |
| PDF Options | Collection of PDF-specific settings: • Format: Page size, either A4 or Letter. • Landscape: Whether to use landscape orientation. • Print Background: Whether to include background graphics in the PDF. |
| Additional Options | Collection of additional PDF generation options: • Timeout (MS): Override request timeout in milliseconds; 0 uses server default. • Wait Until: When to consider navigation successful, options are Load, DOMContentLoaded, or Network Idle. |
Note: There are also general "Additional Options" related to screenshots and rendering, but for the PDF operation only the above PDF-specific options apply.
Output
The node outputs JSON data containing the generated PDF file encoded in binary form. The output typically includes:
- A binary property holding the PDF file data.
- Metadata about the PDF generation process may also be included.
This binary data can be used downstream in workflows to save the PDF to disk, upload it to cloud storage, or send it via email.
Dependencies
- Requires an active connection to the HeadlessX API service.
- Needs an API key credential configured in n8n for authentication with the HeadlessX API.
- The node relies on network access to fetch the specified URL and generate the PDF remotely.
Troubleshooting
- Timeouts: If the PDF generation takes too long, increase the "Timeout (MS)" option or check network connectivity.
- Invalid URL: Ensure the URL is correctly formatted and accessible from the HeadlessX service.
- Navigation Failures: If the page does not load properly, try changing the "Wait Until" option to a more appropriate event like
networkidle0. - API Errors: Authentication failures or quota limits will cause errors; verify API credentials and usage limits.
- Empty or Corrupt PDFs: May occur if the page content is dynamically loaded and not ready; use wait selectors or increase wait times.
Links and References
- HeadlessX API Documentation (example link)
- n8n Documentation on Binary Data Handling
- PDF Generation Best Practices (using headless browsers)