@custom-js/n8n-nodes-pdf-toolkit 1.50.0 → 1.52.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.
@@ -14,8 +14,8 @@ class CompressPDF {
14
14
  defaults: {
15
15
  name: "Compress PDF file",
16
16
  },
17
- inputs: ['main'],
18
- outputs: ['main'],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class CompressPDF {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Compress PDF',
34
+ value: 'compressPdf',
35
+ action: 'Compress a PDF',
36
+ },
37
+ ],
38
+ default: 'compressPdf',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -47,6 +61,14 @@ class CompressPDF {
47
61
  description: "The field name for binary PDF file or url that indicates PDF file. Please make sure the size of PDf file doesn't exceed 6mb. If it's bigger, pass URL rather than binary file.",
48
62
  required: true,
49
63
  },
64
+ {
65
+ displayName: "Output Filename",
66
+ name: "outputFilename",
67
+ type: "string",
68
+ default: "output.pdf",
69
+ description: "Name for the generated PDF file (include .pdf extension)",
70
+ required: false,
71
+ },
50
72
  ],
51
73
  };
52
74
  }
@@ -86,10 +108,10 @@ class CompressPDF {
86
108
  return PDF_COMPRESS(input);`,
87
109
  returnBinary: "true",
88
110
  },
89
- encoding: null,
111
+ encoding: 'arraybuffer',
90
112
  json: true,
91
113
  };
92
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
114
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
93
115
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
94
116
  // No binary data returned; emit only JSON without a binary property
95
117
  returnData.push({
@@ -100,7 +122,8 @@ class CompressPDF {
100
122
  });
101
123
  continue;
102
124
  }
103
- const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
125
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.pdf");
126
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
104
127
  returnData.push({
105
128
  json: items[i].json,
106
129
  binary: {
@@ -14,8 +14,8 @@ class ExtractPages {
14
14
  defaults: {
15
15
  name: "Extract Pages From PDF",
16
16
  },
17
- inputs: ['main'],
18
- outputs: ['main'],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class ExtractPages {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Extract Pages',
34
+ value: 'extractPages',
35
+ action: 'Extract Pages',
36
+ },
37
+ ],
38
+ default: 'extractPages',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -54,6 +68,14 @@ class ExtractPages {
54
68
  default: "1",
55
69
  description: "The range of pages to extract. Default is first page. (ex: 1-3, or 4)",
56
70
  },
71
+ {
72
+ displayName: "Output Filename",
73
+ name: "outputFilename",
74
+ type: "string",
75
+ default: "output.pdf",
76
+ description: "Name for the generated PDF file (include .pdf extension)",
77
+ required: false,
78
+ },
57
79
  ],
58
80
  };
59
81
  }
@@ -96,10 +118,10 @@ class ExtractPages {
96
118
  return EXTRACT_PAGES_FROM_PDF(pdfBuffer, input.pageRange);`,
97
119
  returnBinary: "true",
98
120
  },
99
- encoding: null,
121
+ encoding: 'arraybuffer',
100
122
  json: true,
101
123
  };
102
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
124
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
103
125
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
104
126
  // No binary data returned; emit only JSON without a binary property
105
127
  returnData.push({
@@ -110,7 +132,8 @@ class ExtractPages {
110
132
  });
111
133
  continue;
112
134
  }
