AutomationFlowsWeb Scraping › Convert HTML to PDF with Gotenberg

Convert HTML to PDF with Gotenberg

Original n8n title: 🛠️ Create PDF From HTML with Gotenberg

ByLucas Peyrin @lucaspeyrin on n8n.io

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. Receives Input: The workflow is triggered with a JSON object containing the full code as a string and…

Event trigger★★☆☆☆ complexity6 nodesHTTP RequestExecute Workflow Trigger
Web Scraping Trigger: Event Nodes: 6 Complexity: ★★☆☆☆ Added:

This workflow corresponds to n8n.io template #5149 — we link there as the canonical source.

This workflow follows the Execute Workflow Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "id": "f0636fec-85ad-47e8-ab43-9a313664be80",
      "name": "Create index.html",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        100,
        20
      ],
      "parameters": {
        "options": {
          "encoding": "utf8",
          "fileName": "index.html"
        },
        "operation": "toText",
        "sourceProperty": "html"
      },
      "typeVersion": 1.1
    },
    {
      "id": "efcaebc5-e2cc-4af5-a6f2-c75b58496dec",
      "name": "Convert to PDF with Gotenberg",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        320,
        20
      ],
      "parameters": {
        "url": "http://gotenberg:3000/forms/chromium/convert/html",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "form file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            },
            {
              "name": "scale",
              "value": "1"
            },
            {
              "name": "metadata",
              "value": "={\"Author\":\"IA2S\",\"Copyright\":\"IA2S\",\"CreateDate\":\"{{ $now.format('yyyy-MM-dd') }}\",\"Creator\":\"IA2S\",\"Keywords\":[],\"ModDate\":\"{{ $now.format('yyyy-MM-dd') }}\",\"PDFVersion\":1.7,\"Producer\":\"IA2S\",\"Subject\":\"PDF\",\"Title\":\"IA2S PDF\"}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Gotenberg-Output-Filename",
              "value": "={{ $('Create PDF from HTML').last().json.file_name }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "44f89be8-8516-4d8a-a1e4-959c020ca7ae",
      "name": "Create PDF from HTML",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -120,
        20
      ],
      "parameters": {
        "inputSource": "jsonExample",
        "jsonExample": "{\n  \"html\": \"<h1>Hello World</h1>\",\n  \"file_name\": \"my-report-2024\"\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "710d67d4-db4a-4943-9ff7-49af8101443a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -340
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 540,
        "content": "### \ud83d\ude80 GOTENBERG API CALL\n\nThis node sends the HTML file to your Gotenberg service for conversion.\n\n**IMPORTANT:**\nThe default URL is `http://gotenberg:3000`. This works if n8n and Gotenberg are on the same Docker network. **If your Gotenberg is hosted elsewhere, you must update the URL here.**\n\n**Customization:**\nYou can edit the PDF metadata (Author, Title, etc.) in the `metadata` field under Body Parameters."
      },
      "typeVersion": 1
    },
    {
      "id": "365e90ba-b4fa-42b1-9236-33b2f8fb1e76",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -340
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 540,
        "content": "### \u25b6\ufe0f INPUT & CONFIGURATION\n\nThis workflow requires an input with two fields:\n\n1.  `html`: A string containing the full HTML code to be converted.\n2.  `file_name`: The desired name for the output file (without the `.pdf` extension).\n\n**Example Input:**\n```json\n{\n  \"html\": \"<h1>Hello World</h1>\",\n  \"file_name\": \"my-report-2024\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "c8b440bc-fb02-4b77-89c7-62c2bb88d28e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -340
      ],
      "parameters": {
        "color": 3,
        "width": 440,
        "height": 280,
        "content": "### \ud83d\udc33 PREREQUISITE: GOTENBERG SERVICE\n\nTo use this workflow, you need a running Gotenberg instance.\n\nThe easiest way is to add this to your `docker-compose.yml` and restart your stack:\n\n```yaml\n  gotenberg:\n    image: gotenberg/gotenberg:8\n    restart: always"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Create index.html": {
      "main": [
        [
          {
            "node": "Convert to PDF with Gotenberg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create PDF from HTML": {
      "main": [
        [
          {
            "node": "Create index.html",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

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. Receives Input: The workflow is triggered with a JSON object containing the full code as a string and…

Source: https://n8n.io/workflows/5149/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

Workflow 3400. Uses httpRequest, executeWorkflowTrigger. Event-driven trigger; 8 nodes.

HTTP Request, Execute Workflow Trigger
Web Scraping

This workflow is perfect for automation builders, developers, and DevOps teams using n8n who want to send structured log messages to BetterStack Logs. Whether you're monitoring mission-critical workfl

HTTP Request, Execute Workflow Trigger
Web Scraping

Our KB Tool - Confluence KB is crafted to seamlessly integrate into the IT Ops AI SlackBot Workflow, enhancing the IT support process by enabling sophisticated search and response capabilities via Sla

Execute Workflow Trigger, HTTP Request
Web Scraping

twenty-sync. Uses executeWorkflowTrigger, httpRequest. Event-driven trigger; 6 nodes.

Execute Workflow Trigger, HTTP Request
Web Scraping

LFM Race. Uses httpRequest, executeWorkflowTrigger. Event-driven trigger; 6 nodes.

HTTP Request, Execute Workflow Trigger