Generate PDFs from Webhooks with CustomJS in n8n

Automate converting HTML content to PDFs triggered by webhooks with n8n and CustomJS. This workflow saves time by instantly generating PDF files from HTML input via a webhook, simplifying document creation in web apps or APIs.
webhook
html2Pdf
respondToWebhook
Workflow Identifier: 1861
NODES in Use: Webhook, HTML to PDF, Respond to Webhook
Automate PDFs with n8n and CustomJS

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow converts HTML content into a PDF file automatically using n8n and CustomJS nodes.
It solves the problem of slow, manual PDF creation by making it fast and automatic.
Users send HTML to a webhook, and get a PDF file back instantly.


Who should use this workflow

People or developers who need to create PDFs from HTML often.
Anyone who wants to avoid manually copying and converting reports or writing complex server scripts.
Great for web apps that want instant PDF generation on demand.


Tools and services used

  • n8n: Automation platform to build and run workflows.
  • CustomJS HTML to PDF node: Converts HTML into a PDF document.
  • Webhook node: Listens for incoming HTML data.
  • Respond to Webhook node: Sends back the generated PDF file.

Inputs, processing steps, and outputs

Inputs

  • HTML content sent by the user to the webhook as POST data.

Processing steps

  • Webhook node receives the HTML data.
  • HTML to PDF node converts the HTML into PDF binary data.
  • Respond to Webhook node sends the PDF file as a binary response back.

Output

The user or system receives a ready-to-use PDF file matching the HTML input.


Beginner step-by-step: How to use this workflow in n8n production

Step 1. Import the workflow

  1. Download the workflow file from this page.
  2. Inside the n8n editor, click Import from File and select the downloaded file.

Step 2. Configure credentials

  1. Find the HTML to PDF node and add your CustomJS API Key under credentials.

Step 3. Adjust settings if needed

  1. Change the webhook Path to something unique and easy to remember.
  2. If any IDs, emails, or folder info are in the workflow, update them.

Step 4. Test the workflow

  1. Activate the workflow using the toggle on top right.
  2. Send a test POST request to the webhook URL with some HTML content.
  3. Check if the PDF file is returned correctly.

Step 5. Activate for production

  1. Keep the workflow active to run automatically on new webhook calls.

Now the webhook can be called by web apps or other tools to get PDF files from HTML without coding.

If hosting or privacy is a concern, consider self-host n8n for full control.


Customization ideas

  • Change the webhook to accept varied HTML from different sources.
  • Add CSS styles inside the HTML for branding or layout.
  • Attach storage nodes to save PDFs automatically to cloud drives.
  • Use logic nodes to return either PDF or HTML based on request data.

Common failures and fixes

  • No PDF or empty file: Check webhook settings have responseMode as responseNode and connections are complete.
  • PDF has bad formatting: Make sure HTML is valid and CSS is inline if needed.
  • Workflow not responding: Confirm workflow is active before testing.
  • API errors: Verify CustomJS credentials are correct and valid.

Summary of results

✓ Save time by automating PDF creation from HTML.
✓ Get instant PDF files sent back via webhook.
✓ Remove the need for manual downloads or server coding.
✓ Easily integrate with any web app or tool that can post HTML.


Automate PDFs with n8n and CustomJS

Visit through Desktop to Interact with the Workflow.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.