@custom-js/n8n-nodes-pdf-toolkit 1.24.0 → 1.25.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.
|
@@ -52,8 +52,8 @@ class PdfFormFill {
|
|
|
52
52
|
default: {},
|
|
53
53
|
options: [
|
|
54
54
|
{
|
|
55
|
-
name: "
|
|
56
|
-
displayName: "
|
|
55
|
+
name: "field",
|
|
56
|
+
displayName: "Field",
|
|
57
57
|
values: [
|
|
58
58
|
{
|
|
59
59
|
displayName: "Name",
|
|
@@ -78,6 +78,7 @@ class PdfFormFill {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
async execute() {
|
|
81
|
+
var _a;
|
|
81
82
|
const items = this.getInputData();
|
|
82
83
|
const returnData = [];
|
|
83
84
|
const getFile = (field_name, i) => {
|
|
@@ -104,13 +105,17 @@ class PdfFormFill {
|
|
|
104
105
|
"x-api-key": credentials.apiKey,
|
|
105
106
|
},
|
|
106
107
|
body: {
|
|
107
|
-
input: {
|
|
108
|
+
input: {
|
|
109
|
+
file: file,
|
|
110
|
+
// n8n fixedCollection with multipleValues returns an object like { field: [{ name, value }, ...] }
|
|
111
|
+
fields: ((_a = this.getNodeParameter("fields", i)) === null || _a === void 0 ? void 0 : _a.field) || []
|
|
112
|
+
},
|
|
108
113
|
code: `
|
|
109
114
|
const { PDF_FILL_FORM } = require('./utils');
|
|
110
115
|
const pdfInput = input.file;
|
|
111
|
-
const fieldValues = Object.fromEntries((input.fields || []).
|
|
116
|
+
const fieldValues = Object.fromEntries((input.fields || []).map(x => [x.name, x.value]));
|
|
112
117
|
return PDF_FILL_FORM(pdfInput, fieldValues);`,
|
|
113
|
-
returnBinary:
|
|
118
|
+
returnBinary: true,
|
|
114
119
|
},
|
|
115
120
|
encoding: null,
|
|
116
121
|
json: true,
|