Convert HTML to PDF and return via webhook using CustomJS API
!workflow.png! 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 ...
🔌 Nodes & Integrations Used (1)
📖 Implementation & Setup Guide
! # 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](@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:
- **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](https://www.customjs.space). - Retrieve your API key from the profile page. - Add your API key as n8n credentials.
2. Design Workflow
- **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:
```html <h1>Hello CustomJS!</h1> <h2>CustomJS provides the missing toolset for your no-code projects</h2> ```
Result PDF
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Convert_HTML_to_PDF_and_return_via_webhook_using_CustomJS_API.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related Docs, PDF & OCR Workflows
View All in Docs, PDF & OCR →Add articles to a Notion list by accessing a Discord slash comma
This workflow allows you to add articles to a Notion reading list by accessing a Discord slash command. Prerequisites - A Notion account and [credentials](),...
Adobe PDF Services API Automation
Production-ready n8n automation template for Adobe PDF Services API Automation built by AhiXLight. Seamlessly connects HTTP Request, Execute Workflow Trigger, Dropbox with 20 configured nodes.
Adobe PDF Services API Workflow
Production-ready n8n automation template for Adobe PDF Services API Workflow built by AhiXLight. Seamlessly connects HTTP Request, Execute Workflow Trigger, Dropbox with 20 configured nodes.
AI Brand Voice Content Generator
Production-ready n8n automation template for AI Brand Voice Content Generator built by AhiXLight. Seamlessly connects Lm Chat Open Ai, Information Extractor, HTTP Request with 27 configured nodes.