113
- const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
135
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.pdf");
136
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
114
137
  returnData.push({
115
138
  json: items[i].json,
116
139
  binary: {
@@ -14,8 +14,8 @@ class GetFormFieldNames {
14
14
  defaults: {
15
15
  name: "Get PDF Form Fields",
16
16
  },
17
- inputs: ['main'],
18
- outputs: ['main'],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class GetFormFieldNames {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Get PDF Form Fields',
34
+ value: 'getFormFieldNames',
35
+ action: 'Get PDF Form Fields',
36
+ },
37
+ ],
38
+ default: 'getFormFieldNames',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -82,7 +96,7 @@ class GetFormFieldNames {
82
96
  },
83
97
  json: true,
84
98
  };
85
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
99
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
86
100
  returnData.push({
87
101
  json: {
88
102
  output: JSON.parse(response.toString()),
@@ -14,8 +14,8 @@ class Html2Docx {
14
14
  defaults: {
15
15
  name: "HTML to Docx",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class Html2Docx {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Convert HTML to DOCX',
34
+ value: 'html2Docx',
35
+ action: 'Convert HTML to DOCX',
36
+ },
37
+ ],
38
+ default: 'html2Docx',
39
+ },
26
40
  {
27
41
  displayName: "HTML Input",
28
42
  name: "htmlInput",
@@ -34,6 +48,14 @@ class Html2Docx {
34
48
  description: "The HTML content to convert to Docx",
35
49
  required: true,
36
50
  },
51
+ {
52
+ displayName: "Output Filename",
53
+ name: "outputFilename",
54
+ type: "string",
55
+ default: "output.docx",
56
+ description: "Name for the generated DOCX file (include .docx extension)",
57
+ required: false,
58
+ },
37
59
  ],
38
60
  };
39
61
  }
@@ -55,10 +77,10 @@ class Html2Docx {
55
77
  code: "const { HTML2DOCX } = require('./utils'); return HTML2DOCX(input)",
56
78
  returnBinary: "true",
57
79
  },
58
- encoding: null,
80
+ encoding: 'arraybuffer',
59
81
  json: true,
60
82
  };
61
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
83
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
62
84
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
63
85
  // No binary data returned; emit only JSON without a binary property
64
86
  returnData.push({
@@ -69,7 +91,8 @@ class Html2Docx {
69
91
  });
70
92
  continue;
71
93
  }
72
- const binaryData = await this.helpers.prepareBinaryData(response, "output.docx");
94
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.docx");
95
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
73
96
  returnData.push({
74
97
  json: items[i].json,
75
98
  binary: {
@@ -14,8 +14,8 @@ class Html2Pdf {
14
14
  defaults: {
15
15
  name: "HTML to PDF",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class Html2Pdf {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Convert HTML to PDF',
34
+ value: 'html2Pdf',
35
+ action: 'Convert HTML to PDF',
36
+ },
37
+ ],
38
+ default: 'html2Pdf',
39
+ },
26
40
  {
27
41
  displayName: "HTML Input",
28
42
  name: "htmlInput",
@@ -34,6 +48,14 @@ class Html2Pdf {
34
48
  description: "The HTML content to convert to PDF",
35
49
  required: true,
36
50
  },
51
+ {
52
+ displayName: "Output Filename",
53
+ name: "outputFilename",
54
+ type: "string",
55
+ default: "output.pdf",
56
+ description: "Name for the generated PDF file (include .pdf extension)",
57
+ required: false,
58
+ },
37
59
  ],
38
60
  };
39
61
  }
@@ -55,10 +77,10 @@ class Html2Pdf {
55
77
  code: "const { HTML2PDF } = require('./utils'); return HTML2PDF(input)",
56
78
  returnBinary: "true",
57
79
  },
58
- encoding: null,
80
+ encoding: 'arraybuffer',
59
81
  json: true,
60
82
  };
61
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
83
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
62
84
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
63
85
  // No binary data returned; emit only JSON without a binary property
64
86
  returnData.push({
@@ -69,7 +91,8 @@ class Html2Pdf {
69
91
  });
70
92
  continue;
71
93
  }
72
- const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
94
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.pdf");
95
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
73
96
  returnData.push({
74
97
  json: items[i].json,
75
98
  binary: {
@@ -14,8 +14,8 @@ class InvoiceGenerator {
14
14
  defaults: {
15
15
  name: 'Invoice Generator',
16
16
  },
17
- inputs: ['main'],
18
- outputs: ['main'],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: 'customJsApi',
@@ -23,6 +23,20 @@ class InvoiceGenerator {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Generate Invoice',
34
+ value: 'invoiceGenerator',
35
+ action: 'Generate Invoice',
36
+ },
37
+ ],
38
+ default: 'invoiceGenerator',
39
+ },
26
40
  {
27
41
  displayName: 'PDF Template',
28
42
  name: 'pdfTemplate',
@@ -181,6 +195,14 @@ class InvoiceGenerator {
181
195
  },
182
196
  description: 'A JSON array of invoice items. E.g., [{"description":"Item 1","quantity":2,"unitPrice":50}]',
183
197
  },
198
+ {
199
+ displayName: 'Output Filename',
200
+ name: 'outputFilename',
201
+ type: 'string',
202
+ default: 'Invoice.pdf',
203
+ description: 'Name for the generated PDF file (include .pdf extension)',
204
+ required: false,
205
+ },
184
206
  ],
185
207
  };
186
208
  }
@@ -261,10 +283,10 @@ class InvoiceGenerator {
261
283
  code: code,
262
284
  returnBinary: 'true',
263
285
  },
264
- encoding: null,
286
+ encoding: 'arraybuffer',
265
287
  json: true,
266
288
  };
