Actions80
- Extract Text From Word
- Find And Replace Text
- Convert PDF To Editable PDF Using OCR
- Create Swiss QR Bill
- Split PDF By Barcode
- Split PDF By Swiss QR
- Split PDF By Text
- Split PDF Regular
- Create PDF/A
- Convert HTML To PDF
- Convert Markdown To PDF
- Upload File To PDF4me
- Add Attachment To PDF
- Add Barcode To PDF
- Add Form Fields To PDF
- Fill PDF Form
- Add HTML Header Footer
- Add Image Stamp To PDF
- Add Margin To PDF
- Add Page Number To PDF
- Add Text Stamp To PDF
- AI-Invoice Parser
- AI-Process HealthCard
- AI-Process Contract
- Generate Barcode
- Classify Document
- Parse Document
- Linearize PDF
- Flatten PDF
- Convert To PDF
- Json To Excel
- Convert PDF To Excel
- Convert PDF To Word
- Convert PDF To PowerPoint
- Convert VISIO
- Crop Image
- Delete Blank Pages From PDF
- Delete Unwanted Pages From PDF
- Extract Pages
- Merge Multiple PDFs
- Overlay PDFs
- Rotate Document
- Rotate Page
- Sign PDF
- URL to PDF
- Add Image Watermark To Image
- Add Text Watermark To Image
- Compress Image
- Convert Image Format
- Create Images From PDF
- Flip Image
- Get Image Metadata
- Image Extract Text
- Remove EXIF Tags From Image
- Replace Text With Image
- Replace Text With Image In Word
- Resize Image
- Rotate Image
- Rotate Image By EXIF Data
- Compress PDF
- Get PDF Metadata
- Repair PDF Document
- Get Document From Pdf4me
- Update Hyperlinks Annotation
- Protect Document
- Unlock PDF
- Disable Tracking Changes In Word
- Enable Tracking Changes In Word
- Generate Document Single
- Generate Documents Multiple
- Get Tracking Changes In Word
- Read Barcode From Image
- Read Barcode From PDF
- Read SwissQR Code
- Extract Form Data From PDF
- Extract Pages From PDF
- Extract Attachment From PDF
- Extract Text By Expression
- Extract Table From PDF
- Extract Resources
Overview
This node operation converts HTML content into a PDF document. It supports multiple input formats for the HTML source, including binary data from a previous node, base64-encoded HTML content, raw HTML code entered manually, or a URL pointing to an HTML file. The node allows customization of the output PDF's layout, page size, margins, scaling, and display options such as printing background graphics and showing headers/footers.
This operation is useful in scenarios where you need to generate PDF reports, invoices, or documents dynamically from HTML templates or web pages. For example, you can convert an HTML invoice template filled with customer data into a PDF file ready for distribution, or convert a webpage snapshot into a PDF for archiving.
Properties
| Name | Meaning |
|---|---|
| Input Data Type | Method to provide the HTML content: - Binary Data (HTML file from previous node) - Base64 String (HTML content already base64 encoded) - HTML Code (raw HTML code entered manually) - URL (link to HTML file) |
| Binary Property Name | Name of the binary property containing the HTML file (used when Input Data Type is Binary Data) |
| Base64 HTML Content | Base64-encoded HTML content string (used when Input Data Type is Base64 String) |
| HTML Code | Raw HTML code entered manually; will be converted automatically to base64 (used when Input Data Type is HTML Code) |
| HTML URL | URL to the HTML file to download and convert (used when Input Data Type is URL) |
| HTML File Name | Source HTML file name with .html extension |
| Index File Path | Optional index file path required if the input is a ZIP archive |
| Layout | Orientation of the output PDF: - Portrait (vertical) - Landscape (horizontal) |
| Format | Page size of the PDF, e.g., A4, A3, Legal, Tabloid, etc. |
| Scale | Scaling factor for the content within the PDF, ranging from 0 to 0.8 |
| Top Margin | Top margin spacing (e.g., "40px", "2cm", "1in") |
| Bottom Margin | Bottom margin spacing |
| Left Margin | Left margin spacing |
| Right Margin | Right margin spacing |
| Print Background | Boolean flag to include background graphics in the PDF (true to print backgrounds, false otherwise) |
| Display Header Footer | Boolean flag to show header and footer in the PDF (true to display, false to hide) |
| Output File Name | Desired filename for the generated PDF file (default: "output.pdf") |
Output
The node outputs the generated PDF file as binary data attached to the output item. The main output field is a JSON object that includes the binary property containing the PDF file data. This binary data can be used downstream in workflows for saving to disk, sending via email, or uploading to cloud storage.
If configured, the output file name is set according to the "Output File Name" property.
Dependencies
- Requires access to an external service or library capable of converting HTML content to PDF format.
- May require network access if the input type is URL to fetch the HTML content.
- No explicit API keys or credentials are indicated in the provided code snippet, but the underlying conversion service might require authentication configured elsewhere in n8n.
Troubleshooting
- Common issues:
- Invalid or inaccessible URL when using URL input type may cause download failures.
- Incorrect base64 encoding or malformed HTML code can lead to conversion errors.
- Specifying unsupported page formats or invalid margin values might cause unexpected PDF layouts.
- Error messages:
- Errors related to fetching the HTML content (e.g., network errors) should be checked by verifying the URL and network connectivity.
- Conversion errors often indicate problems with the input HTML content or unsupported features in the HTML.
- To resolve issues, verify input data correctness, ensure URLs are reachable, and check margin and scale values are within allowed ranges.