n8n-nodes-pdfkraft 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# n8n-nodes-pdfkraft
|
|
2
|
+
|
|
3
|
+
An n8n community node for [PDFKraft](https://pdfkraft.com) — generate PDFs and images from templates using your n8n workflows.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
In your n8n instance, go to **Settings → Community Nodes → Install** and enter:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
n8n-nodes-pdfkraft
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Credentials
|
|
14
|
+
|
|
15
|
+
After installation, create a **PDFKraft API** credential:
|
|
16
|
+
|
|
17
|
+
1. Go to [pdfkraft.com/dashboard/account](https://pdfkraft.com/dashboard/account) and copy your API key.
|
|
18
|
+
2. In n8n, go to **Credentials → New → PDFKraft API**.
|
|
19
|
+
3. Paste your API key. Leave the Base URL as `https://api.pdfkraft.com/api/v1`.
|
|
20
|
+
|
|
21
|
+
## PDFKraft Node
|
|
22
|
+
|
|
23
|
+
Provides six operations:
|
|
24
|
+
|
|
25
|
+
### Generate Document
|
|
26
|
+
Queues a document for generation and returns immediately with a document ID. Use this when you want to fire-and-forget and handle completion via a webhook trigger.
|
|
27
|
+
|
|
28
|
+
**Inputs:** Template, Payload (JSON), Filename (optional)
|
|
29
|
+
**Output:** `{ id, status: "pending", ... }`
|
|
30
|
+
|
|
31
|
+
### Generate Document and Wait
|
|
32
|
+
Generates a document and polls until complete. Returns the final document record including `download_url`.
|
|
33
|
+
|
|
34
|
+
**Inputs:** Template, Payload (JSON), Filename, Timeout (seconds)
|
|
35
|
+
**Output:** `{ id, status: "success", download_url, filename, ... }`
|
|
36
|
+
|
|
37
|
+
### Generate Document and Download
|
|
38
|
+
The most common operation. Generates a document, waits for completion, and downloads the file — all in one step.
|
|
39
|
+
|
|
40
|
+
**Inputs:** Template, Payload (JSON), Filename, Timeout, Output Field Name
|
|
41
|
+
**Output:** JSON (`id`, `filename`, `download_url`) + Binary file in the configured output field
|
|
42
|
+
|
|
43
|
+
### Get Document
|
|
44
|
+
Fetches the current status and metadata of any document by ID.
|
|
45
|
+
|
|
46
|
+
**Inputs:** Document ID
|
|
47
|
+
**Output:** Full document record
|
|
48
|
+
|
|
49
|
+
### Download Document
|
|
50
|
+
Downloads a completed document as binary data.
|
|
51
|
+
|
|
52
|
+
**Inputs:** Document ID, Output Field Name
|
|
53
|
+
**Output:** JSON (`documentId`, `filename`, `download_url`) + Binary file
|
|
54
|
+
|
|
55
|
+
### List Documents
|
|
56
|
+
Returns generated documents with optional status filtering and pagination.
|
|
57
|
+
|
|
58
|
+
**Inputs:** Status Filter (All / Success / Pending / Failure), Limit or Return All
|
|
59
|
+
**Output:** One item per document
|
|
60
|
+
|
|
61
|
+
### List Templates
|
|
62
|
+
Returns all templates in your account.
|
|
63
|
+
|
|
64
|
+
**Output:** One item per template
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### Template Variables helper
|
|
69
|
+
|
|
70
|
+
When you select a template, open the **Template Variables** dropdown to see what variables that template expects, along with their sample values. This is a read-only reference — it does not affect the generated document.
|
|
71
|
+
|
|
72
|
+
To define sample data for your templates, open the template editor in PDFKraft and fill in the **Sample Data** section.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## PDFKraft Trigger Node
|
|
77
|
+
|
|
78
|
+
Listens for webhook events from PDFKraft and triggers your workflow when documents are generated.
|
|
79
|
+
|
|
80
|
+
### Setup
|
|
81
|
+
|
|
82
|
+
1. In PDFKraft, go to **Settings → Webhooks → Create Endpoint**.
|
|
83
|
+
2. Set the URL to the webhook URL shown in your n8n trigger node.
|
|
84
|
+
3. Copy the **Secret** shown after creation.
|
|
85
|
+
4. In n8n, paste the secret into the **Webhook Secret** field.
|
|
86
|
+
|
|
87
|
+
### Options
|
|
88
|
+
|
|
89
|
+
| Field | Description |
|
|
90
|
+
|---|---|
|
|
91
|
+
| Webhook Secret | The secret from your PDFKraft webhook endpoint. Used to verify request authenticity. |
|
|
92
|
+
| Verify Signature | Recommended. Rejects requests that don't have a valid HMAC signature. |
|
|
93
|
+
| Event Types | Choose Document Succeeded, Document Failed, or both. |
|
|
94
|
+
| Template Filter | Only fire for documents from a specific template. Select "All Templates" to receive all events. |
|
|
95
|
+
|
|
96
|
+
### Output
|
|
97
|
+
|
|
98
|
+
The trigger outputs the full webhook payload:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"event": "document.success",
|
|
103
|
+
"document": {
|
|
104
|
+
"id": "...",
|
|
105
|
+
"status": "success",
|
|
106
|
+
"filename": "invoice-1234.pdf",
|
|
107
|
+
"download_url": "https://...",
|
|
108
|
+
"document_template_identifier": "invoice",
|
|
109
|
+
"meta": {},
|
|
110
|
+
"generated_at": "2026-06-22T10:00:00.000Z"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Example Workflow
|
|
116
|
+
|
|
117
|
+
**Generate an invoice PDF and save it to Google Drive:**
|
|
118
|
+
|
|
119
|
+
1. **HTTP Request** (or any trigger) → provides order data
|
|
120
|
+
2. **PDFKraft** → Generate Document and Download
|
|
121
|
+
- Template: `Invoice [PDF]`
|
|
122
|
+
- Payload: `{ "order_id": "{{ $json.id }}", "customer_name": "{{ $json.customer }}", "total": "{{ $json.total }}" }`
|
|
123
|
+
- Filename: `invoice-{{order_id}}.pdf`
|
|
124
|
+
3. **Google Drive** → Upload File
|
|
125
|
+
- File Name: `{{ $json.filename }}`
|
|
126
|
+
- Binary Property: `data`
|
|
127
|
+
|
|
128
|
+
## Resources
|
|
129
|
+
|
|
130
|
+
- [PDFKraft](https://pdfkraft.com)
|
|
131
|
+
- [n8n Community Nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
@@ -254,14 +254,14 @@ class PDFKraft {
|
|
|
254
254
|
const apiKey = credentials.apiKey;
|
|
255
255
|
const response = await this.helpers.request({
|
|
256
256
|
method: 'GET',
|
|
257
|
-
url: `${baseUrl}/
|
|
257
|
+
url: `${baseUrl}/document_templates/${templateId}`,
|
|
258
258
|
headers: { Authorization: `Bearer ${apiKey}` },
|
|
259
259
|
json: true,
|
|
260
260
|
});
|
|
261
|
-
const sampleData = response.sample_data ?? {};
|
|
261
|
+
const sampleData = response.sample_data ?? response.sample_data_draft ?? {};
|
|
262
262
|
const entries = Object.entries(sampleData);
|
|
263
263
|
if (entries.length === 0) {
|
|
264
|
-
return [{ name: '(No sample data defined
|
|
264
|
+
return [{ name: '(No sample data defined — add it in the template editor under Sample Data)', value: '' }];
|
|
265
265
|
}
|
|
266
266
|
return entries.map(([key, value]) => ({
|
|
267
267
|
name: key,
|
|
@@ -63,8 +63,6 @@ class PDFKraftTrigger {
|
|
|
63
63
|
typeOptions: { loadOptionsMethod: 'getTemplates' },
|
|
64
64
|
default: '*',
|
|
65
65
|
description: 'Only trigger for documents generated from this template. Select "All Templates" to receive events from every template.',
|
|
66
|
-
// We inject "All Templates" as the first option so there is always a valid fallback
|
|
67
|
-
options: [{ name: 'All Templates', value: '*' }],
|
|
68
66
|
},
|
|
69
67
|
],
|
|
70
68
|
};
|
package/package.json
CHANGED