267
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
289
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
268
290
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
269
291
  returnData.push({
270
292
  json: items[i].json,
@@ -274,7 +296,8 @@ class InvoiceGenerator {
274
296
  });
275
297
  continue;
276
298
  }
277
- const binaryData = await this.helpers.prepareBinaryData(response, "Invoice.pdf");
299
+ const outputFilename = this.getNodeParameter('outputFilename', i, 'Invoice.pdf');
300
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
278
301
  returnData.push({
279
302
  json: items[i].json,
280
303
  binary: {
@@ -14,8 +14,8 @@ class Markdown2Html {
14
14
  defaults: {
15
15
  name: "Markdown to HTML",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class Markdown2Html {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Convert Markdown to HTML',
34
+ value: 'markdown2Html',
35
+ action: 'Convert Markdown to HTML',
36
+ },
37
+ ],
38
+ default: 'markdown2Html',
39
+ },
26
40
  {
27
41
  displayName: "Markdown Input",
28
42
  name: "markdownInput",
@@ -57,7 +71,7 @@ class Markdown2Html {
57
71
  },
58
72
  json: true,
59
73
  };
60
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
74
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
61
75
  returnData.push({
62
76
  json: {
63
77
  output: response.toString(),
@@ -14,8 +14,8 @@ class MergePdfs {
14
14
  defaults: {
15
15
  name: "Merge PDF",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class MergePdfs {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Merge PDFs',
34
+ value: 'mergePdfs',
35
+ action: 'Merge PDFs',
36
+ },
37
+ ],
38
+ default: 'mergePdfs',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -47,6 +61,14 @@ class MergePdfs {
47
61
  description: "The field names for binary PDF file or urls that indicate PDF files. Please make sure the size of PDf file doesn't exceed 6mb. If it's bigger, pass an array of URLs rather than binary file.",
48
62
  required: true,
49
63
  },
64
+ {
65
+ displayName: "Output Filename",
66
+ name: "outputFilename",
67
+ type: "string",
68
+ default: "output.pdf",
69
+ description: "Name for the generated PDF file (include .pdf extension)",
70
+ required: false,
71
+ },
50
72
  ],
51
73
  };
52
74
  }
@@ -78,10 +100,10 @@ class MergePdfs {
78
100
  return PDF_MERGE(input);`,
79
101
  returnBinary: "true",
80
102
  },
81
- encoding: null,
103
+ encoding: 'arraybuffer',
82
104
  json: true,
83
105
  };
84
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
106
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
85
107
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
86
108
  // No binary data returned; emit only JSON without a binary property
87
109
  returnData.push({
@@ -92,7 +114,8 @@ class MergePdfs {
92
114
  });
93
115
  return [returnData];
94
116
  }
95
- const binaryData = await this.helpers.prepareBinaryData(response, "output.pdf");
117
+ const outputFilename = this.getNodeParameter("outputFilename", 0, "output.pdf");
118
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
96
119
  returnData.push({
97
120
  json: {},
98
121
  binary: {
@@ -14,8 +14,8 @@ class PdfFormFill {
14
14
  defaults: {
15
15
  name: "PDF Form Fill (Fill PDF Fields)",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class PdfFormFill {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Fill PDF Form',
34
+ value: 'pdfFormFill',
35
+ action: 'Fill PDF Form',
36
+ },
37
+ ],
38
+ default: 'pdfFormFill',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -75,6 +89,14 @@ class PdfFormFill {
75
89
  },
76
90
  ],
77
91
  },
92
+ {
93
+ displayName: "Output Filename",
94
+ name: "outputFilename",
95
+ type: "string",
96
+ default: "document.pdf",
97
+ description: "Name for the generated PDF file (include .pdf extension)",
98
+ required: false,
99
+ },
78
100
  ],
79
101
  };
80
102
  }
@@ -118,10 +140,10 @@ class PdfFormFill {
118
140
  return PDF_FILL_FORM(pdfInput, fieldValues);`,
119
141
  returnBinary: "true",
120
142
  },
121
- encoding: null,
143
+ encoding: 'arraybuffer',
122
144
  json: true,
123
145
  };
124
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
146
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
125
147
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
126
148
  // No binary data returned; emit only JSON without a binary property
127
149
  returnData.push({
@@ -132,7 +154,8 @@ class PdfFormFill {
132
154
  });
133
155
  continue;
134
156
  }
135
- const binaryData = await this.helpers.prepareBinaryData(response, "document.pdf");
157
+ const outputFilename = this.getNodeParameter("outputFilename", i, "document.pdf");
158
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
136
159
  returnData.push({
137
160
  json: items[i].json,
138
161
  binary: {
@@ -14,8 +14,8 @@ class PdfToPng {
14
14
  defaults: {
15
15
  name: "Convert PDF into PNG",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class PdfToPng {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Convert PDF to PNG',
34
+ value: 'pdfToPng',
35
+ action: 'Convert PDF to PNG',
36
+ },
37
+ ],
38
+ default: 'pdfToPng',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -47,6 +61,14 @@ class PdfToPng {
47
61
  description: "The field name for binary PDF file or url that indicates PDF file. Please make sure the size of PDf file doesn't exceed 6mb. If it's bigger, pass URL rather than binary file.",
48
62
  required: true,
49
63
  },
64
+ {
65
+ displayName: "Output Filename",
66
+ name: "outputFilename",
67
+ type: "string",
68
+ default: "output.png",
69
+ description: "Name for the generated PNG file (include .png extension)",
70
+ required: false,
71
+ },
50
72
  ],
51
73
  };
52
74
  }
@@ -86,10 +108,10 @@ class PdfToPng {
86
108
  return PDF2PNG(input);`,
87
109
  returnBinary: "true",
88
110
  },
89
- encoding: null,
111
+ encoding: 'arraybuffer',
90
112
  json: true,
91
113
  };
92
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
114
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
93
115
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
94
116
  // No binary data returned; emit only JSON without a binary property
95
117
  returnData.push({
@@ -100,7 +122,8 @@ class PdfToPng {
100
122
  });
101
123
  continue;
102
124
  }
103
- const binaryData = await this.helpers.prepareBinaryData(response, "output.png");
125
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.png");
126
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
104
127
  returnData.push({
105
128
  json: items[i].json,
106
129
  binary: {
@@ -14,8 +14,8 @@ class PdfToText {
14
14
  defaults: {
15
15
  name: "Convert PDF into Text",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class PdfToText {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Convert PDF to Text',
34
+ value: 'pdfToText',
35
+ action: 'Convert PDF to Text',
36
+ },
37
+ ],
38
+ default: 'pdfToText',
39
+ },
26
40
  {
27
41
  displayName: "Resource",
28
42
  name: "resource",
@@ -88,7 +102,7 @@ class PdfToText {
88
102
  },
89
103
  json: true,
90
104
  };
91
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
105
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
92
106
  returnData.push({
93
107
  json: {
94
108
  output: response.toString(),
@@ -14,8 +14,8 @@ class SSLChecker {
14
14
  defaults: {
15
15
  name: "SSL Checker",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class SSLChecker {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Check SSL',
34
+ value: 'sslChecker',
35
+ action: 'Check SSL',
36
+ },
37
+ ],
38
+ default: 'sslChecker',
39
+ },
26
40
  {
27
41
  displayName: "Domain",
28
42
  name: "domain",
@@ -61,7 +75,7 @@ class SSLChecker {
61
75
  },
62
76
  json: true,
63
77
  };
64
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
78
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
65
79
  returnData.push({
66
80
  json: {
67
81
  output: response,
@@ -14,8 +14,8 @@ class Scraper {
14
14
  defaults: {
15
15
  name: "Scraper",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class Scraper {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Scrape Website',
34
+ value: 'scraper',
35
+ action: 'Scrape Website',
36
+ },
37
+ ],
38
+ default: 'scraper',
39
+ },
26
40
  {
27
41
  displayName: "Website URL",
28
42
  name: "url",
@@ -111,6 +125,19 @@ class Scraper {
111
125
  description: "Specify if the operation should be canceled when the element is not found.",
112
126
  required: true,
113
127
  },
128
+ {
129
+ displayName: "Output Filename",
130
+ name: "outputFilename",
131
+ type: "string",
132
+ default: "output.png",
133
+ description: "Name for the generated PNG file (include .png extension)",
134
+ required: false,
135
+ displayOptions: {
136
+ show: {
137
+ returnValueType: ["binary"],
138
+ },
139
+ },
140
+ },
114
141
  ],
115
142
  };
116
143
  }
@@ -146,10 +173,10 @@ class Scraper {
146
173
  `return SCRAPER(payload.url, payload.commands || [], "${returnValueType === "binary" ? "image" : "html"}", ${debug ? "true" : "false"});`,
147
174
  returnBinary: returnValueType === "binary" ? "true" : "false",
148
175
  },
149
- encoding: returnValueType === "binary" ? null : undefined,
176
+ encoding: returnValueType === "binary" ? 'arraybuffer' : undefined,
150
177
  json: true,
151
178
  };
152
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
179
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
153
180
  if (returnValueType === "binary") {
154
181
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
155
182
  // No binary data returned; emit only JSON without a binary property
@@ -161,7 +188,8 @@ class Scraper {
161
188
  });
162
189
  continue;
163
190
  }
164
- const binaryData = await this.helpers.prepareBinaryData(response, "output.png");
191
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.png");
192
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
165
193
  returnData.push({
166
194
  json: items[i].json,
167
195
  binary: {
@@ -14,8 +14,8 @@ class WebsiteScreenshot {
14
14
  defaults: {
15
15
  name: "Take a screenshot of a website",
16
16
  },
17
- inputs: ["main"],
18
- outputs: ["main"],
17
+ inputs: ["main" /* NodeConnectionType.Main */],
18
+ outputs: ["main" /* NodeConnectionType.Main */],
19
19
  credentials: [
20
20
  {
21
21
  name: "customJsApi",
@@ -23,6 +23,20 @@ class WebsiteScreenshot {
23
23
  },
24
24
  ],
25
25
  properties: [
26
+ {
27
+ displayName: 'Operation',
28
+ name: 'operation',
29
+ type: 'options',
30
+ noDataExpression: true,
31
+ options: [
32
+ {
33
+ name: 'Take Website Screenshot',
34
+ value: 'websiteScreenshot',
35
+ action: 'Take Website Screenshot',
36
+ },
37
+ ],
38
+ default: 'websiteScreenshot',
39
+ },
26
40
  {
27
41
  displayName: "Website Url",
28
42
  name: "urlInput",
@@ -31,6 +45,14 @@ class WebsiteScreenshot {
31
45
  description: "The url for taking screenshot",
32
46
  required: true,
33
47
  },
48
+ {
49
+ displayName: "Output Filename",
50
+ name: "outputFilename",
51
+ type: "string",
52
+ default: "output.png",
53
+ description: "Name for the generated PNG file (include .png extension)",
54
+ required: false,
55
+ },
34
56
  ],
35
57
  };
36
58
  }
@@ -52,10 +74,10 @@ class WebsiteScreenshot {
52
74
  code: "const { SCREENSHOT } = require('./utils'); return SCREENSHOT(input);",
53
75
  returnBinary: "true",
54
76
  },
55
- encoding: null,
77
+ encoding: 'arraybuffer',
56
78
  json: true,
57
79
  };
58
- const response = await this.helpers.requestWithAuthentication.call(this, 'customJsApi', options);
80
+ const response = await this.helpers.httpRequestWithAuthentication.call(this, 'customJsApi', options);
59
81
  if (!response || (Buffer.isBuffer(response) && response.length === 0)) {
60
82
  // No binary data returned; emit only JSON without a binary property
61
83
  returnData.push({
@@ -66,7 +88,8 @@ class WebsiteScreenshot {
66
88
  });
67
89
  continue;
68
90
  }
69
- const binaryData = await this.helpers.prepareBinaryData(response, "output.png");
91
+ const outputFilename = this.getNodeParameter("outputFilename", i, "output.png");
92
+ const binaryData = await this.helpers.prepareBinaryData(response, outputFilename);
70
93
  returnData.push({
71
94
  json: items[i].json,
72
95
  binary: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@custom-js/n8n-nodes-pdf-toolkit",
3
- "version": "1.50.0",
3
+ "version": "1.52.0",
4
4
  "description": "This is official node for interacting with APIs from customjs.space",
5
5
  "keywords": [
6
6
  "customjs",
@@ -45,12 +45,12 @@
45
45
  ]
46
46
  },
47
47
  "devDependencies": {
48
- "typescript": "~4.8.4",
48
+ "@types/node": "^16.11.7",
49
49
  "gulp": "^4.0.2",
50
- "@types/node": "^16.11.7"
50
+ "typescript": "~4.8.4"
51
51
  },
52
52
  "peerDependencies": {
53
- "n8n-workflow": "*"
53
+ "n8n-workflow": "^1.64.0"
54
54
  },
55
55
  "type": "commonjs",
56
56
  "main": "index.js",