Actions40
- AI Actions
- Business Actions
- Calculate Actions
- Code Actions
- Convert Actions
- Crypto Actions
- Generate Actions
- Operator Actions
- PDF Actions
- Storage Actions
PDF → HTML to PDF
AI-generatedOverview
This node converts HTML content into a PDF file. It supports two input modes: you can either provide a URL to an existing web page or supply raw HTML code directly. The node is useful for automating the generation of PDFs from dynamic web content, reports, invoices, or any HTML-based document. For example, you could use it to archive web pages as PDFs, generate printable receipts from form submissions, or create downloadable reports from custom HTML templates.
Properties
| Name | Meaning |
|---|---|
| URL or HTML Code | Choose whether to convert a web page by its URL or by providing raw HTML code. Options: URL, HTML. Required. |
| URL | The web address of the page to convert to PDF. Required if "URL or HTML Code" is set to URL. |
| HTML Code | The raw HTML markup to convert to PDF. Required if "URL or HTML Code" is set to HTML. |
| Options | Additional PDF settings: - PDF Format: Paper size (A0, A1, A2, A3, A4, A5, A6, Ledger, Legal, Letter, Tabloid). Defaults to Letter. - Scale: Scale factor (0.1–2). - Landscape: Use landscape mode. - Print Background Graphics: Include background graphics in the PDF. |
| Get File as URL | If enabled, returns a URL to download the generated PDF instead of embedding the file directly in the output. Required. |
Output
- If Get File as URL is enabled:
- The output JSON will contain a field with the URL where the generated PDF can be downloaded.
- If Get File as URL is disabled:
- The output JSON will include the PDF file as binary data (typically in a property such as
dataor similar).
- The output JSON will include the PDF file as binary data (typically in a property such as
The exact structure may look like:
{
"url": "https://example.com/generated.pdf"
}
or, for binary output:
{
"data": "<binary PDF data>"
}
Dependencies
- Requires valid credentials for the
codeKitApi. - No additional n8n configuration is needed beyond setting up the API credentials.
Troubleshooting
- Invalid URL or HTML: If the provided URL is unreachable or the HTML code is malformed, the node may return an error or an empty/invalid PDF.
- Missing Required Fields: If required properties are not set (e.g., missing URL when "URL or HTML Code" is set to URL), the node will throw an error indicating which parameter is missing.
- API Errors: If the underlying service is unavailable or credentials are incorrect, errors such as "Request failed with status code 401" or "Service unavailable" may occur. Check your API credentials and service status.
- Large HTML Content: Very large HTML documents may result in timeouts or memory issues.