Skip to main content

Convert HTML to PDF and return via webhook using CustomJS API

Workflow preview

Workflow preview
100%
Convert HTML to PDF and return via webhook using CustomJS API preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

! n8n Workflow: HTML to PDF Generator This n8n workflow converts HTML content into a styled PDF and returns it as a response via a webhook. The workflow receives HTML in...

Best for

  • Document Extraction automation workflows
  • beginner n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.respondtowebhook, @custom-js/n8n-nodes-pdf-toolkit.html2pdf

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by CustomJS.

Original n8n.io source

1.1 Workflow description

Title
Convert HTML to PDF and return via webhook using CustomJS API
Workflow name
Convert HTML to PDF and return via webhook using CustomJS API

!

n8n Workflow: HTML to PDF Generator

This n8n workflow converts HTML content into a styled PDF and returns it as a response via a webhook. The workflow receives HTML input, processes it using CustomJS's PDF toolkit, and sends back the resulting PDF to the original webhook requester.

@custom-js/n8n-nodes-pdf-toolkit

Features:

  • Webhook Trigger: Accepts incoming requests with HTML content.
  • HTML to PDF Conversion: Uses CustomJS to transform HTML into a PDF.
  • Response: Sends the generated PDF back to the webhook response.

Requirements:

  • Self-hosted n8n instance
  • A CustomJS API key for HTML to PDF conversion
  • HTML content to be converted into a PDF

Workflow Steps:

  1. Webhook Trigger:

    • Accepts incoming HTTP requests with HTML content.
    • This data is passed to the next node for processing.
  2. HTML to PDF Conversion:

    • Uses the CustomJS node to convert the incoming HTML into a PDF document.
    • You can customize the HTML content to match the design requirements.
  3. Respond to Webhook:

    • Sends the generated PDF as a binary response to the original webhook request.

Setup Guide:

1. Configure CustomJS API

  • Sign up at CustomJS.
  • Retrieve your API key from the profile page.
  • Add your API key as n8n credentials.

2. Design Workflow

  1. Create a Webhook:

    • Set up a webhook to trigger the workflow when HTML content is received.
  2. Prepare HTML Content:

    • The incoming request should include the HTML content you wish to convert into a PDF.
  3. Configure HTML to PDF Node:

    • Use the HTML to PDF node to convert the provided HTML into a PDF.
    • The node uses the HTML input to generate a PDF using the CustomJS API.
  4. Respond with the PDF:

    • The Respond to Webhook node will send the generated PDF back to the original requester as a binary response.

Example HTML Input:

<h1>Hello CustomJS!</h1>
<h2>CustomJS provides the missing toolset for your no-code projects</h2>

Result PDF

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2

Block 2 - Respond to Webhook

Type / Role
n8n-nodes-base.respondToWebhook - respondToWebhook
Config choices
Version 1.1

Block 3 - HTML to PDF

Type / Role
@custom-js/n8n-nodes-pdf-toolkit.html2Pdf - html2Pdf
Config choices
Version 1

3. Summary Table

Workflow Convert HTML to PDF and return via webhook using CustomJS API
Complexity beginner
Nodes 3
Categories Document Extraction
Author CustomJS
Published 26 Mar 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3331/3331.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Convert HTML to PDF and return via webhook using CustomJS API do?

! n8n Workflow: HTML to PDF Generator This n8n workflow converts HTML content into a styled PDF and returns it as a response via a webhook. The workflow receives HTML in...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.