Utility

HTML PDF

Category
File Conversion
Node Type
Output Node

Overview

The HTML to PDF Node converts HTML content into a downloadable PDF file. It allows you to design and format professional-looking documents such as reports, invoices, articles, or certificates using HTML and CSS, and then automatically generate a PDF file.

Description

Convert HTML to PDF.

The HTML to PDF Node is used to transform structured HTML content into a PDF document. You can either manually write your HTML or let AI generate a template.

Report Generation

Create data-rich reports from workflow outputs.

Invoices & Docs

Generate professional invoices and certificates.

Once executed, the node returns a file URL to the generated PDF, which can be downloaded or used in subsequent workflow steps such as "Send Mail" or "Upload File".

Input Parameters

The node accepts the following inputs:

htmlContentstringRequired
The complete HTML structure (including CSS) to convert.
Example
"<html><body><h1>Hello</h1></body></html>"
pdfSizestringOptional
Paper size (e.g., 'A4', 'Letter'). Default is 'A4'.
Example
"A4"
aiTemplateDescriptionstringOptional
Prompt for AI to generate the HTML template.
Example
"Invoice for services rendered..."

Output Parameters

After successful execution, the node returns:

fileUrlstringOptional
Secure URL to access or download the PDF.
Example
"https://storage.com/pdfs/doc.pdf"
fileIdstringOptional
Unique identifier for the generated file.
Example
"12345-abcde"
pdfSizestringOptional
The paper size used.
Example
"A4"
generatedAtstringOptional
Timestamp of creation.
Example
"2025-10-29T11:30:43.241Z"

Output Type

Output Type: File Object

The node outputs a file object including metadata and a downloadable link.

Example Usage

Example 1: Simple Article Conversion

Convert basic HTML to PDF.

{  "htmlContent": "<html><body><h1>My First PDF</h1><p>Generated from HTML.</p></body></html>",  "pdfSize": "A4"}
{  "fileUrl": "https://example-storage.com/pdfs/my-first-pdf.pdf",  "fileId": "12345-abcde",  "pdfSize": "A4",  "generatedAt": "2025-10-29T11:30:43.241Z"}

Example 2: Styled Template

Convert styled HTML with CSS.

{  "htmlContent": "<!DOCTYPE html><html><head><style>h1{color:blue;}</style></head><body><h1>Invoice</h1></body></html>",  "pdfSize": "A4"}
{  "fileUrl": "https://storage.com/pdfs/invoice.pdf",  "fileId": "8ecc2a09-...",  "pdfSize": "A4"}

How to Use in a No-Code Workflow

1

Add the Node

Add the HTML to PDF node to your workflow.

2

Provide HTML

Write or paste your HTML code in the editor, or use variables to inject data.

3

Set Size

Choose the PDF Size (e.g., A4).

4

Use Output

Connect the fileUrl output to a Send Mail node to email the PDF.

Best Practices

  • Keep HTML simple and structured.
  • Use inline CSS or <style> blocks.
  • Preview HTML before generating.

Do / Don’t

Do
  • ✔️ Use variables to make templates dynamic.
  • ✔️ Use standard fonts for better compatibility.
  • ✔️ Test with different screen sizes in mind.
Don’t
  • ❌ Don’t use external image URLs unless public.
  • ❌ Don’t use complex JavaScript (it won't execute).
  • ❌ Don’t create extremely large HTML pages (performance issues).

Common Errors

Invalid HTMLErrorOptional
Unclosed tags or malformed CSS.
Unsupported Fonts/ImagesWarningOptional
External resources failed to load.

Example Workflow Integration

Use Case: Send Invoice

Generate and email an invoice.

  1. Fetch Data: Get order details from DB.
  2. HTML to PDF: Generate invoice using order data.
  3. Send Mail: Attach the PDF and send to customer.

Workflow Data Flow:

{{db.orderId}} →  {{htmlToPdf.htmlContent}}
{{htmlToPdf.fileUrl}} →  {{sendMail.attachment}}