過去幾天我一直在開發一個自動化流程,用來撰寫和傳送完整報價單。使用「HTML 轉 PDF」節點時運作正常,我能夠傳送包含原始未格式化資料的 PDF。但當我嘗試將資料格式化到模板中時,PDF 顯示為空白。我是否遺漏了什麼?{
“name”: “Quotebot Test”,
“nodes”: [
{
“parameters”: {
“formTitle”: “Get a Quote for a Function”,
“formDescription”: “Hey there!\n\nMy name’s Quotebot, your friendly quoting assistant for every function you need.\n\nJust answer the questions below, and we’ll get back to you ASAP”,
“formFields”: {
“values”: [
{
“fieldLabel”: “What function are you hosting?”
},
{
“fieldLabel”: “How many people are expected to attend?”,
“fieldType”: “number”
},
{
“fieldLabel”: “Do any guests have Dietary Requirements?”
},
{
“fieldLabel”: “When will your function be held?”,
“fieldType”: “date”
},
{
“fieldLabel”: “What’s your name?”
},
{
“fieldLabel”: “What’s your email address?”,
“fieldType”: “email”
},
{
“fieldLabel”: “What is the event name?”
},
{
“fieldLabel”: “What is the venue address?”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.formTrigger”,
“typeVersion”: 2.5,
“position”: [
0,
0
],
“id”: “3952eda3-7161-4e51-8a7b-4d6b8de4f5fe”,
“name”: “On form submission”,
“webhookId”: “b1d72ee1-c693-4b12-90ef-c7329ba90676”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “=Hi There\n\nCould you please write a full quote for {{ $(“Edit Fields”).item.json[“What’s your name?”] }} and send it to {{ $(“Edit Fields”).item.json[“What’s your email address?”] }}?\n\nClient Details:\n- Function Type: {{ $(“Edit Fields”).item.json[“What function are you hosting?”] }}\n- Expected Attendees: {{ $(“Edit Fields”).item.json[“How many people are expected to attend?”] }}\n- Dietary Requirements: {{ $(“Edit Fields”).item.json[“Do any guests have Dietary Requirements?”] }}\n- Function Date: {{ $(“Edit Fields”).item.json[“When will your function be held?”] }}\n- Event Name: {{ $json[‘What is the event name?’] }}\n- Venue Address {{ $json[‘What is the venue address?’] }}\n\n”,
“options”: {
“systemMessage”: “=You are a Catering Business Quoting Expert.\n\nYou’re given access to an MCP Client Server\n\nI need you to use it to create a Quote for a client and send it to them as an email \n\n{{ $today }}”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 3.1,
“position”: [
448,
0
],
“id”: “c1cfee0f-7beb-4fa8-8cf5-703179d8f18e”,
“name”: “AI Agent”,
“alwaysOutputData”: true,
“onError”: “continueRegularOutput”
},
{
“parameters”: {
“modelName”: “models/gemini-2.5-flash-lite”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatGoogleGemini”,
“typeVersion”: 1.1,
“position”: [
464,
224
],
“id”: “ec607c7c-91eb-4efc-b662-ddb1cb712638”,
“name”: “Google Gemini Chat Model”,
“credentials”: {
“googlePalmApi”: {
“id”: “r5K1AFY1c2dmiqsE”,
“name”: “Google Gemini(PaLM) Api account”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “1fb0c0f2-eff7-4900-9ca9-15950c133260”,
“name”: “What function are you hosting?”,
“value”: “={{ $json[“What function are you hosting?”] }}”,
“type”: “string”
},
{
“id”: “c4171ed1-c773-4dec-9126-57d400eb9bbd”,
“name”: “How many people are expected to attend?”,
“value”: “={{ $json[“How many people are expected to attend?”] }}”,
“type”: “number”
},
{
“id”: “feeaa131-f6c7-47d0-b16a-a107e56c5d8d”,
“name”: “Do any guests have Dietary Requirements?”,
“value”: “={{ $json[“Do any guests have Dietary Requirements?”] }}”,
“type”: “string”
},
{
“id”: “c5318dd3-dbcc-4a18-ab72-90c2eda07fb2”,
“name”: “When will your function be held?”,
“value”: “={{ $json[“When will your function be held?”] }}”,
“type”: “string”
},
{
“id”: “754d4f71-338b-4b3e-ba87-c66852b76799”,
“name”: “What’s your name?”,
“value”: “={{ $json[“What’s your name?”] }}”,
“type”: “string”
},
{
“id”: “5432c27a-958f-4f76-9fa0-3663ab7b8f19”,
“name”: “What’s your email address?”,
“value”: “={{ $json[“What’s your email address?”] }}”,
“type”: “string”
},
{
“id”: “3644948e-b74b-42fe-8456-0261a87e81a2”,
“name”: “What is the event name?”,
“value”: “={{ $json[‘What is the event name?’] }}”,
“type”: “string”
},
{
“id”: “19d462d9-c51e-421e-8e7e-f900742ffd99”,
“name”: “What is the venue address?”,
“value”: “={{ $json[‘What is the venue address?’] }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
224,
0
],
“id”: “280e82bc-5e96-462f-a6e6-1b098c4abb13”,
“name”: “Edit Fields”
},
{
“parameters”: {
“endpointUrl”: “https://timb.app.n8n.cloud/mcp/8d44ab8f-e11c-492a-9b68-b3fbafec81f5”,
“include”: “selected”,
“includeTools”: [
“furniture_Rentals”,
“Payment”,
“Additional_Service”,
“Pricing”,
“Menu_Drinks”,
“Staffing”,
“Venue_Logistics”,
“Ingredients”
],
“options”: {}
},
“id”: “a3b8b192-853d-41cd-9b2b-25042b97fcd1”,
“name”: “MCP Client Tool”,
“type”: “@n8n/n8n-nodes-langchain.mcpClientTool”,
“typeVersion”: 1.3,
“position”: [
592,
224
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “acf6fc3f-89fd-4c14-865f-c9bb597e4b62”,
“name”: “output”,
“value”: “={{ $json.output }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
800,
0
],
“id”: “2986a9df-0a76-4555-9a3a-d17e31016a1f”,
“name”: “Edit Fields1”
},
{
“parameters”: {
“sendTo”: “barrtimm@gmail.com”,
“subject”: “Job’s wedding Quote”,
“emailType”: “text”,
“message”: “=Hey there here’s your quote”,
“options”: {
“appendAttribution”: false,
“attachmentsUi”: {
“attachmentsBinary”: [
{
“property”: “={{ $json.filename }}”
}
]
}
}
},
“type”: “n8n-nodes-base.gmail”,
“typeVersion”: 2.2,
“position”: [
1472,
0
],
“id”: “a1706ee8-ab20-49cd-a0f2-9e321f17de49”,
“name”: “Send a message”,
“webhookId”: “528a735e-f777-4a86-9115-82bab5906ab7”,
“credentials”: {
“gmailOAuth2”: {
“id”: “49vocCpyDoaHrQbO”,
“name”: “Gmail OAuth2 API”
}
}
},
{
“parameters”: {
“templateId”: {
“__rl”: true,
“value”: “1649628”,
“mode”: “list”,
“cachedResultName”: “Quote for Job Blob (ID: 1649628)”
},
“data”: “={} {{ $json.output }}”,
“documentOutput”: “file”,
“additionalFields”: {}
},
“type”: “@pdfgeneratorapi/n8n-nodes-pdf-generator-api.pdfGeneratorApi”,
“typeVersion”: 1,
“position”: [
1216,
0
],
“id”: “13fc3d18-3cad-4d2a-8c0d-e864700bde13”,
“name”: “Generate a PDF document”,
“credentials”: {
“pdfGeneratorApi”: {
“id”: “XUfVEGWx0Q45fr5L”,
“name”: “PDF Generator account”
}
}
},
{
“parameters”: {
“operation”: “html”,
“options”: {}
},
“type”: “n8n-nodes-base.convertToFile”,
“typeVersion”: 1.1,
“position”: [
1008,
0
],
“id”: “08cc2559-e2aa-48d0-b6b0-91926cceb952”,
“name”: “Convert to File”
}
],
“pinData”: {
“On form submission”: [
{
“json”: {
“What function are you hosting?”: “Wedding”,
“How many people are expected to attend?”: 69,
“Do any guests have Dietary Requirements?”: “Yes Sue - Shellfish Allergy”,
“When will your function be held?”: “2026-07-10”,
“What’s your name?”: “Job Blob”,
“What’s your email address?”: “barrtimm@gmail.com”,
“What is the event name?”: “Job and Skibidi’s Fantastic Wedding”,
“What is the venue address?”: “45 Bigham Road BF Idaho 90210”,
“submittedAt”: “2026-06-13T15:42:21.955+10:00”,
“formMode”: “test”
},
“pairedItem”: {
“item”: 0
}
}
]
},
“connections”: {
“On form submission”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Google Gemini Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Edit Fields1”,
“type”: “main”,
“index”: 0
}
]
]
},
“MCP Client Tool”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Edit Fields1”: {
“main”: [
[
{
“node”: “Convert to File”,
“type”: “main”,
“index”: 0
}
]
]
},
“Generate a PDF document”: {
“main”: [
[
{
“node”: “Send a message”,
“type”: “main”,
“index”: 0
}
]
]
},
“Convert to File”: {
“main”: [
[
{
“node”: “Generate a PDF document”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: true,
“settings”: {
“executionOrder”: “v1”,
“binaryMode”: “separate”,
“availableInMCP”: true
},
“versionId”: “97d94403-187f-4bb8-8379-7a4ea228a92d”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “845031bfdb8f607d8c7ae907fb5de28c6fb4d0a8d0cd06c1a605d7c42f4018a9”
},
“nodeGroups”: ,
“id”: “X1Nh0TGGqYWSVImo”,
“tags”:
}
你的 PDF 出現空白的原因是你在工作流程中混合了兩種不同的 PDF 生成方法。你試圖使用基於範本的方法(透過 PDF Generator API),但你卻提供了二進位檔案(透過「轉換為檔案」節點)並提供了無效的 JSON 資料。
以下是三個具體問題及其修復方法:
轉換為檔案節點會將你的文字轉換為二進位 HTML 檔案。但是,PDF Generator API 節點不會「轉換」現有檔案成為範本;它透過將 JSON 資料合併到預先定義的範本中來建立新檔案。
將 轉換為檔案放在 PDF 產生器之前,你會將輸入從 JSON 物件(API 需要的)變更為二進位物件,這會導致 API 無法找到填充範本所需的資料。
**修復:**刪除 轉換為檔案節點,並直接將 Edit Fields1 連接到 生成 PDF 文件。
- 在你的
生成 PDF 文件節點中,你將資料設定為:={} {{ $json.output }}
這不是有效的 JSON。PDF Generator API 需要一個 JSON 物件,其中鍵必須與你在 PDF Generator API 儀表板範本中建立的預留位置相符。
**修復:**將 data 欄位變更為正確的 JSON 物件。例如,如果你的範本有一個名為 {{quote_content}} 的預留位置,你的資料欄位應該看起來像這樣:
{
"quote_content": "{{ $json.output }}"
}
- 為了讓資料實際出現在 PDF 上,你在 n8n 中使用的鍵必須完全符合範本中的變數名稱(ID:1649628)。
- **如果你的範本是空白的:**表示 API 收到了請求,但在你的 JSON 中找不到任何與設計中的
{{variable}}標籤相符的鍵。 - **建議:**在 PDF Generator API 儀表板中檢查你的範本。如果你有像
{{client_name}}或{{total_price}}這樣的標籤,你必須在 JSON 中特別提供這些:
{
"client_name": "{{ $(\"Edit Fields\").item.json[\"What's your name?\"] }}",
"quote_content": "{{ $json.output }}"
}
在這個引用流程中,隔離空白 PDF 是範本資料還是渲染問題。在 PDF 節點之前,加入一個 Set/Edit Fields 節點,輸出只有一個微小物件,其鍵與一個範本預留位置相符,例如 eventName 和 guestCount,然後執行 PDF 節點。
如果單一欄位 PDF 呈現,範本沒問題,問題在於 AI 輸出形狀;在 PDF 節點之前,將代理輸出解析為具名 JSON 欄位。如果單一欄位測試仍是空白,下一個邊界是範本 ID 或預留位置名稱,而非 n8n 流程。
嘿 Kjooleng
感謝你的回覆。
我已經多次嘗試過你的步驟,但我仍然收到空白範本。我已經更新了範本中的變數以符合我的試算表,並將資料更新為有效的 JSON
我已經從使用 PDF Generator API 的引用範本切換到我建立的空白範本,希望能夠組織好資料。我知道我已經很接近了,但我只需要再做一個缺失的步驟就能讓它運作。
你有任何想法嗎
@Tim_Barrett ,你可以嘗試使用 PDF API Hub 中的節點,它允許你使用範本產生 PDF。
以下是已驗證的節點連結:

