Skip to main content

๐Ÿ› ๏ธ Create PDF from HTML with Gotenberg

Workflow preview

Workflow preview
100%
๐Ÿ› ๏ธ Create PDF from HTML with Gotenberg preview
Open on n8n.io

Important notice

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

1. Workflow Overview

How it works This workflow converts an HTML string into a polished PDF file using the powerful open source Gotenberg service. It's designed to be a reusable utility in you...

Best for

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

Tools used

n8n-nodes-base.converttofile, n8n-nodes-base.httprequest, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.stickynote

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
๐Ÿ› ๏ธ Create PDF from HTML with Gotenberg
Workflow name
๐Ÿ› ๏ธ Create PDF from HTML with Gotenberg

How it works

This workflow converts an HTML string into a polished PDF file using the powerful open-source Gotenberg service. It's designed to be a reusable utility in your automation stack.

  1. Receives Input: The workflow is triggered with a JSON object containing the full html code as a string and a desired file_name for the output.
  2. Prepares File: It converts the incoming HTML string into a binary index.html file, which is required for the API call.
  3. Calls Gotenberg API: It sends the HTML file to a running Gotenberg instance via an HTTP request. It also dynamically sets the output filename and embeds metadata (like Author, Title, and Creation Date) directly into the PDF.
  4. Returns PDF: The workflow outputs the final binary PDF file, ready to be saved, sent in an email, or used in the next step of your main workflow.

Set up steps

Setup time: ~3 minutes

This workflow has one critical prerequisite: a running Gotenberg instance that your n8n can connect to.

1. Prerequisite: Run Gotenberg

You need to have the Gotenberg service running. The easiest way is with Docker. Add the following service to your docker-compose.yml file (the same one you use for n8n):

services:
  # ... your n8n service ...

  gotenberg:
    image: gotenberg/gotenberg:8
    restart: always

Then, restart your stack with docker compose up -d. This makes Gotenberg available at the address http://gotenberg:3000 from within your n8n container.

2. Use as a Sub-Workflow

This workflow is ready to be used as a sub-workflow.

  1. In your main workflow, add an Execute Sub-Workflow node.
  2. In the Workflow parameter, select this "Create PDF from HTML" workflow.
  3. Provide the input data in the required format: a JSON object with html and file_name keys.

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 - Create index.html

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

Block 2 - Convert to PDF with Gotenberg

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 3 - Create PDF from HTML

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

Block 4 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow ๐Ÿ› ๏ธ Create PDF from HTML with Gotenberg
Complexity intermediate
Nodes 6
Categories Document Extraction
Author Lucas Peyrin
Published 23 Jun 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5149/5149.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 ๐Ÿ› ๏ธ Create PDF from HTML with Gotenberg do?

How it works This workflow converts an HTML string into a polished PDF file using the powerful open source Gotenberg service. It's designed to be a reusable utility in you...

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.