{
  "name": "Generate branded invoice PDFs with Rendex and email them",
  "nodes": [
    {
      "parameters": {
        "content": "## 🧾 Invoice PDF generator — powered by Rendex\n\n**Who it's for:** anyone who needs to turn order data into a polished PDF invoice and send it automatically — no headless browser, no PDF library.\n\n**What it does:** takes order fields → renders a branded HTML invoice to a pixel-perfect **PDF** with the Rendex node → emails it as an attachment.\n\n**How it works:**\n1. A trigger provides the order data (here a Manual Trigger + sample **Order Data** — swap in Stripe, Google Sheets, a Webhook, your DB, etc.)\n2. The **Rendex** node renders the HTML invoice to a PDF (binary property `data`)\n3. **Send Email** attaches the PDF and sends it to the customer\n\n**How to use:**\n1. Install the community node `n8n-nodes-rendex` (Settings → Community Nodes)\n2. On the **Rendex** node, add your **Rendex API** credential — free key at rendex.dev\n3. On **Send Email**, add SMTP (or swap for Gmail / Google Drive / S3)\n4. Click **Test workflow**\n\n📚 Full docs: https://rendex.dev/docs/n8n",
        "height": 460,
        "width": 420
      },
      "id": "sticky-overview",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-360, 120]
    },
    {
      "parameters": {
        "content": "### 1 · Order source\nReplace this Manual Trigger + Order Data with your real source — a Stripe trigger, a new Google Sheets row, a Webhook, or a database query. Just make sure it outputs the same fields.",
        "height": 300,
        "width": 300,
        "color": 4
      },
      "id": "sticky-source",
      "name": "Order source note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [120, 120]
    },
    {
      "parameters": {},
      "id": "manual-trigger",
      "name": "When clicking Test",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [180, 320]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "a1", "name": "invoiceNumber", "value": "INV-1042", "type": "string" },
            { "id": "a2", "name": "customerName", "value": "Acme Corp", "type": "string" },
            { "id": "a3", "name": "customerEmail", "value": "billing@acme.example", "type": "string" },
            { "id": "a4", "name": "item", "value": "Rendex Pro — annual plan", "type": "string" },
            { "id": "a5", "name": "amount", "value": "$1,908.00", "type": "string" },
            { "id": "a6", "name": "issuedOn", "value": "2026-07-21", "type": "string" }
          ]
        },
        "options": {}
      },
      "id": "order-data",
      "name": "Order Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [380, 320]
    },
    {
      "parameters": {
        "content": "### 2 · Render the invoice → PDF\nThe **HTML** field is an n8n expression, so `{{ $json.field }}` values from the Order Data node are injected before rendering. Change **Format** to `png`/`jpeg` for an image instead. Tweak page size under **Additional Options → PDF Page Format**.",
        "height": 300,
        "width": 320,
        "color": 5
      },
      "id": "sticky-render",
      "name": "Render note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [620, 120]
    },
    {
      "parameters": {
        "resource": "screenshot",
        "operation": "capture",
        "source": "html",
        "html": "=<!doctype html>\n<html>\n  <body style=\"font-family: system-ui, -apple-system, sans-serif; margin: 0; padding: 56px; color: #1a1a1a\">\n    <div style=\"display:flex; justify-content:space-between; align-items:flex-start; border-bottom: 4px solid #ea580c; padding-bottom: 20px\">\n      <div>\n        <h1 style=\"margin:0; font-size: 30px; color:#ea580c\">INVOICE</h1>\n        <p style=\"margin:6px 0 0; color:#666\">{{ $json.invoiceNumber }}</p>\n      </div>\n      <div style=\"text-align:right; color:#666; font-size:13px\">\n        <strong style=\"color:#1a1a1a\">Your Company, Inc.</strong><br/>\n        hello@yourcompany.com<br/>\n        Issued {{ $json.issuedOn }}\n      </div>\n    </div>\n    <p style=\"margin-top:28px; color:#666\">Billed to</p>\n    <p style=\"margin:2px 0; font-size:18px; font-weight:600\">{{ $json.customerName }}</p>\n    <p style=\"margin:2px 0; color:#666\">{{ $json.customerEmail }}</p>\n    <table style=\"width:100%; border-collapse:collapse; margin-top:32px\">\n      <tr style=\"border-bottom:2px solid #ea580c; text-align:left\">\n        <th style=\"padding:10px 8px\">Description</th>\n        <th style=\"padding:10px 8px; text-align:right\">Amount</th>\n      </tr>\n      <tr style=\"border-bottom:1px solid #eee\">\n        <td style=\"padding:14px 8px\">{{ $json.item }}</td>\n        <td style=\"padding:14px 8px; text-align:right\">{{ $json.amount }}</td>\n      </tr>\n      <tr>\n        <td style=\"padding:14px 8px; text-align:right; font-weight:700\">Total</td>\n        <td style=\"padding:14px 8px; text-align:right; font-weight:700; color:#ea580c\">{{ $json.amount }}</td>\n      </tr>\n    </table>\n    <p style=\"margin-top:48px; color:#999; font-size:12px\">Thank you for your business. Rendered with Rendex.</p>\n  </body>\n</html>",
        "format": "pdf",
        "binaryPropertyName": "data",
        "additionalOptions": {
          "pdfFormat": "A4",
          "pdfPrintBackground": true
        }
      },
      "id": "rendex-invoice",
      "name": "Rendex — Render Invoice PDF",
      "type": "n8n-nodes-rendex.rendex",
      "typeVersion": 1,
      "position": [700, 320]
    },
    {
      "parameters": {
        "content": "### 3 · Deliver it\nAttaches the `data` binary (the PDF) and emails it. Prefer **Gmail**? Swap this for the Gmail node. Want to archive instead? Use **Google Drive** / **AWS S3** — both accept the same binary property.",
        "height": 300,
        "width": 300,
        "color": 3
      },
      "id": "sticky-deliver",
      "name": "Deliver note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [980, 120]
    },
    {
      "parameters": {
        "fromEmail": "billing@yourcompany.com",
        "toEmail": "={{ $json.customerEmail }}",
        "subject": "=Your invoice {{ $('Order Data').item().json.invoiceNumber }}",
        "emailFormat": "html",
        "html": "=<p>Hi {{ $('Order Data').item().json.customerName }},</p><p>Your invoice is attached as a PDF. Thanks!</p>",
        "options": {
          "attachments": "data"
        }
      },
      "id": "send-email",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [1040, 320]
    }
  ],
  "connections": {
    "When clicking Test": {
      "main": [[{ "node": "Order Data", "type": "main", "index": 0 }]]
    },
    "Order Data": {
      "main": [[{ "node": "Rendex — Render Invoice PDF", "type": "main", "index": 0 }]]
    },
    "Rendex — Render Invoice PDF": {
      "main": [[{ "node": "Send Email", "type": "main", "index": 0 }]]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "instanceId": ""
  }
}
