Actions80
- Add Attachment To PDF
- Add Barcode To PDF
- Add Form Fields To PDF
- Add HTML Header Footer
- Add Image Stamp To PDF
- Add Image Watermark To Image
- Add Margin To PDF
- Add Page Number To PDF
- Add Text Stamp To PDF
- Add Text Watermark To Image
- AI-Invoice Parser
- AI-Process Contract
- AI-Process HealthCard
- Classify Document
- Compress Image
- Compress PDF
- Convert HTML To PDF
- Convert Image Format
- Convert JSON To Excel
- Convert Markdown To PDF
- Convert PDF To Editable PDF Using OCR
- Convert PDF To Excel
- Convert PDF To PowerPoint
- Convert PDF To Word
- Convert To PDF
- Convert URL to PDF
- Convert VISIO
- Convert Word to PDF Form
- Create Images From PDF
- Create PDF/A
- Create Swiss QR Bill
- Crop Image
- Delete Blank Pages From PDF
- Delete Unwanted Pages From PDF
- Split PDF By Barcode
- Disable Tracking Changes In Word
- Enable Tracking Changes In Word
- Extract Attachment From PDF
- Extract Form Data From PDF
- Extract Pages From PDF
- Extract Resources
- Extract Table From PDF
- Extract Text By Expression
- Extract Text From Word
- Fill PDF Form
- Find And Replace Text
- Flip Image
- Flatten PDF
- Generate Barcode
- Generate Document Single
- Generate Documents Multiple
- Get Document From Pdf4me
- Get Image Metadata
- Get PDF Metadata
- Split PDF By Swiss QR
- Get Tracking Changes In Word
- Image Extract Text
- Linearize PDF
- Merge Multiple PDFs
- Overlay PDFs
- Parse Document
- Protect PDF
- Read Barcode From Image
- Read Barcode From PDF
- Read SwissQR Code
- Remove EXIF Tags From Image
- Repair PDF Document
- Replace Text With Image
- Replace Text With Image In Word
- Resize Image
- Rotate Document
- Rotate Image
- Rotate Image By EXIF Data
- Rotate PDF Page
- Sign PDF
- Split PDF By Text
- Split PDF Regular
- Unlock PDF
- Update Hyperlinks Annotation
- Upload File To PDF4me
Overview
The node converts HTML content into a PDF document. It supports multiple input formats for the HTML source, including binary data from previous nodes, base64-encoded strings, raw HTML code, or a URL pointing to an HTML file. Users can customize the output PDF's layout, page size, margins, scaling, and visual options such as printing background graphics and displaying headers/footers.
This node is beneficial in scenarios where automated generation of PDFs from dynamic or static HTML content is required, such as generating reports, invoices, or printable documents from web content or user input within an n8n workflow.
Example use cases:
- Convert a webpage (via URL) into a PDF report.
- Transform raw HTML code created dynamically into a downloadable PDF.
- Use binary HTML files from previous processing steps and convert them to PDFs with custom formatting.
Properties
| Name | Meaning |
|---|---|
| Input Data Type | Method to provide the HTML content: - Binary Data: Use HTML file from previous node (binary data) - Base64 String: Provide HTML content already encoded in base64 - HTML Code: Write raw HTML code manually - URL: Provide URL to HTML file to download and convert |
| Binary Property Name | Name of the binary property containing the HTML file (used only if Input Data Type is Binary Data) |
| Base64 HTML Content | The HTML content already encoded in base64 format (used only if Input Data Type is Base64 String) |
| HTML Code | Raw HTML code entered manually; will be converted automatically to base64 (used only if Input Data Type is HTML Code) |
| HTML URL | URL to the HTML file to convert (used only if Input Data Type is URL) |
| HTML File Name | Source HTML file name with .html extension |
| Index File Path | Optional index file path when the input file 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, 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) or not (false) |
| Display Header Footer | Boolean flag to display header and footer in the PDF (true) or not (false) |
| Output File Name | Desired filename for the generated PDF file |
| Binary Data Output Name | Custom name for the binary data field in the node's output |
Output
The node outputs the generated PDF as binary data under a configurable binary property name (default is data). The JSON output contains metadata about the operation and references the binary PDF file. The binary data represents the complete PDF document ready for saving, further processing, or sending.
Dependencies
- Requires access to an external service or library capable of converting HTML content to PDF format.
- No explicit API keys or credentials are mentioned in the provided code snippet, but the node likely depends on an underlying PDF conversion service integrated within the environment.
- Proper network access is needed if using the URL input option to fetch remote HTML files.
Troubleshooting
- Common issues:
- Invalid or inaccessible URL when using the URL input type may cause failures in downloading the HTML content.
- Incorrect base64 encoding or malformed HTML code can lead to conversion errors or corrupted PDFs.
- Specifying unsupported page formats or invalid margin values might result in unexpected PDF layouts.
- Error messages:
- Errors related to fetching the URL usually indicate network issues or incorrect URLs.
- Conversion errors often point to invalid input data or unsupported HTML features.
- Resolutions:
- Verify URLs are correct and accessible.
- Ensure base64 strings are properly encoded.
- Validate HTML code syntax before conversion.
- Use supported page sizes and margin units.
Links and References
- HTML to PDF conversion concepts
- CSS units for margins and layout
- PDF page sizes (see Appendix D for standard sizes)