{
  "name": "HTML to PDF with html-pdf.com",
  "nodes": [
    {
      "parameters": {
        "content": "## HTML to PDF (basic)\n1. **Set HTML** holds the HTML you want to print. Replace it with your own, or map it from an earlier node.\n2. **Convert HTML to PDF** POSTs it to html-pdf.com and returns the PDF as a binary file in the `data` field.\n3. Connect Gmail, Google Drive, S3 or *Respond to Webhook* after it.\n\n1 credit = 1 PDF page.",
        "height": 300,
        "width": 460
      },
      "id": "5506321f-8d7d-5237-a46d-3d52adb724d9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -80,
        -260
      ]
    },
    {
      "parameters": {
        "content": "## html-pdf.com credential\nCreate a **Header Auth** credential:\n- Name: `Authorization`\n- Value: `Bearer hp_live_...`\n\nFree key (100 pages, no card): https://html-pdf.com/login\nDocs: https://html-pdf.com/docs",
        "height": 300,
        "width": 340,
        "color": 5
      },
      "id": "ab3a872f-e213-5f8a-bd1f-67ac8de64f9c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        440,
        -260
      ]
    },
    {
      "parameters": {},
      "id": "0741f160-9eb1-5968-9b52-cfb1cb2ab716",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        100
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9527a744-4129-5bc0-bcf6-782f9d33c3ff",
              "name": "html",
              "value": "<html><head><style>body{font-family:sans-serif;margin:40px} h1{color:#111}</style></head><body><h1>Hello from n8n</h1><p>This PDF was generated by html-pdf.com.</p></body></html>",
              "type": "string"
            },
            {
              "id": "77df26e7-7dbf-59c6-8bb6-949033a1f049",
              "name": "filename",
              "value": "hello.pdf",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "979ca9ad-9c90-5ee1-a277-d076ee36c25a",
      "name": "Set HTML",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://html-pdf.com/v1/pdf",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ html: $json.html, format: 'A4', margin: '15mm', print_background: true, filename: $json.filename }) }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "data"
            }
          },
          "timeout": 60000
        }
      },
      "id": "6ae6d7be-6828-596e-89c2-1b7450828c22",
      "name": "Convert HTML to PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        460,
        100
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_WITH_YOUR_CREDENTIAL_ID",
          "name": "html-pdf.com API key"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set HTML": {
      "main": [
        [
          {
            "node": "Convert HTML to PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
