@custom-js/n8n-nodes-pdf-toolkit 1.39.0 → 1.41.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/dist/nodes/CompressPDF/CompressPDF.node.js +5 -7
- package/dist/nodes/ExtractPages/ExtractPages.node.js +5 -7
- package/dist/nodes/GetFormFieldNames/GetFormFieldNames.node.js +1 -1
- package/dist/nodes/Html2Docx/Html2Docx.node.js +5 -7
- package/dist/nodes/Html2Pdf/Html2Pdf.node.js +5 -7
- package/dist/nodes/InvoiceGenerator/InvoiceGenerator.node.js +6 -7
- package/dist/nodes/Markdown2Html/Markdown2Html.node.js +1 -1
- package/dist/nodes/MergePdfs/MergePdfs.node.js +5 -7
- package/dist/nodes/PdfFormFill/PdfFormFill.node.js +5 -7
- package/dist/nodes/PdfToPng/PdfToPng.node.js +5 -7
- package/dist/nodes/PdfToText/PdfToText.node.js +1 -1
- package/dist/nodes/SSLChecker/SSLChecker.node.js +1 -1
- package/dist/nodes/Scraper/Scraper.node.js +5 -7
- package/dist/nodes/WebsiteScreenshot/WebsiteScreenshot.node.js +5 -7
- package/package.json +1 -1
|
@@ -76,21 +76,19 @@ class CompressPDF {
|
|
|
76
76
|
headers: {
|
|
77
77
|
"customjs-origin": "n8n/compressPdf",
|
|
78
78
|
"x-api-key": credentials.apiKey,
|
|
79
|
-
"Content-Type": "application/json",
|
|
80
79
|
},
|
|
81
|
-
body:
|
|
80
|
+
body: {
|
|
82
81
|
input: isBinary ? { file: file } : { urls: field_name },
|
|
83
82
|
code: `
|
|
84
83
|
const { PDF_COMPRESS } = require('./utils');
|
|
85
84
|
input = input.file || input.urls;
|
|
86
85
|
return PDF_COMPRESS(input);`,
|
|
87
86
|
returnBinary: "true",
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
},
|
|
88
|
+
encoding: 'arraybuffer',
|
|
89
|
+
json: true,
|
|
91
90
|
};
|
|
92
|
-
const
|
|
93
|
-
const response = responseData.body;
|
|
91
|
+
const response = await this.helpers.httpRequest(options);
|
|
94
92
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
95
93
|
// No binary data returned; emit only JSON without a binary property
|
|
96
94
|
returnData.push({
|
|
@@ -84,9 +84,8 @@ class ExtractPages {
|
|
|
84
84
|
headers: {
|
|
85
85
|
"customjs-origin": "n8n/extractPages",
|
|
86
86
|
"x-api-key": credentials.apiKey,
|
|
87
|
-
"Content-Type": "application/json",
|
|
88
87
|
},
|
|
89
|
-
body:
|
|
88
|
+
body: {
|
|
90
89
|
input: isBinary
|
|
91
90
|
? { file: file, pageRange }
|
|
92
91
|
: { urls: field_name, pageRange },
|
|
@@ -95,12 +94,11 @@ class ExtractPages {
|
|
|
95
94
|
const pdfBuffer = input.file ? Buffer.from(input.file, 'base64') : input.urls;
|
|
96
95
|
return EXTRACT_PAGES_FROM_PDF(pdfBuffer, input.pageRange);`,
|
|
97
96
|
returnBinary: "true",
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
},
|
|
98
|
+
encoding: 'arraybuffer',
|
|
99
|
+
json: true,
|
|
101
100
|
};
|
|
102
|
-
const
|
|
103
|
-
const response = responseData.body;
|
|
101
|
+
const response = await this.helpers.httpRequest(options);
|
|
104
102
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
105
103
|
// No binary data returned; emit only JSON without a binary property
|
|
106
104
|
returnData.push({
|
|
@@ -48,18 +48,16 @@ class Html2Docx {
|
|
|
48
48
|
headers: {
|
|
49
49
|
"customjs-origin": "n8n/html2Docx",
|
|
50
50
|
"x-api-key": credentials.apiKey,
|
|
51
|
-
"Content-Type": "application/json",
|
|
52
51
|
},
|
|
53
|
-
body:
|
|
52
|
+
body: {
|
|
54
53
|
input: htmlInput,
|
|
55
54
|
code: "const { HTML2DOCX } = require('./utils'); return HTML2DOCX(input)",
|
|
56
55
|
returnBinary: "true",
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
},
|
|
57
|
+
encoding: 'arraybuffer',
|
|
58
|
+
json: true,
|
|
60
59
|
};
|
|
61
|
-
const
|
|
62
|
-
const response = responseData.body;
|
|
60
|
+
const response = await this.helpers.httpRequest(options);
|
|
63
61
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
64
62
|
// No binary data returned; emit only JSON without a binary property
|
|
65
63
|
returnData.push({
|
|
@@ -48,18 +48,16 @@ class Html2Pdf {
|
|
|
48
48
|
headers: {
|
|
49
49
|
"customjs-origin": "n8n/generatePDF",
|
|
50
50
|
"x-api-key": credentials.apiKey,
|
|
51
|
-
"Content-Type": "application/json",
|
|
52
51
|
},
|
|
53
|
-
body:
|
|
52
|
+
body: {
|
|
54
53
|
input: htmlInput,
|
|
55
54
|
code: "const { HTML2PDF } = require('./utils'); return HTML2PDF(input)",
|
|
56
55
|
returnBinary: "true",
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
},
|
|
57
|
+
encoding: 'arraybuffer',
|
|
58
|
+
json: true,
|
|
60
59
|
};
|
|
61
|
-
const
|
|
62
|
-
const response = responseData.body;
|
|
60
|
+
const response = await this.helpers.httpRequest(options);
|
|
63
61
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
64
62
|
// No binary data returned; emit only JSON without a binary property
|
|
65
63
|
returnData.push({
|
|
@@ -254,22 +254,21 @@ class InvoiceGenerator {
|
|
|
254
254
|
headers: {
|
|
255
255
|
'customjs-origin': 'n8n/invoice-generator',
|
|
256
256
|
'x-api-key': credentials.apiKey,
|
|
257
|
-
'Content-Type': 'application/json',
|
|
258
257
|
},
|
|
259
|
-
body:
|
|
258
|
+
body: {
|
|
260
259
|
input: invoiceData,
|
|
261
260
|
code: code,
|
|
262
261
|
returnBinary: 'true',
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
},
|
|
263
|
+
encoding: 'arraybuffer',
|
|
264
|
+
json: true,
|
|
266
265
|
};
|
|
267
|
-
const
|
|
268
|
-
const response = responseData.body;
|
|
266
|
+
const response = await this.helpers.httpRequest(options);
|
|
269
267
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
270
268
|
returnData.push({
|
|
271
269
|
json: items[i].json,
|
|
272
270
|
});
|
|
271
|
+
continue;
|
|
273
272
|
}
|
|
274
273
|
const binaryData = await this.helpers.prepareBinaryData(response, "Invoice.pdf");
|
|
275
274
|
returnData.push({
|
|
@@ -68,21 +68,19 @@ class MergePdfs {
|
|
|
68
68
|
headers: {
|
|
69
69
|
"customjs-origin": "n8n/mergePDFs",
|
|
70
70
|
"x-api-key": credentials.apiKey,
|
|
71
|
-
"Content-Type": "application/json",
|
|
72
71
|
},
|
|
73
|
-
body:
|
|
72
|
+
body: {
|
|
74
73
|
input: isBinary ? { files } : { urls },
|
|
75
74
|
code: `
|
|
76
75
|
const { PDF_MERGE } = require('./utils');
|
|
77
76
|
input = [...input.files || [],...input.urls || []].filter(i => i);
|
|
78
77
|
return PDF_MERGE(input);`,
|
|
79
78
|
returnBinary: "true",
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
},
|
|
80
|
+
encoding: 'arraybuffer',
|
|
81
|
+
json: true,
|
|
83
82
|
};
|
|
84
|
-
const
|
|
85
|
-
const response = responseData.body;
|
|
83
|
+
const response = await this.helpers.httpRequest(options);
|
|
86
84
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
87
85
|
// No binary data returned; emit only JSON without a binary property
|
|
88
86
|
returnData.push({
|
|
@@ -103,9 +103,8 @@ class PdfFormFill {
|
|
|
103
103
|
headers: {
|
|
104
104
|
"customjs-origin": "n8n/pdfFormFill",
|
|
105
105
|
"x-api-key": credentials.apiKey,
|
|
106
|
-
"Content-Type": "application/json",
|
|
107
106
|
},
|
|
108
|
-
body:
|
|
107
|
+
body: {
|
|
109
108
|
input: {
|
|
110
109
|
file: file,
|
|
111
110
|
// n8n fixedCollection with multipleValues returns an object like { field: [{ name, value }, ...] }
|
|
@@ -117,12 +116,11 @@ class PdfFormFill {
|
|
|
117
116
|
const fieldValues = Object.fromEntries((input.fields || []).map(x => [x.name, x.value]));
|
|
118
117
|
return PDF_FILL_FORM(pdfInput, fieldValues);`,
|
|
119
118
|
returnBinary: "true",
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
},
|
|
120
|
+
encoding: 'arraybuffer',
|
|
121
|
+
json: true,
|
|
123
122
|
};
|
|
124
|
-
const
|
|
125
|
-
const response = responseData.body;
|
|
123
|
+
const response = await this.helpers.httpRequest(options);
|
|
126
124
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
127
125
|
// No binary data returned; emit only JSON without a binary property
|
|
128
126
|
returnData.push({
|
|
@@ -76,21 +76,19 @@ class PdfToPng {
|
|
|
76
76
|
headers: {
|
|
77
77
|
"customjs-origin": "n8n/pdfToPng",
|
|
78
78
|
"x-api-key": credentials.apiKey,
|
|
79
|
-
"Content-Type": "application/json",
|
|
80
79
|
},
|
|
81
|
-
body:
|
|
80
|
+
body: {
|
|
82
81
|
input: isBinary ? { file: file } : { urls: field_name },
|
|
83
82
|
code: `
|
|
84
83
|
const { PDF2PNG } = require('./utils');
|
|
85
84
|
input = input.file || input.urls;
|
|
86
85
|
return PDF2PNG(input);`,
|
|
87
86
|
returnBinary: "true",
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
},
|
|
88
|
+
encoding: 'arraybuffer',
|
|
89
|
+
json: true,
|
|
91
90
|
};
|
|
92
|
-
const
|
|
93
|
-
const response = responseData.body;
|
|
91
|
+
const response = await this.helpers.httpRequest(options);
|
|
94
92
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
95
93
|
// No binary data returned; emit only JSON without a binary property
|
|
96
94
|
returnData.push({
|
|
@@ -137,20 +137,18 @@ class Scraper {
|
|
|
137
137
|
headers: {
|
|
138
138
|
"customjs-origin": "n8n/scraper",
|
|
139
139
|
"x-api-key": credentials.apiKey,
|
|
140
|
-
"Content-Type": "application/json",
|
|
141
140
|
},
|
|
142
|
-
body:
|
|
141
|
+
body: {
|
|
143
142
|
input: JSON.stringify(payload),
|
|
144
143
|
code: `const { SCRAPER } = require('./utils'); ` +
|
|
145
144
|
`const payload = input; ` +
|
|
146
145
|
`return SCRAPER(payload.url, payload.commands || [], "${returnValueType === "binary" ? "image" : "html"}", ${debug ? "true" : "false"});`,
|
|
147
146
|
returnBinary: returnValueType === "binary" ? "true" : "false",
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
},
|
|
148
|
+
encoding: (returnValueType === "binary" ? 'arraybuffer' : undefined),
|
|
149
|
+
json: true,
|
|
151
150
|
};
|
|
152
|
-
const
|
|
153
|
-
const response = returnValueType === "binary" ? responseData.body : responseData;
|
|
151
|
+
const response = await this.helpers.httpRequest(options);
|
|
154
152
|
if (returnValueType === "binary") {
|
|
155
153
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
156
154
|
// No binary data returned; emit only JSON without a binary property
|
|
@@ -45,18 +45,16 @@ class WebsiteScreenshot {
|
|
|
45
45
|
headers: {
|
|
46
46
|
"customjs-origin": "n8n/screenshot",
|
|
47
47
|
"x-api-key": credentials.apiKey,
|
|
48
|
-
"Content-Type": "application/json",
|
|
49
48
|
},
|
|
50
|
-
body:
|
|
49
|
+
body: {
|
|
51
50
|
input: urlInput,
|
|
52
51
|
code: "const { SCREENSHOT } = require('./utils'); return SCREENSHOT(input);",
|
|
53
52
|
returnBinary: "true",
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
},
|
|
54
|
+
encoding: 'arraybuffer',
|
|
55
|
+
json: true,
|
|
57
56
|
};
|
|
58
|
-
const
|
|
59
|
-
const response = responseData.body;
|
|
57
|
+
const response = await this.helpers.httpRequest(options);
|
|
60
58
|
if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
|
|
61
59
|
// No binary data returned; emit only JSON without a binary property
|
|
62
60
|
returnData.push({
|