n8n-nodes-h2i 1.0.0 → 1.0.2
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.
|
@@ -18,7 +18,7 @@ class DavixH2I {
|
|
|
18
18
|
icon: 'file:davixH2I.svg',
|
|
19
19
|
group: ['transform'],
|
|
20
20
|
version: 1,
|
|
21
|
-
subtitle: '={{$parameter["resource"]}}',
|
|
21
|
+
subtitle: '={{$parameter["resource"] + " • " + ($parameter["operation"] || "")}}',
|
|
22
22
|
description: 'Use Davix PixLab public API endpoints (H2I, Image, PDF, Tools).',
|
|
23
23
|
defaults: {
|
|
24
24
|
name: 'Davix H2I',
|
|
@@ -27,6 +27,9 @@ class DavixH2I {
|
|
|
27
27
|
outputs: ['main'],
|
|
28
28
|
credentials: [{ name: 'davixH2IApi', required: true }],
|
|
29
29
|
properties: [
|
|
30
|
+
// -------------------------
|
|
31
|
+
// Resource + Operation
|
|
32
|
+
// -------------------------
|
|
30
33
|
{
|
|
31
34
|
displayName: 'Resource',
|
|
32
35
|
name: 'resource',
|
|
@@ -39,6 +42,77 @@ class DavixH2I {
|
|
|
39
42
|
{ name: 'Tools (Analyze Images)', value: 'tools' },
|
|
40
43
|
],
|
|
41
44
|
},
|
|
45
|
+
// H2I actions
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Operation',
|
|
48
|
+
name: 'operation',
|
|
49
|
+
type: 'options',
|
|
50
|
+
default: 'image',
|
|
51
|
+
displayOptions: { show: { resource: ['h2i'] } },
|
|
52
|
+
options: [
|
|
53
|
+
{ name: 'Render HTML to Image', value: 'image' },
|
|
54
|
+
{ name: 'Render HTML to PDF', value: 'pdf' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
// Image actions
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Operation',
|
|
60
|
+
name: 'operation',
|
|
61
|
+
type: 'options',
|
|
62
|
+
default: 'format',
|
|
63
|
+
displayOptions: { show: { resource: ['image'] } },
|
|
64
|
+
options: [
|
|
65
|
+
{ name: 'Format', value: 'format' },
|
|
66
|
+
{ name: 'Resize', value: 'resize' },
|
|
67
|
+
{ name: 'Crop', value: 'crop' },
|
|
68
|
+
{ name: 'Transform', value: 'transform' },
|
|
69
|
+
{ name: 'Compress', value: 'compress' },
|
|
70
|
+
{ name: 'Enhance', value: 'enhance' },
|
|
71
|
+
{ name: 'Padding', value: 'padding' },
|
|
72
|
+
{ name: 'Frame', value: 'frame' },
|
|
73
|
+
{ name: 'Background', value: 'background' },
|
|
74
|
+
{ name: 'Watermark', value: 'watermark' },
|
|
75
|
+
{ name: 'PDF Export', value: 'pdf' },
|
|
76
|
+
{ name: 'Metadata (JSON only)', value: 'metadata' },
|
|
77
|
+
{ name: 'Multitask', value: 'multitask' },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
// PDF actions
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Operation',
|
|
83
|
+
name: 'operation',
|
|
84
|
+
type: 'options',
|
|
85
|
+
default: 'merge',
|
|
86
|
+
displayOptions: { show: { resource: ['pdf'] } },
|
|
87
|
+
options: [
|
|
88
|
+
{ name: 'To Images', value: 'to-images' },
|
|
89
|
+
{ name: 'Merge', value: 'merge' },
|
|
90
|
+
{ name: 'Split', value: 'split' },
|
|
91
|
+
{ name: 'Compress', value: 'compress' },
|
|
92
|
+
{ name: 'Extract Images', value: 'extract-images' },
|
|
93
|
+
{ name: 'Watermark', value: 'watermark' },
|
|
94
|
+
{ name: 'Rotate', value: 'rotate' },
|
|
95
|
+
{ name: 'Metadata', value: 'metadata' },
|
|
96
|
+
{ name: 'Reorder', value: 'reorder' },
|
|
97
|
+
{ name: 'Delete Pages', value: 'delete-pages' },
|
|
98
|
+
{ name: 'Extract Pages', value: 'extract' },
|
|
99
|
+
{ name: 'Flatten', value: 'flatten' },
|
|
100
|
+
{ name: 'Encrypt', value: 'encrypt' },
|
|
101
|
+
{ name: 'Decrypt', value: 'decrypt' },
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
// Tools actions
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Operation',
|
|
107
|
+
name: 'operation',
|
|
108
|
+
type: 'options',
|
|
109
|
+
default: 'single',
|
|
110
|
+
displayOptions: { show: { resource: ['tools'] } },
|
|
111
|
+
options: [
|
|
112
|
+
{ name: 'Single Tool', value: 'single' },
|
|
113
|
+
{ name: 'Multitask', value: 'multitask' },
|
|
114
|
+
],
|
|
115
|
+
},
|
|
42
116
|
// -------------------------
|
|
43
117
|
// H2I
|
|
44
118
|
// -------------------------
|
|
@@ -49,7 +123,7 @@ class DavixH2I {
|
|
|
49
123
|
default: '',
|
|
50
124
|
required: true,
|
|
51
125
|
typeOptions: { rows: 6 },
|
|
52
|
-
displayOptions: { show: { resource: ['h2i'] } },
|
|
126
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
|
|
53
127
|
},
|
|
54
128
|
{
|
|
55
129
|
displayName: 'CSS',
|
|
@@ -57,21 +131,21 @@ class DavixH2I {
|
|
|
57
131
|
type: 'string',
|
|
58
132
|
default: '',
|
|
59
133
|
typeOptions: { rows: 4 },
|
|
60
|
-
displayOptions: { show: { resource: ['h2i'] } },
|
|
134
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
|
|
61
135
|
},
|
|
62
136
|
{
|
|
63
137
|
displayName: 'Width',
|
|
64
138
|
name: 'width',
|
|
65
139
|
type: 'number',
|
|
66
140
|
default: 1000,
|
|
67
|
-
displayOptions: { show: { resource: ['h2i'] } },
|
|
141
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
|
|
68
142
|
},
|
|
69
143
|
{
|
|
70
144
|
displayName: 'Height',
|
|
71
145
|
name: 'height',
|
|
72
146
|
type: 'number',
|
|
73
147
|
default: 1500,
|
|
74
|
-
displayOptions: { show: { resource: ['h2i'] } },
|
|
148
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
|
|
75
149
|
},
|
|
76
150
|
{
|
|
77
151
|
displayName: 'Format',
|
|
@@ -82,21 +156,69 @@ class DavixH2I {
|
|
|
82
156
|
{ name: 'PNG', value: 'png' },
|
|
83
157
|
{ name: 'JPEG', value: 'jpeg' },
|
|
84
158
|
],
|
|
85
|
-
displayOptions: { show: { resource: ['h2i'] } },
|
|
159
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image'] } },
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
displayName: 'PDF Page Size',
|
|
163
|
+
name: 'h2iPdfPageSize',
|
|
164
|
+
type: 'options',
|
|
165
|
+
default: 'auto',
|
|
166
|
+
options: [
|
|
167
|
+
{ name: 'Auto', value: 'auto' },
|
|
168
|
+
{ name: 'A4', value: 'a4' },
|
|
169
|
+
{ name: 'Letter', value: 'letter' },
|
|
170
|
+
],
|
|
171
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
displayName: 'PDF Orientation',
|
|
175
|
+
name: 'h2iPdfOrientation',
|
|
176
|
+
type: 'options',
|
|
177
|
+
default: 'portrait',
|
|
178
|
+
options: [
|
|
179
|
+
{ name: 'Portrait', value: 'portrait' },
|
|
180
|
+
{ name: 'Landscape', value: 'landscape' },
|
|
181
|
+
],
|
|
182
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
displayName: 'PDF Margin',
|
|
186
|
+
name: 'h2iPdfMargin',
|
|
187
|
+
type: 'number',
|
|
188
|
+
default: 0,
|
|
189
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
displayName: 'PDF Embed Format',
|
|
193
|
+
name: 'h2iPdfEmbedFormat',
|
|
194
|
+
type: 'options',
|
|
195
|
+
default: 'png',
|
|
196
|
+
options: [
|
|
197
|
+
{ name: 'PNG', value: 'png' },
|
|
198
|
+
{ name: 'JPEG', value: 'jpeg' },
|
|
199
|
+
],
|
|
200
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
displayName: 'PDF JPEG Quality',
|
|
204
|
+
name: 'h2iPdfJpegQuality',
|
|
205
|
+
type: 'number',
|
|
206
|
+
default: 85,
|
|
207
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['pdf'] } },
|
|
86
208
|
},
|
|
87
209
|
{
|
|
88
210
|
displayName: 'Download Result as Binary',
|
|
89
211
|
name: 'downloadBinary',
|
|
90
212
|
type: 'boolean',
|
|
91
213
|
default: false,
|
|
92
|
-
displayOptions: { show: { resource: ['h2i'] } },
|
|
214
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'] } },
|
|
93
215
|
},
|
|
94
216
|
{
|
|
95
217
|
displayName: 'Output Binary Property',
|
|
96
218
|
name: 'outputBinaryProperty',
|
|
97
219
|
type: 'string',
|
|
98
220
|
default: 'data',
|
|
99
|
-
displayOptions: { show: { resource: ['h2i'], downloadBinary: [true] } },
|
|
221
|
+
displayOptions: { show: { resource: ['h2i'], operation: ['image', 'pdf'], downloadBinary: [true] } },
|
|
100
222
|
},
|
|
101
223
|
// -------------------------
|
|
102
224
|
// Image
|
|
@@ -126,20 +248,67 @@ class DavixH2I {
|
|
|
126
248
|
],
|
|
127
249
|
displayOptions: { show: { resource: ['image'] } },
|
|
128
250
|
},
|
|
129
|
-
{ displayName: 'Width', name: 'imageWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'] } } },
|
|
130
|
-
{ displayName: 'Height', name: 'imageHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'] } } },
|
|
131
|
-
{ displayName: 'Enlarge', name: 'enlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'] } } },
|
|
132
|
-
{ displayName: '
|
|
133
|
-
{ displayName: 'Crop
|
|
134
|
-
{ displayName: 'Crop
|
|
135
|
-
{ displayName: 'Crop
|
|
136
|
-
{ displayName: '
|
|
137
|
-
{ displayName: '
|
|
138
|
-
{ displayName: '
|
|
139
|
-
{ displayName: '
|
|
140
|
-
{ displayName: '
|
|
141
|
-
{ displayName: '
|
|
142
|
-
|
|
251
|
+
{ displayName: 'Width', name: 'imageWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['resize', 'format'] } } },
|
|
252
|
+
{ displayName: 'Height', name: 'imageHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['resize', 'format'] } } },
|
|
253
|
+
{ displayName: 'Enlarge', name: 'enlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['resize'] } } },
|
|
254
|
+
{ displayName: 'Normalize Orientation', name: 'normalizeOrientation', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['resize', 'crop', 'enhance', 'metadata'] } } },
|
|
255
|
+
{ displayName: 'Crop X', name: 'cropX', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
|
|
256
|
+
{ displayName: 'Crop Y', name: 'cropY', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
|
|
257
|
+
{ displayName: 'Crop Width', name: 'cropWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
|
|
258
|
+
{ displayName: 'Crop Height', name: 'cropHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['crop'] } } },
|
|
259
|
+
{ displayName: 'Background Color', name: 'backgroundColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['crop', 'compress', 'background'] } } },
|
|
260
|
+
{ displayName: 'Rotate (degrees)', name: 'rotate', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
|
|
261
|
+
{ displayName: 'Flip Horizontal', name: 'flipH', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
|
|
262
|
+
{ displayName: 'Flip Vertical', name: 'flipV', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['transform'] } } },
|
|
263
|
+
{ displayName: 'Color Space', name: 'colorSpace', type: 'options', default: 'srgb', options: [{ name: 'sRGB', value: 'srgb' }, { name: 'Display P3', value: 'display-p3' }], displayOptions: { show: { resource: ['image'], operation: ['transform', 'compress'] } } },
|
|
264
|
+
{ displayName: 'Target Size (KB)', name: 'targetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['compress'] } } },
|
|
265
|
+
{ displayName: 'Quality', name: 'quality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['compress'] } } },
|
|
266
|
+
{ displayName: 'Keep Metadata', name: 'keepMetadata', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask', 'metadata'] } } },
|
|
267
|
+
{ displayName: 'Blur', name: 'blur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
268
|
+
{ displayName: 'Sharpen', name: 'sharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
269
|
+
{ displayName: 'Grayscale', name: 'grayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
270
|
+
{ displayName: 'Sepia', name: 'sepia', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
271
|
+
{ displayName: 'Brightness', name: 'brightness', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
272
|
+
{ displayName: 'Contrast', name: 'contrast', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
273
|
+
{ displayName: 'Saturation', name: 'saturation', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['enhance'] } } },
|
|
274
|
+
{ displayName: 'Pad', name: 'pad', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding', 'frame'] } } },
|
|
275
|
+
{ displayName: 'Pad Top', name: 'padTop', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
|
|
276
|
+
{ displayName: 'Pad Right', name: 'padRight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
|
|
277
|
+
{ displayName: 'Pad Bottom', name: 'padBottom', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
|
|
278
|
+
{ displayName: 'Pad Left', name: 'padLeft', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding'] } } },
|
|
279
|
+
{ displayName: 'Pad Color', name: 'padColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['padding', 'frame', 'background'] } } },
|
|
280
|
+
{ displayName: 'Border', name: 'border', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['frame'] } } },
|
|
281
|
+
{ displayName: 'Border Color', name: 'borderColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['frame'] } } },
|
|
282
|
+
{ displayName: 'Border Radius', name: 'borderRadius', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['padding', 'background'] } } },
|
|
283
|
+
{ displayName: 'Background Blur', name: 'backgroundBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['background'] } } },
|
|
284
|
+
{ displayName: 'Watermark Text', name: 'watermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
|
|
285
|
+
{ displayName: 'Watermark Font Size', name: 'watermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
|
|
286
|
+
{ displayName: 'Watermark Color', name: 'watermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
|
|
287
|
+
{ displayName: 'Watermark Opacity', name: 'watermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
|
|
288
|
+
{
|
|
289
|
+
displayName: 'Watermark Position',
|
|
290
|
+
name: 'watermarkPosition',
|
|
291
|
+
type: 'options',
|
|
292
|
+
default: 'center',
|
|
293
|
+
options: [
|
|
294
|
+
{ name: 'Center', value: 'center' },
|
|
295
|
+
{ name: 'Top Left', value: 'top-left' },
|
|
296
|
+
{ name: 'Top Right', value: 'top-right' },
|
|
297
|
+
{ name: 'Bottom Left', value: 'bottom-left' },
|
|
298
|
+
{ name: 'Bottom Right', value: 'bottom-right' },
|
|
299
|
+
],
|
|
300
|
+
displayOptions: { show: { resource: ['image'], operation: ['watermark'] } },
|
|
301
|
+
},
|
|
302
|
+
{ displayName: 'Watermark Margin', name: 'watermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
|
|
303
|
+
{ displayName: 'Watermark Scale', name: 'watermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['image'], operation: ['watermark'] } } },
|
|
304
|
+
{
|
|
305
|
+
displayName: 'Watermark Image Binary Property',
|
|
306
|
+
name: 'watermarkImageBinaryProp',
|
|
307
|
+
type: 'string',
|
|
308
|
+
default: '',
|
|
309
|
+
placeholder: 'watermarkImage',
|
|
310
|
+
displayOptions: { show: { resource: ['image'], operation: ['watermark'] } },
|
|
311
|
+
},
|
|
143
312
|
{
|
|
144
313
|
displayName: 'PDF Mode',
|
|
145
314
|
name: 'pdfMode',
|
|
@@ -149,7 +318,7 @@ class DavixH2I {
|
|
|
149
318
|
{ name: 'Single', value: 'single' },
|
|
150
319
|
{ name: 'Multi', value: 'multi' },
|
|
151
320
|
],
|
|
152
|
-
displayOptions: { show: { resource: ['image'],
|
|
321
|
+
displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
|
|
153
322
|
},
|
|
154
323
|
{
|
|
155
324
|
displayName: 'PDF Page Size',
|
|
@@ -161,7 +330,7 @@ class DavixH2I {
|
|
|
161
330
|
{ name: 'A4', value: 'a4' },
|
|
162
331
|
{ name: 'Letter', value: 'letter' },
|
|
163
332
|
],
|
|
164
|
-
displayOptions: { show: { resource: ['image'],
|
|
333
|
+
displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
|
|
165
334
|
},
|
|
166
335
|
{
|
|
167
336
|
displayName: 'PDF Orientation',
|
|
@@ -172,14 +341,14 @@ class DavixH2I {
|
|
|
172
341
|
{ name: 'Portrait', value: 'portrait' },
|
|
173
342
|
{ name: 'Landscape', value: 'landscape' },
|
|
174
343
|
],
|
|
175
|
-
displayOptions: { show: { resource: ['image'],
|
|
344
|
+
displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
|
|
176
345
|
},
|
|
177
346
|
{
|
|
178
347
|
displayName: 'PDF Margin',
|
|
179
348
|
name: 'pdfMargin',
|
|
180
349
|
type: 'number',
|
|
181
350
|
default: 0,
|
|
182
|
-
displayOptions: { show: { resource: ['image'],
|
|
351
|
+
displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
|
|
183
352
|
},
|
|
184
353
|
{
|
|
185
354
|
displayName: 'PDF Embed Format',
|
|
@@ -190,46 +359,237 @@ class DavixH2I {
|
|
|
190
359
|
{ name: 'PNG', value: 'png' },
|
|
191
360
|
{ name: 'JPEG', value: 'jpeg' },
|
|
192
361
|
],
|
|
193
|
-
displayOptions: { show: { resource: ['image'],
|
|
362
|
+
displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
|
|
194
363
|
},
|
|
195
364
|
{
|
|
196
365
|
displayName: 'PDF JPEG Quality',
|
|
197
366
|
name: 'pdfJpegQuality',
|
|
198
367
|
type: 'number',
|
|
199
368
|
default: 85,
|
|
200
|
-
displayOptions: { show: { resource: ['image'],
|
|
369
|
+
displayOptions: { show: { resource: ['image'], operation: ['pdf'] } },
|
|
370
|
+
},
|
|
371
|
+
{ displayName: 'Include Raw EXIF', name: 'includeRawExif', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['metadata'] } } },
|
|
372
|
+
{
|
|
373
|
+
displayName: 'Multitask Options',
|
|
374
|
+
name: 'imageMultitaskOptions',
|
|
375
|
+
type: 'multiOptions',
|
|
376
|
+
default: [],
|
|
377
|
+
options: [
|
|
378
|
+
{ name: 'Format', value: 'format' },
|
|
379
|
+
{ name: 'Width', value: 'width' },
|
|
380
|
+
{ name: 'Height', value: 'height' },
|
|
381
|
+
{ name: 'Enlarge', value: 'enlarge' },
|
|
382
|
+
{ name: 'Normalize Orientation', value: 'normalizeOrientation' },
|
|
383
|
+
{ name: 'Crop', value: 'crop' },
|
|
384
|
+
{ name: 'Background Color', value: 'backgroundColor' },
|
|
385
|
+
{ name: 'Rotate', value: 'rotate' },
|
|
386
|
+
{ name: 'Flip Horizontal', value: 'flipH' },
|
|
387
|
+
{ name: 'Flip Vertical', value: 'flipV' },
|
|
388
|
+
{ name: 'Color Space', value: 'colorSpace' },
|
|
389
|
+
{ name: 'Target Size (KB)', value: 'targetSizeKB' },
|
|
390
|
+
{ name: 'Quality', value: 'quality' },
|
|
391
|
+
{ name: 'Keep Metadata', value: 'keepMetadata' },
|
|
392
|
+
{ name: 'Blur', value: 'blur' },
|
|
393
|
+
{ name: 'Sharpen', value: 'sharpen' },
|
|
394
|
+
{ name: 'Grayscale', value: 'grayscale' },
|
|
395
|
+
{ name: 'Sepia', value: 'sepia' },
|
|
396
|
+
{ name: 'Brightness', value: 'brightness' },
|
|
397
|
+
{ name: 'Contrast', value: 'contrast' },
|
|
398
|
+
{ name: 'Saturation', value: 'saturation' },
|
|
399
|
+
{ name: 'Pad', value: 'pad' },
|
|
400
|
+
{ name: 'Pad Sides', value: 'padSides' },
|
|
401
|
+
{ name: 'Pad Color', value: 'padColor' },
|
|
402
|
+
{ name: 'Border', value: 'border' },
|
|
403
|
+
{ name: 'Border Color', value: 'borderColor' },
|
|
404
|
+
{ name: 'Border Radius', value: 'borderRadius' },
|
|
405
|
+
{ name: 'Background Blur', value: 'backgroundBlur' },
|
|
406
|
+
{ name: 'Watermark', value: 'watermark' },
|
|
407
|
+
{ name: 'PDF Options', value: 'pdf' },
|
|
408
|
+
{ name: 'Include Raw EXIF', value: 'includeRawExif' },
|
|
409
|
+
],
|
|
410
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'] } },
|
|
411
|
+
},
|
|
412
|
+
// Conditional image fields for multitask
|
|
413
|
+
{ displayName: 'Width', name: 'multiWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['width'] } } },
|
|
414
|
+
{ displayName: 'Height', name: 'multiHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['height'] } } },
|
|
415
|
+
{ displayName: 'Enlarge', name: 'multiEnlarge', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['enlarge'] } } },
|
|
416
|
+
{
|
|
417
|
+
displayName: 'Normalize Orientation',
|
|
418
|
+
name: 'multiNormalizeOrientation',
|
|
419
|
+
type: 'boolean',
|
|
420
|
+
default: false,
|
|
421
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['normalizeOrientation'] } },
|
|
422
|
+
},
|
|
423
|
+
{ displayName: 'Crop X', name: 'multiCropX', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
|
|
424
|
+
{ displayName: 'Crop Y', name: 'multiCropY', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
|
|
425
|
+
{ displayName: 'Crop Width', name: 'multiCropWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
|
|
426
|
+
{ displayName: 'Crop Height', name: 'multiCropHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['crop'] } } },
|
|
427
|
+
{ displayName: 'Background Color', name: 'multiBackgroundColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['backgroundColor'] } } },
|
|
428
|
+
{ displayName: 'Rotate (degrees)', name: 'multiRotate', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['rotate'] } } },
|
|
429
|
+
{ displayName: 'Flip Horizontal', name: 'multiFlipH', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['flipH'] } } },
|
|
430
|
+
{ displayName: 'Flip Vertical', name: 'multiFlipV', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['flipV'] } } },
|
|
431
|
+
{
|
|
432
|
+
displayName: 'Color Space',
|
|
433
|
+
name: 'multiColorSpace',
|
|
434
|
+
type: 'options',
|
|
435
|
+
default: 'srgb',
|
|
436
|
+
options: [{ name: 'sRGB', value: 'srgb' }, { name: 'Display P3', value: 'display-p3' }],
|
|
437
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['colorSpace'] } },
|
|
438
|
+
},
|
|
439
|
+
{ displayName: 'Target Size (KB)', name: 'multiTargetSizeKB', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['targetSizeKB'] } } },
|
|
440
|
+
{ displayName: 'Quality', name: 'multiQuality', type: 'number', default: 82, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['quality'] } } },
|
|
441
|
+
{
|
|
442
|
+
displayName: 'Keep Metadata',
|
|
443
|
+
name: 'multiKeepMetadata',
|
|
444
|
+
type: 'boolean',
|
|
445
|
+
default: false,
|
|
446
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['keepMetadata'] } },
|
|
447
|
+
},
|
|
448
|
+
{ displayName: 'Blur', name: 'multiBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['blur'] } } },
|
|
449
|
+
{ displayName: 'Sharpen', name: 'multiSharpen', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['sharpen'] } } },
|
|
450
|
+
{ displayName: 'Grayscale', name: 'multiGrayscale', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['grayscale'] } } },
|
|
451
|
+
{ displayName: 'Sepia', name: 'multiSepia', type: 'boolean', default: false, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['sepia'] } } },
|
|
452
|
+
{ displayName: 'Brightness', name: 'multiBrightness', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['brightness'] } } },
|
|
453
|
+
{ displayName: 'Contrast', name: 'multiContrast', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['contrast'] } } },
|
|
454
|
+
{ displayName: 'Saturation', name: 'multiSaturation', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['saturation'] } } },
|
|
455
|
+
{ displayName: 'Pad', name: 'multiPad', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pad'] } } },
|
|
456
|
+
{
|
|
457
|
+
displayName: 'Pad Sides',
|
|
458
|
+
name: 'multiPadSides',
|
|
459
|
+
type: 'boolean',
|
|
460
|
+
default: false,
|
|
461
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } },
|
|
462
|
+
},
|
|
463
|
+
{ displayName: 'Pad Top', name: 'multiPadTop', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
|
|
464
|
+
{ displayName: 'Pad Right', name: 'multiPadRight', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
|
|
465
|
+
{ displayName: 'Pad Bottom', name: 'multiPadBottom', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
|
|
466
|
+
{ displayName: 'Pad Left', name: 'multiPadLeft', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padSides'] } } },
|
|
467
|
+
{ displayName: 'Pad Color', name: 'multiPadColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['padColor'] } } },
|
|
468
|
+
{ displayName: 'Border', name: 'multiBorder', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['border'] } } },
|
|
469
|
+
{ displayName: 'Border Color', name: 'multiBorderColor', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['borderColor'] } } },
|
|
470
|
+
{ displayName: 'Border Radius', name: 'multiBorderRadius', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['borderRadius'] } } },
|
|
471
|
+
{ displayName: 'Background Blur', name: 'multiBackgroundBlur', type: 'number', default: 0, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['backgroundBlur'] } } },
|
|
472
|
+
{ displayName: 'Watermark Text', name: 'multiWatermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
|
|
473
|
+
{ displayName: 'Watermark Font Size', name: 'multiWatermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
|
|
474
|
+
{ displayName: 'Watermark Color', name: 'multiWatermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
|
|
475
|
+
{ displayName: 'Watermark Opacity', name: 'multiWatermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
|
|
476
|
+
{
|
|
477
|
+
displayName: 'Watermark Position',
|
|
478
|
+
name: 'multiWatermarkPosition',
|
|
479
|
+
type: 'options',
|
|
480
|
+
default: 'center',
|
|
481
|
+
options: [
|
|
482
|
+
{ name: 'Center', value: 'center' },
|
|
483
|
+
{ name: 'Top Left', value: 'top-left' },
|
|
484
|
+
{ name: 'Top Right', value: 'top-right' },
|
|
485
|
+
{ name: 'Bottom Left', value: 'bottom-left' },
|
|
486
|
+
{ name: 'Bottom Right', value: 'bottom-right' },
|
|
487
|
+
],
|
|
488
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } },
|
|
489
|
+
},
|
|
490
|
+
{ displayName: 'Watermark Margin', name: 'multiWatermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
|
|
491
|
+
{ displayName: 'Watermark Scale', name: 'multiWatermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } } },
|
|
492
|
+
{
|
|
493
|
+
displayName: 'Watermark Image Binary Property',
|
|
494
|
+
name: 'multiWatermarkImageBinaryProp',
|
|
495
|
+
type: 'string',
|
|
496
|
+
default: '',
|
|
497
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['watermark'] } },
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
displayName: 'PDF Mode',
|
|
501
|
+
name: 'multiPdfMode',
|
|
502
|
+
type: 'options',
|
|
503
|
+
default: 'single',
|
|
504
|
+
options: [
|
|
505
|
+
{ name: 'Single', value: 'single' },
|
|
506
|
+
{ name: 'Multi', value: 'multi' },
|
|
507
|
+
],
|
|
508
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
displayName: 'PDF Page Size',
|
|
512
|
+
name: 'multiPdfPageSize',
|
|
513
|
+
type: 'options',
|
|
514
|
+
default: 'auto',
|
|
515
|
+
options: [
|
|
516
|
+
{ name: 'Auto', value: 'auto' },
|
|
517
|
+
{ name: 'A4', value: 'a4' },
|
|
518
|
+
{ name: 'Letter', value: 'letter' },
|
|
519
|
+
],
|
|
520
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
displayName: 'PDF Orientation',
|
|
524
|
+
name: 'multiPdfOrientation',
|
|
525
|
+
type: 'options',
|
|
526
|
+
default: 'portrait',
|
|
527
|
+
options: [
|
|
528
|
+
{ name: 'Portrait', value: 'portrait' },
|
|
529
|
+
{ name: 'Landscape', value: 'landscape' },
|
|
530
|
+
],
|
|
531
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
displayName: 'PDF Margin',
|
|
535
|
+
name: 'multiPdfMargin',
|
|
536
|
+
type: 'number',
|
|
537
|
+
default: 0,
|
|
538
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
displayName: 'PDF Embed Format',
|
|
542
|
+
name: 'multiPdfEmbedFormat',
|
|
543
|
+
type: 'options',
|
|
544
|
+
default: 'png',
|
|
545
|
+
options: [
|
|
546
|
+
{ name: 'PNG', value: 'png' },
|
|
547
|
+
{ name: 'JPEG', value: 'jpeg' },
|
|
548
|
+
],
|
|
549
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
displayName: 'PDF JPEG Quality',
|
|
553
|
+
name: 'multiPdfJpegQuality',
|
|
554
|
+
type: 'number',
|
|
555
|
+
default: 85,
|
|
556
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['pdf'] } },
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
displayName: 'Include Raw EXIF',
|
|
560
|
+
name: 'multiIncludeRawExif',
|
|
561
|
+
type: 'boolean',
|
|
562
|
+
default: false,
|
|
563
|
+
displayOptions: { show: { resource: ['image'], operation: ['multitask'], imageMultitaskOptions: ['includeRawExif'] } },
|
|
201
564
|
},
|
|
202
565
|
{
|
|
203
566
|
displayName: 'Download Result(s) as Binary',
|
|
204
567
|
name: 'imageDownloadBinary',
|
|
205
568
|
type: 'boolean',
|
|
206
569
|
default: false,
|
|
207
|
-
displayOptions: {
|
|
570
|
+
displayOptions: {
|
|
571
|
+
show: {
|
|
572
|
+
resource: ['image'],
|
|
573
|
+
operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask'],
|
|
574
|
+
},
|
|
575
|
+
},
|
|
208
576
|
},
|
|
209
577
|
{
|
|
210
578
|
displayName: 'Output Binary Property',
|
|
211
579
|
name: 'imageOutputBinaryProperty',
|
|
212
580
|
type: 'string',
|
|
213
581
|
default: 'data',
|
|
214
|
-
displayOptions: {
|
|
582
|
+
displayOptions: {
|
|
583
|
+
show: {
|
|
584
|
+
resource: ['image'],
|
|
585
|
+
operation: ['format', 'resize', 'crop', 'transform', 'compress', 'enhance', 'padding', 'frame', 'background', 'watermark', 'pdf', 'multitask'],
|
|
586
|
+
imageDownloadBinary: [true],
|
|
587
|
+
},
|
|
588
|
+
},
|
|
215
589
|
},
|
|
216
590
|
// -------------------------
|
|
217
591
|
// PDF
|
|
218
592
|
// -------------------------
|
|
219
|
-
{
|
|
220
|
-
displayName: 'Action',
|
|
221
|
-
name: 'pdfAction',
|
|
222
|
-
type: 'options',
|
|
223
|
-
default: 'merge',
|
|
224
|
-
options: [
|
|
225
|
-
{ name: 'Merge', value: 'merge' },
|
|
226
|
-
{ name: 'Split', value: 'split' },
|
|
227
|
-
{ name: 'Compress', value: 'compress' },
|
|
228
|
-
{ name: 'To Images', value: 'to-images' },
|
|
229
|
-
{ name: 'Extract Images', value: 'extract-images' },
|
|
230
|
-
],
|
|
231
|
-
displayOptions: { show: { resource: ['pdf'] } },
|
|
232
|
-
},
|
|
233
593
|
{
|
|
234
594
|
displayName: 'Input Binary Properties',
|
|
235
595
|
name: 'pdfBinaryProps',
|
|
@@ -244,7 +604,7 @@ class DavixH2I {
|
|
|
244
604
|
name: 'sortByName',
|
|
245
605
|
type: 'boolean',
|
|
246
606
|
default: false,
|
|
247
|
-
displayOptions: { show: { resource: ['pdf'],
|
|
607
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['merge'] } },
|
|
248
608
|
},
|
|
249
609
|
{
|
|
250
610
|
displayName: 'Ranges',
|
|
@@ -252,14 +612,14 @@ class DavixH2I {
|
|
|
252
612
|
type: 'string',
|
|
253
613
|
default: '',
|
|
254
614
|
placeholder: '1-3,4-5',
|
|
255
|
-
displayOptions: { show: { resource: ['pdf'],
|
|
615
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['split'] } },
|
|
256
616
|
},
|
|
257
617
|
{
|
|
258
618
|
displayName: 'Prefix',
|
|
259
619
|
name: 'prefix',
|
|
260
620
|
type: 'string',
|
|
261
621
|
default: 'split_',
|
|
262
|
-
displayOptions: { show: { resource: ['pdf'],
|
|
622
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['split', 'extract'] } },
|
|
263
623
|
},
|
|
264
624
|
{
|
|
265
625
|
displayName: 'Pages',
|
|
@@ -267,7 +627,9 @@ class DavixH2I {
|
|
|
267
627
|
type: 'string',
|
|
268
628
|
default: 'all',
|
|
269
629
|
placeholder: 'all OR 1-3,5,7',
|
|
270
|
-
displayOptions: {
|
|
630
|
+
displayOptions: {
|
|
631
|
+
show: { resource: ['pdf'], operation: ['to-images', 'extract-images', 'watermark', 'rotate', 'delete-pages', 'extract'] },
|
|
632
|
+
},
|
|
271
633
|
},
|
|
272
634
|
{
|
|
273
635
|
displayName: 'To Format',
|
|
@@ -279,14 +641,14 @@ class DavixH2I {
|
|
|
279
641
|
{ name: 'JPEG', value: 'jpeg' },
|
|
280
642
|
{ name: 'WebP', value: 'webp' },
|
|
281
643
|
],
|
|
282
|
-
displayOptions: { show: { resource: ['pdf'],
|
|
644
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['to-images'] } },
|
|
283
645
|
},
|
|
284
|
-
{ displayName: 'Width', name: 'pdfWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'],
|
|
285
|
-
{ displayName: 'Height', name: 'pdfHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'],
|
|
286
|
-
{ displayName: 'DPI', name: 'dpi', type: 'number', default: 150, displayOptions: { show: { resource: ['pdf'],
|
|
646
|
+
{ displayName: 'Width', name: 'pdfWidth', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'], operation: ['to-images'] } } },
|
|
647
|
+
{ displayName: 'Height', name: 'pdfHeight', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'], operation: ['to-images'] } } },
|
|
648
|
+
{ displayName: 'DPI', name: 'dpi', type: 'number', default: 150, displayOptions: { show: { resource: ['pdf'], operation: ['to-images'] } } },
|
|
287
649
|
{
|
|
288
650
|
displayName: 'Extract Image Format',
|
|
289
|
-
name: '
|
|
651
|
+
name: 'extractImageFormat',
|
|
290
652
|
type: 'options',
|
|
291
653
|
default: 'png',
|
|
292
654
|
options: [
|
|
@@ -294,8 +656,49 @@ class DavixH2I {
|
|
|
294
656
|
{ name: 'JPEG', value: 'jpeg' },
|
|
295
657
|
{ name: 'WebP', value: 'webp' },
|
|
296
658
|
],
|
|
297
|
-
displayOptions: { show: { resource: ['pdf'],
|
|
659
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['extract-images'] } },
|
|
298
660
|
},
|
|
661
|
+
{ displayName: 'Watermark Text', name: 'watermarkText', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
|
|
662
|
+
{ displayName: 'Watermark Opacity', name: 'watermarkOpacity', type: 'number', default: 0.35, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
|
|
663
|
+
{
|
|
664
|
+
displayName: 'Watermark Position',
|
|
665
|
+
name: 'watermarkPosition',
|
|
666
|
+
type: 'options',
|
|
667
|
+
default: 'center',
|
|
668
|
+
options: [
|
|
669
|
+
{ name: 'Center', value: 'center' },
|
|
670
|
+
{ name: 'Top Left', value: 'top-left' },
|
|
671
|
+
{ name: 'Top Right', value: 'top-right' },
|
|
672
|
+
{ name: 'Bottom Left', value: 'bottom-left' },
|
|
673
|
+
{ name: 'Bottom Right', value: 'bottom-right' },
|
|
674
|
+
],
|
|
675
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } },
|
|
676
|
+
},
|
|
677
|
+
{ displayName: 'Watermark Margin', name: 'watermarkMargin', type: 'number', default: 8, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
|
|
678
|
+
{ displayName: 'Watermark Font Size', name: 'watermarkFontSize', type: 'number', default: 24, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
|
|
679
|
+
{ displayName: 'Watermark Color', name: 'watermarkColor', type: 'string', default: '#000000', displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
|
|
680
|
+
{ displayName: 'Watermark Scale', name: 'watermarkScale', type: 'number', default: 1, displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } } },
|
|
681
|
+
{
|
|
682
|
+
displayName: 'Watermark Image Binary Property',
|
|
683
|
+
name: 'watermarkImageBinaryProp',
|
|
684
|
+
type: 'string',
|
|
685
|
+
default: '',
|
|
686
|
+
displayOptions: { show: { resource: ['pdf'], operation: ['watermark'] } },
|
|
687
|
+
},
|
|
688
|
+
{ displayName: 'Degrees', name: 'degrees', type: 'number', default: 0, displayOptions: { show: { resource: ['pdf'], operation: ['rotate'] } } },
|
|
689
|
+
{ displayName: 'Title', name: 'title', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
690
|
+
{ displayName: 'Author', name: 'author', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
691
|
+
{ displayName: 'Subject', name: 'subject', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
692
|
+
{ displayName: 'Keywords', name: 'keywords', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
693
|
+
{ displayName: 'Creator', name: 'creator', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
694
|
+
{ displayName: 'Producer', name: 'producer', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
695
|
+
{ displayName: 'Clean All Metadata', name: 'cleanAllMetadata', type: 'boolean', default: false, displayOptions: { show: { resource: ['pdf'], operation: ['metadata'] } } },
|
|
696
|
+
{ displayName: 'Order (JSON array)', name: 'order', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['reorder'] } } },
|
|
697
|
+
{ displayName: 'Mode', name: 'mode', type: 'string', default: 'range', displayOptions: { show: { resource: ['pdf'], operation: ['extract'] } } },
|
|
698
|
+
{ displayName: 'Flatten Forms', name: 'flattenForms', type: 'boolean', default: false, displayOptions: { show: { resource: ['pdf'], operation: ['flatten'] } } },
|
|
699
|
+
{ displayName: 'User Password', name: 'userPassword', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['encrypt'] } } },
|
|
700
|
+
{ displayName: 'Owner Password', name: 'ownerPassword', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['encrypt'] } } },
|
|
701
|
+
{ displayName: 'Password', name: 'password', type: 'string', default: '', displayOptions: { show: { resource: ['pdf'], operation: ['decrypt'] } } },
|
|
299
702
|
{
|
|
300
703
|
displayName: 'Download Result(s) as Binary',
|
|
301
704
|
name: 'pdfDownloadBinary',
|
|
@@ -322,6 +725,20 @@ class DavixH2I {
|
|
|
322
725
|
description: 'Comma-separated binary property names (each will be sent as an `images` file).',
|
|
323
726
|
displayOptions: { show: { resource: ['tools'] } },
|
|
324
727
|
},
|
|
728
|
+
{
|
|
729
|
+
displayName: 'Tool',
|
|
730
|
+
name: 'tool',
|
|
731
|
+
type: 'options',
|
|
732
|
+
default: 'metadata',
|
|
733
|
+
options: [
|
|
734
|
+
{ name: 'Metadata', value: 'metadata' },
|
|
735
|
+
{ name: 'Colors', value: 'colors' },
|
|
736
|
+
{ name: 'Detect Format', value: 'detect-format' },
|
|
737
|
+
{ name: 'Orientation', value: 'orientation' },
|
|
738
|
+
{ name: 'Hash', value: 'hash' },
|
|
739
|
+
],
|
|
740
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
741
|
+
},
|
|
325
742
|
{
|
|
326
743
|
displayName: 'Tools',
|
|
327
744
|
name: 'tools',
|
|
@@ -334,10 +751,54 @@ class DavixH2I {
|
|
|
334
751
|
{ name: 'Orientation', value: 'orientation' },
|
|
335
752
|
{ name: 'Hash', value: 'hash' },
|
|
336
753
|
],
|
|
337
|
-
displayOptions: { show: { resource: ['tools'] } },
|
|
754
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'] } },
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
displayName: 'Multitask Options',
|
|
758
|
+
name: 'toolsMultitaskOptions',
|
|
759
|
+
type: 'multiOptions',
|
|
760
|
+
default: [],
|
|
761
|
+
options: [
|
|
762
|
+
{ name: 'Include Raw EXIF', value: 'includeRawExif' },
|
|
763
|
+
{ name: 'Palette Size', value: 'paletteSize' },
|
|
764
|
+
{ name: 'Hash Type', value: 'hashType' },
|
|
765
|
+
{ name: 'Quality Sample', value: 'qualitySample' },
|
|
766
|
+
{ name: 'Transparency Sample', value: 'transparencySample' },
|
|
767
|
+
{ name: 'Similarity Mode', value: 'similarityMode' },
|
|
768
|
+
{ name: 'Similarity Threshold', value: 'similarityThreshold' },
|
|
769
|
+
{ name: 'Efficiency Format', value: 'efficiencyFormat' },
|
|
770
|
+
{ name: 'Efficiency Quality', value: 'efficiencyQuality' },
|
|
771
|
+
],
|
|
772
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'] } },
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
displayName: 'Include Raw EXIF',
|
|
776
|
+
name: 'includeRawExif',
|
|
777
|
+
type: 'boolean',
|
|
778
|
+
default: false,
|
|
779
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
displayName: 'Include Raw EXIF',
|
|
783
|
+
name: 'multiIncludeRawExif',
|
|
784
|
+
type: 'boolean',
|
|
785
|
+
default: false,
|
|
786
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['includeRawExif'] } },
|
|
787
|
+
},
|
|
788
|
+
{
|
|
789
|
+
displayName: 'Palette Size',
|
|
790
|
+
name: 'paletteSize',
|
|
791
|
+
type: 'number',
|
|
792
|
+
default: 5,
|
|
793
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
displayName: 'Palette Size',
|
|
797
|
+
name: 'multiPaletteSize',
|
|
798
|
+
type: 'number',
|
|
799
|
+
default: 5,
|
|
800
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['paletteSize'] } },
|
|
338
801
|
},
|
|
339
|
-
{ displayName: 'Include Raw EXIF', name: 'includeRawExif', type: 'boolean', default: false, displayOptions: { show: { resource: ['tools'] } } },
|
|
340
|
-
{ displayName: 'Palette Size', name: 'paletteSize', type: 'number', default: 5, displayOptions: { show: { resource: ['tools'] } } },
|
|
341
802
|
{
|
|
342
803
|
displayName: 'Hash Type',
|
|
343
804
|
name: 'hashType',
|
|
@@ -348,7 +809,103 @@ class DavixH2I {
|
|
|
348
809
|
{ name: 'MD5', value: 'md5' },
|
|
349
810
|
{ name: 'SHA1', value: 'sha1' },
|
|
350
811
|
],
|
|
351
|
-
displayOptions: { show: { resource: ['tools'] } },
|
|
812
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
displayName: 'Hash Type',
|
|
816
|
+
name: 'multiHashType',
|
|
817
|
+
type: 'options',
|
|
818
|
+
default: 'phash',
|
|
819
|
+
options: [
|
|
820
|
+
{ name: 'pHash', value: 'phash' },
|
|
821
|
+
{ name: 'MD5', value: 'md5' },
|
|
822
|
+
{ name: 'SHA1', value: 'sha1' },
|
|
823
|
+
],
|
|
824
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['hashType'] } },
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
displayName: 'Quality Sample',
|
|
828
|
+
name: 'qualitySample',
|
|
829
|
+
type: 'number',
|
|
830
|
+
default: 0,
|
|
831
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
displayName: 'Quality Sample',
|
|
835
|
+
name: 'multiQualitySample',
|
|
836
|
+
type: 'number',
|
|
837
|
+
default: 0,
|
|
838
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['qualitySample'] } },
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
displayName: 'Transparency Sample',
|
|
842
|
+
name: 'transparencySample',
|
|
843
|
+
type: 'number',
|
|
844
|
+
default: 0,
|
|
845
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
displayName: 'Transparency Sample',
|
|
849
|
+
name: 'multiTransparencySample',
|
|
850
|
+
type: 'number',
|
|
851
|
+
default: 0,
|
|
852
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['transparencySample'] } },
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
displayName: 'Similarity Mode',
|
|
856
|
+
name: 'similarityMode',
|
|
857
|
+
type: 'string',
|
|
858
|
+
default: '',
|
|
859
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
displayName: 'Similarity Mode',
|
|
863
|
+
name: 'multiSimilarityMode',
|
|
864
|
+
type: 'string',
|
|
865
|
+
default: '',
|
|
866
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['similarityMode'] } },
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
displayName: 'Similarity Threshold',
|
|
870
|
+
name: 'similarityThreshold',
|
|
871
|
+
type: 'number',
|
|
872
|
+
default: 0,
|
|
873
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
displayName: 'Similarity Threshold',
|
|
877
|
+
name: 'multiSimilarityThreshold',
|
|
878
|
+
type: 'number',
|
|
879
|
+
default: 0,
|
|
880
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['similarityThreshold'] } },
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
displayName: 'Efficiency Format',
|
|
884
|
+
name: 'efficiencyFormat',
|
|
885
|
+
type: 'string',
|
|
886
|
+
default: '',
|
|
887
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
displayName: 'Efficiency Format',
|
|
891
|
+
name: 'multiEfficiencyFormat',
|
|
892
|
+
type: 'string',
|
|
893
|
+
default: '',
|
|
894
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['efficiencyFormat'] } },
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
displayName: 'Efficiency Quality',
|
|
898
|
+
name: 'efficiencyQuality',
|
|
899
|
+
type: 'number',
|
|
900
|
+
default: 0,
|
|
901
|
+
displayOptions: { show: { resource: ['tools'], operation: ['single'] } },
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
displayName: 'Efficiency Quality',
|
|
905
|
+
name: 'multiEfficiencyQuality',
|
|
906
|
+
type: 'number',
|
|
907
|
+
default: 0,
|
|
908
|
+
displayOptions: { show: { resource: ['tools'], operation: ['multitask'], toolsMultitaskOptions: ['efficiencyQuality'] } },
|
|
352
909
|
},
|
|
353
910
|
],
|
|
354
911
|
};
|
|
@@ -357,15 +914,74 @@ class DavixH2I {
|
|
|
357
914
|
const out = [];
|
|
358
915
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
359
916
|
const resource = this.getNodeParameter('resource', itemIndex);
|
|
917
|
+
const operation = this.getNodeParameter('operation', itemIndex);
|
|
918
|
+
const gatherFirstUrl = (response) => {
|
|
919
|
+
if (typeof response?.url === 'string')
|
|
920
|
+
return String(response.url);
|
|
921
|
+
if (Array.isArray(response?.results)) {
|
|
922
|
+
for (const r of response.results) {
|
|
923
|
+
if (r?.url)
|
|
924
|
+
return String(r.url);
|
|
925
|
+
if (typeof r === 'string')
|
|
926
|
+
return r;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
return undefined;
|
|
930
|
+
};
|
|
931
|
+
const attachFiles = async (fieldName, propList, formData) => {
|
|
932
|
+
const names = propList
|
|
933
|
+
.split(',')
|
|
934
|
+
.map((s) => s.trim())
|
|
935
|
+
.filter(Boolean);
|
|
936
|
+
if (names.length === 0)
|
|
937
|
+
throw new Error('No binary property names provided.');
|
|
938
|
+
for (const name of names) {
|
|
939
|
+
const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, name);
|
|
940
|
+
const meta = items[itemIndex].binary?.[name];
|
|
941
|
+
const fileName = meta?.fileName ?? `${fieldName}-${name}`;
|
|
942
|
+
const mimeType = meta?.mimeType;
|
|
943
|
+
formData[fieldName] = formData[fieldName] || [];
|
|
944
|
+
formData[fieldName].push({
|
|
945
|
+
value: buffer,
|
|
946
|
+
options: {
|
|
947
|
+
filename: fileName,
|
|
948
|
+
contentType: mimeType,
|
|
949
|
+
},
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
const attachSingleFile = async (fieldName, propName, formData) => {
|
|
954
|
+
if (!propName)
|
|
955
|
+
return;
|
|
956
|
+
const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, propName);
|
|
957
|
+
const meta = items[itemIndex].binary?.[propName];
|
|
958
|
+
const fileName = meta?.fileName ?? fieldName;
|
|
959
|
+
const mimeType = meta?.mimeType;
|
|
960
|
+
formData[fieldName] = {
|
|
961
|
+
value: buffer,
|
|
962
|
+
options: { filename: fileName, contentType: mimeType },
|
|
963
|
+
};
|
|
964
|
+
};
|
|
360
965
|
// ---- H2I (JSON)
|
|
361
966
|
if (resource === 'h2i') {
|
|
967
|
+
const action = operation;
|
|
362
968
|
const body = {
|
|
969
|
+
action,
|
|
363
970
|
html: this.getNodeParameter('html', itemIndex),
|
|
364
971
|
css: this.getNodeParameter('css', itemIndex),
|
|
365
972
|
width: this.getNodeParameter('width', itemIndex),
|
|
366
973
|
height: this.getNodeParameter('height', itemIndex),
|
|
367
|
-
format: this.getNodeParameter('format', itemIndex),
|
|
368
974
|
};
|
|
975
|
+
if (action === 'image') {
|
|
976
|
+
body.format = this.getNodeParameter('format', itemIndex);
|
|
977
|
+
}
|
|
978
|
+
else {
|
|
979
|
+
body.pdfPageSize = this.getNodeParameter('h2iPdfPageSize', itemIndex);
|
|
980
|
+
body.pdfOrientation = this.getNodeParameter('h2iPdfOrientation', itemIndex);
|
|
981
|
+
body.pdfMargin = this.getNodeParameter('h2iPdfMargin', itemIndex);
|
|
982
|
+
body.pdfEmbedFormat = this.getNodeParameter('h2iPdfEmbedFormat', itemIndex);
|
|
983
|
+
body.pdfJpegQuality = this.getNodeParameter('h2iPdfJpegQuality', itemIndex);
|
|
984
|
+
}
|
|
369
985
|
const response = await GenericFunctions_1.davixRequest.call(this, {
|
|
370
986
|
method: 'POST',
|
|
371
987
|
url: '/v1/h2i',
|
|
@@ -373,9 +989,12 @@ class DavixH2I {
|
|
|
373
989
|
body,
|
|
374
990
|
});
|
|
375
991
|
const downloadBinary = this.getNodeParameter('downloadBinary', itemIndex);
|
|
376
|
-
if (downloadBinary
|
|
992
|
+
if (downloadBinary) {
|
|
993
|
+
const firstUrl = gatherFirstUrl(response);
|
|
994
|
+
if (!firstUrl)
|
|
995
|
+
throw new Error('No URL returned to download.');
|
|
377
996
|
const binName = this.getNodeParameter('outputBinaryProperty', itemIndex);
|
|
378
|
-
const dl = await GenericFunctions_1.downloadToBinary.call(this,
|
|
997
|
+
const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, action === 'pdf' ? 'h2i.pdf' : `h2i.${body.format === 'jpeg' ? 'jpg' : body.format ?? 'png'}`);
|
|
379
998
|
const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
|
|
380
999
|
out.push({ json: response, binary: { [binName]: binary } });
|
|
381
1000
|
}
|
|
@@ -384,68 +1003,229 @@ class DavixH2I {
|
|
|
384
1003
|
}
|
|
385
1004
|
continue;
|
|
386
1005
|
}
|
|
387
|
-
// Helper to attach multiple binaries as files
|
|
388
|
-
const attachFiles = async (fieldName, propList, formData) => {
|
|
389
|
-
const names = propList.split(',').map((s) => s.trim()).filter(Boolean);
|
|
390
|
-
if (names.length === 0)
|
|
391
|
-
throw new Error('No binary property names provided.');
|
|
392
|
-
for (const name of names) {
|
|
393
|
-
const buffer = await this.helpers.getBinaryDataBuffer(itemIndex, name);
|
|
394
|
-
const meta = items[itemIndex].binary?.[name];
|
|
395
|
-
const fileName = meta?.fileName ?? `${fieldName}-${name}`;
|
|
396
|
-
const mimeType = meta?.mimeType;
|
|
397
|
-
// n8n request helper supports this shape for multipart file upload
|
|
398
|
-
formData[fieldName] = formData[fieldName] || [];
|
|
399
|
-
formData[fieldName].push({
|
|
400
|
-
value: buffer,
|
|
401
|
-
options: {
|
|
402
|
-
filename: fileName,
|
|
403
|
-
contentType: mimeType,
|
|
404
|
-
},
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
1006
|
// ---- IMAGE (multipart)
|
|
409
1007
|
if (resource === 'image') {
|
|
1008
|
+
const action = operation;
|
|
410
1009
|
const imageBinaryProps = this.getNodeParameter('imageBinaryProps', itemIndex);
|
|
411
1010
|
const format = this.getNodeParameter('imageFormat', itemIndex);
|
|
412
|
-
const formData = {};
|
|
1011
|
+
const formData = { action };
|
|
413
1012
|
await attachFiles('images', imageBinaryProps, formData);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
const cropX = this.getNodeParameter('cropX', itemIndex);
|
|
427
|
-
const cropY = this.getNodeParameter('cropY', itemIndex);
|
|
428
|
-
const cropWidth = this.getNodeParameter('cropWidth', itemIndex);
|
|
429
|
-
const cropHeight = this.getNodeParameter('cropHeight', itemIndex);
|
|
430
|
-
if (cropWidth && cropHeight) {
|
|
431
|
-
formData.cropX = String(cropX);
|
|
432
|
-
formData.cropY = String(cropY);
|
|
433
|
-
formData.cropWidth = String(cropWidth);
|
|
434
|
-
formData.cropHeight = String(cropHeight);
|
|
435
|
-
}
|
|
436
|
-
const targetSizeKB = this.getNodeParameter('targetSizeKB', itemIndex);
|
|
437
|
-
if (targetSizeKB)
|
|
438
|
-
formData.targetSizeKB = String(targetSizeKB);
|
|
439
|
-
formData.quality = String(this.getNodeParameter('quality', itemIndex));
|
|
440
|
-
formData.keepMetadata = toBoolString(this.getNodeParameter('keepMetadata', itemIndex));
|
|
441
|
-
// pdf-only params
|
|
442
|
-
if (format === 'pdf') {
|
|
1013
|
+
const setNumber = (name, value) => {
|
|
1014
|
+
if (value !== undefined && value !== null && value !== 0)
|
|
1015
|
+
formData[name] = String(value);
|
|
1016
|
+
};
|
|
1017
|
+
const setString = (name, value) => {
|
|
1018
|
+
if (value !== undefined && value !== null && value !== '')
|
|
1019
|
+
formData[name] = value;
|
|
1020
|
+
};
|
|
1021
|
+
const setBool = (name, value) => {
|
|
1022
|
+
formData[name] = toBoolString(value);
|
|
1023
|
+
};
|
|
1024
|
+
const includePdfFields = () => {
|
|
443
1025
|
formData.pdfMode = this.getNodeParameter('pdfMode', itemIndex);
|
|
444
1026
|
formData.pdfPageSize = this.getNodeParameter('pdfPageSize', itemIndex);
|
|
445
1027
|
formData.pdfOrientation = this.getNodeParameter('pdfOrientation', itemIndex);
|
|
446
|
-
|
|
1028
|
+
setNumber('pdfMargin', this.getNodeParameter('pdfMargin', itemIndex));
|
|
447
1029
|
formData.pdfEmbedFormat = this.getNodeParameter('pdfEmbedFormat', itemIndex);
|
|
448
|
-
|
|
1030
|
+
setNumber('pdfJpegQuality', this.getNodeParameter('pdfJpegQuality', itemIndex));
|
|
1031
|
+
};
|
|
1032
|
+
const includeWatermarkFile = async (propName) => {
|
|
1033
|
+
if (propName)
|
|
1034
|
+
await attachSingleFile('watermarkImage', propName, formData);
|
|
1035
|
+
};
|
|
1036
|
+
switch (action) {
|
|
1037
|
+
case 'format':
|
|
1038
|
+
formData.format = format;
|
|
1039
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1040
|
+
setNumber('width', this.getNodeParameter('imageWidth', itemIndex));
|
|
1041
|
+
setNumber('height', this.getNodeParameter('imageHeight', itemIndex));
|
|
1042
|
+
break;
|
|
1043
|
+
case 'resize':
|
|
1044
|
+
formData.format = format;
|
|
1045
|
+
setNumber('width', this.getNodeParameter('imageWidth', itemIndex));
|
|
1046
|
+
setNumber('height', this.getNodeParameter('imageHeight', itemIndex));
|
|
1047
|
+
setBool('enlarge', this.getNodeParameter('enlarge', itemIndex));
|
|
1048
|
+
setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
|
|
1049
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1050
|
+
break;
|
|
1051
|
+
case 'crop':
|
|
1052
|
+
formData.format = format;
|
|
1053
|
+
setNumber('cropX', this.getNodeParameter('cropX', itemIndex));
|
|
1054
|
+
setNumber('cropY', this.getNodeParameter('cropY', itemIndex));
|
|
1055
|
+
setNumber('cropWidth', this.getNodeParameter('cropWidth', itemIndex));
|
|
1056
|
+
setNumber('cropHeight', this.getNodeParameter('cropHeight', itemIndex));
|
|
1057
|
+
setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
|
|
1058
|
+
setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
|
|
1059
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1060
|
+
break;
|
|
1061
|
+
case 'transform':
|
|
1062
|
+
formData.format = format;
|
|
1063
|
+
setNumber('rotate', this.getNodeParameter('rotate', itemIndex));
|
|
1064
|
+
setBool('flipH', this.getNodeParameter('flipH', itemIndex));
|
|
1065
|
+
setBool('flipV', this.getNodeParameter('flipV', itemIndex));
|
|
1066
|
+
formData.colorSpace = this.getNodeParameter('colorSpace', itemIndex);
|
|
1067
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1068
|
+
break;
|
|
1069
|
+
case 'compress':
|
|
1070
|
+
formData.format = format;
|
|
1071
|
+
setNumber('targetSizeKB', this.getNodeParameter('targetSizeKB', itemIndex));
|
|
1072
|
+
setNumber('quality', this.getNodeParameter('quality', itemIndex));
|
|
1073
|
+
formData.colorSpace = this.getNodeParameter('colorSpace', itemIndex);
|
|
1074
|
+
setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
|
|
1075
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1076
|
+
break;
|
|
1077
|
+
case 'enhance':
|
|
1078
|
+
formData.format = format;
|
|
1079
|
+
setNumber('blur', this.getNodeParameter('blur', itemIndex));
|
|
1080
|
+
setNumber('sharpen', this.getNodeParameter('sharpen', itemIndex));
|
|
1081
|
+
setBool('grayscale', this.getNodeParameter('grayscale', itemIndex));
|
|
1082
|
+
setBool('sepia', this.getNodeParameter('sepia', itemIndex));
|
|
1083
|
+
setNumber('brightness', this.getNodeParameter('brightness', itemIndex));
|
|
1084
|
+
setNumber('contrast', this.getNodeParameter('contrast', itemIndex));
|
|
1085
|
+
setNumber('saturation', this.getNodeParameter('saturation', itemIndex));
|
|
1086
|
+
setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
|
|
1087
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1088
|
+
break;
|
|
1089
|
+
case 'padding':
|
|
1090
|
+
formData.format = format;
|
|
1091
|
+
setNumber('pad', this.getNodeParameter('pad', itemIndex));
|
|
1092
|
+
if (this.getNodeParameter('padTop', itemIndex) || this.getNodeParameter('padRight', itemIndex) || this.getNodeParameter('padBottom', itemIndex) || this.getNodeParameter('padLeft', itemIndex)) {
|
|
1093
|
+
setNumber('padTop', this.getNodeParameter('padTop', itemIndex));
|
|
1094
|
+
setNumber('padRight', this.getNodeParameter('padRight', itemIndex));
|
|
1095
|
+
setNumber('padBottom', this.getNodeParameter('padBottom', itemIndex));
|
|
1096
|
+
setNumber('padLeft', this.getNodeParameter('padLeft', itemIndex));
|
|
1097
|
+
}
|
|
1098
|
+
setString('padColor', this.getNodeParameter('padColor', itemIndex));
|
|
1099
|
+
setNumber('borderRadius', this.getNodeParameter('borderRadius', itemIndex));
|
|
1100
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1101
|
+
break;
|
|
1102
|
+
case 'frame':
|
|
1103
|
+
formData.format = format;
|
|
1104
|
+
setNumber('border', this.getNodeParameter('border', itemIndex));
|
|
1105
|
+
setString('borderColor', this.getNodeParameter('borderColor', itemIndex));
|
|
1106
|
+
setNumber('pad', this.getNodeParameter('pad', itemIndex));
|
|
1107
|
+
setString('padColor', this.getNodeParameter('padColor', itemIndex));
|
|
1108
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1109
|
+
break;
|
|
1110
|
+
case 'background':
|
|
1111
|
+
formData.format = format;
|
|
1112
|
+
setString('backgroundColor', this.getNodeParameter('backgroundColor', itemIndex));
|
|
1113
|
+
setNumber('backgroundBlur', this.getNodeParameter('backgroundBlur', itemIndex));
|
|
1114
|
+
setNumber('borderRadius', this.getNodeParameter('borderRadius', itemIndex));
|
|
1115
|
+
setString('padColor', this.getNodeParameter('padColor', itemIndex));
|
|
1116
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1117
|
+
break;
|
|
1118
|
+
case 'watermark':
|
|
1119
|
+
formData.format = format;
|
|
1120
|
+
setString('watermarkText', this.getNodeParameter('watermarkText', itemIndex));
|
|
1121
|
+
setNumber('watermarkFontSize', this.getNodeParameter('watermarkFontSize', itemIndex));
|
|
1122
|
+
setString('watermarkColor', this.getNodeParameter('watermarkColor', itemIndex));
|
|
1123
|
+
setNumber('watermarkOpacity', this.getNodeParameter('watermarkOpacity', itemIndex));
|
|
1124
|
+
formData.watermarkPosition = this.getNodeParameter('watermarkPosition', itemIndex);
|
|
1125
|
+
setNumber('watermarkMargin', this.getNodeParameter('watermarkMargin', itemIndex));
|
|
1126
|
+
setNumber('watermarkScale', this.getNodeParameter('watermarkScale', itemIndex));
|
|
1127
|
+
await includeWatermarkFile(this.getNodeParameter('watermarkImageBinaryProp', itemIndex));
|
|
1128
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1129
|
+
break;
|
|
1130
|
+
case 'pdf':
|
|
1131
|
+
formData.format = 'pdf';
|
|
1132
|
+
includePdfFields();
|
|
1133
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1134
|
+
break;
|
|
1135
|
+
case 'metadata':
|
|
1136
|
+
setBool('normalizeOrientation', this.getNodeParameter('normalizeOrientation', itemIndex));
|
|
1137
|
+
setBool('keepMetadata', this.getNodeParameter('keepMetadata', itemIndex));
|
|
1138
|
+
setBool('includeRawExif', this.getNodeParameter('includeRawExif', itemIndex));
|
|
1139
|
+
break;
|
|
1140
|
+
case 'multitask': {
|
|
1141
|
+
formData.format = format;
|
|
1142
|
+
const options = this.getNodeParameter('imageMultitaskOptions', itemIndex);
|
|
1143
|
+
const has = (key) => options.includes(key);
|
|
1144
|
+
if (has('width'))
|
|
1145
|
+
setNumber('width', this.getNodeParameter('multiWidth', itemIndex));
|
|
1146
|
+
if (has('height'))
|
|
1147
|
+
setNumber('height', this.getNodeParameter('multiHeight', itemIndex));
|
|
1148
|
+
if (has('enlarge'))
|
|
1149
|
+
setBool('enlarge', this.getNodeParameter('multiEnlarge', itemIndex));
|
|
1150
|
+
if (has('normalizeOrientation'))
|
|
1151
|
+
setBool('normalizeOrientation', this.getNodeParameter('multiNormalizeOrientation', itemIndex));
|
|
1152
|
+
if (has('crop')) {
|
|
1153
|
+
setNumber('cropX', this.getNodeParameter('multiCropX', itemIndex));
|
|
1154
|
+
setNumber('cropY', this.getNodeParameter('multiCropY', itemIndex));
|
|
1155
|
+
setNumber('cropWidth', this.getNodeParameter('multiCropWidth', itemIndex));
|
|
1156
|
+
setNumber('cropHeight', this.getNodeParameter('multiCropHeight', itemIndex));
|
|
1157
|
+
}
|
|
1158
|
+
if (has('backgroundColor'))
|
|
1159
|
+
setString('backgroundColor', this.getNodeParameter('multiBackgroundColor', itemIndex));
|
|
1160
|
+
if (has('rotate'))
|
|
1161
|
+
setNumber('rotate', this.getNodeParameter('multiRotate', itemIndex));
|
|
1162
|
+
if (has('flipH'))
|
|
1163
|
+
setBool('flipH', this.getNodeParameter('multiFlipH', itemIndex));
|
|
1164
|
+
if (has('flipV'))
|
|
1165
|
+
setBool('flipV', this.getNodeParameter('multiFlipV', itemIndex));
|
|
1166
|
+
if (has('colorSpace'))
|
|
1167
|
+
formData.colorSpace = this.getNodeParameter('multiColorSpace', itemIndex);
|
|
1168
|
+
if (has('targetSizeKB'))
|
|
1169
|
+
setNumber('targetSizeKB', this.getNodeParameter('multiTargetSizeKB', itemIndex));
|
|
1170
|
+
if (has('quality'))
|
|
1171
|
+
setNumber('quality', this.getNodeParameter('multiQuality', itemIndex));
|
|
1172
|
+
if (has('keepMetadata'))
|
|
1173
|
+
setBool('keepMetadata', this.getNodeParameter('multiKeepMetadata', itemIndex));
|
|
1174
|
+
if (has('blur'))
|
|
1175
|
+
setNumber('blur', this.getNodeParameter('multiBlur', itemIndex));
|
|
1176
|
+
if (has('sharpen'))
|
|
1177
|
+
setNumber('sharpen', this.getNodeParameter('multiSharpen', itemIndex));
|
|
1178
|
+
if (has('grayscale'))
|
|
1179
|
+
setBool('grayscale', this.getNodeParameter('multiGrayscale', itemIndex));
|
|
1180
|
+
if (has('sepia'))
|
|
1181
|
+
setBool('sepia', this.getNodeParameter('multiSepia', itemIndex));
|
|
1182
|
+
if (has('brightness'))
|
|
1183
|
+
setNumber('brightness', this.getNodeParameter('multiBrightness', itemIndex));
|
|
1184
|
+
if (has('contrast'))
|
|
1185
|
+
setNumber('contrast', this.getNodeParameter('multiContrast', itemIndex));
|
|
1186
|
+
if (has('saturation'))
|
|
1187
|
+
setNumber('saturation', this.getNodeParameter('multiSaturation', itemIndex));
|
|
1188
|
+
if (has('pad'))
|
|
1189
|
+
setNumber('pad', this.getNodeParameter('multiPad', itemIndex));
|
|
1190
|
+
if (has('padSides')) {
|
|
1191
|
+
setBool('padSides', this.getNodeParameter('multiPadSides', itemIndex));
|
|
1192
|
+
setNumber('padTop', this.getNodeParameter('multiPadTop', itemIndex));
|
|
1193
|
+
setNumber('padRight', this.getNodeParameter('multiPadRight', itemIndex));
|
|
1194
|
+
setNumber('padBottom', this.getNodeParameter('multiPadBottom', itemIndex));
|
|
1195
|
+
setNumber('padLeft', this.getNodeParameter('multiPadLeft', itemIndex));
|
|
1196
|
+
}
|
|
1197
|
+
if (has('padColor'))
|
|
1198
|
+
setString('padColor', this.getNodeParameter('multiPadColor', itemIndex));
|
|
1199
|
+
if (has('border'))
|
|
1200
|
+
setNumber('border', this.getNodeParameter('multiBorder', itemIndex));
|
|
1201
|
+
if (has('borderColor'))
|
|
1202
|
+
setString('borderColor', this.getNodeParameter('multiBorderColor', itemIndex));
|
|
1203
|
+
if (has('borderRadius'))
|
|
1204
|
+
setNumber('borderRadius', this.getNodeParameter('multiBorderRadius', itemIndex));
|
|
1205
|
+
if (has('backgroundBlur'))
|
|
1206
|
+
setNumber('backgroundBlur', this.getNodeParameter('multiBackgroundBlur', itemIndex));
|
|
1207
|
+
if (has('watermark')) {
|
|
1208
|
+
setString('watermarkText', this.getNodeParameter('multiWatermarkText', itemIndex));
|
|
1209
|
+
setNumber('watermarkFontSize', this.getNodeParameter('multiWatermarkFontSize', itemIndex));
|
|
1210
|
+
setString('watermarkColor', this.getNodeParameter('multiWatermarkColor', itemIndex));
|
|
1211
|
+
setNumber('watermarkOpacity', this.getNodeParameter('multiWatermarkOpacity', itemIndex));
|
|
1212
|
+
formData.watermarkPosition = this.getNodeParameter('multiWatermarkPosition', itemIndex);
|
|
1213
|
+
setNumber('watermarkMargin', this.getNodeParameter('multiWatermarkMargin', itemIndex));
|
|
1214
|
+
setNumber('watermarkScale', this.getNodeParameter('multiWatermarkScale', itemIndex));
|
|
1215
|
+
await includeWatermarkFile(this.getNodeParameter('multiWatermarkImageBinaryProp', itemIndex));
|
|
1216
|
+
}
|
|
1217
|
+
if (has('pdf')) {
|
|
1218
|
+
formData.pdfMode = this.getNodeParameter('multiPdfMode', itemIndex);
|
|
1219
|
+
formData.pdfPageSize = this.getNodeParameter('multiPdfPageSize', itemIndex);
|
|
1220
|
+
formData.pdfOrientation = this.getNodeParameter('multiPdfOrientation', itemIndex);
|
|
1221
|
+
setNumber('pdfMargin', this.getNodeParameter('multiPdfMargin', itemIndex));
|
|
1222
|
+
formData.pdfEmbedFormat = this.getNodeParameter('multiPdfEmbedFormat', itemIndex);
|
|
1223
|
+
setNumber('pdfJpegQuality', this.getNodeParameter('multiPdfJpegQuality', itemIndex));
|
|
1224
|
+
}
|
|
1225
|
+
if (has('includeRawExif'))
|
|
1226
|
+
setBool('includeRawExif', this.getNodeParameter('multiIncludeRawExif', itemIndex));
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
449
1229
|
}
|
|
450
1230
|
const response = await GenericFunctions_1.davixRequest.call(this, {
|
|
451
1231
|
method: 'POST',
|
|
@@ -453,31 +1233,16 @@ class DavixH2I {
|
|
|
453
1233
|
formData,
|
|
454
1234
|
json: true,
|
|
455
1235
|
});
|
|
456
|
-
|
|
457
|
-
const downloadBinary = this.getNodeParameter('imageDownloadBinary', itemIndex);
|
|
1236
|
+
const downloadBinary = ['metadata'].includes(action) ? false : this.getNodeParameter('imageDownloadBinary', itemIndex);
|
|
458
1237
|
if (downloadBinary) {
|
|
1238
|
+
const firstUrl = gatherFirstUrl(response);
|
|
1239
|
+
if (!firstUrl)
|
|
1240
|
+
throw new Error('No URL returned to download.');
|
|
459
1241
|
const binName = this.getNodeParameter('imageOutputBinaryProperty', itemIndex);
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
urls.push(response.url);
|
|
465
|
-
if (Array.isArray(response.results)) {
|
|
466
|
-
for (const r of response.results) {
|
|
467
|
-
if (r?.url)
|
|
468
|
-
urls.push(String(r.url));
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (urls.length) {
|
|
472
|
-
const firstUrl = urls[0];
|
|
473
|
-
const ext = format === 'jpeg' ? 'jpg' : format;
|
|
474
|
-
const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-image.${ext}`);
|
|
475
|
-
const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
|
|
476
|
-
out.push({ json: response, binary: { [binName]: binary } });
|
|
477
|
-
}
|
|
478
|
-
else {
|
|
479
|
-
out.push({ json: response });
|
|
480
|
-
}
|
|
1242
|
+
const ext = format === 'jpeg' ? 'jpg' : format;
|
|
1243
|
+
const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-image.${ext}`);
|
|
1244
|
+
const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
|
|
1245
|
+
out.push({ json: response, binary: { [binName]: binary } });
|
|
481
1246
|
}
|
|
482
1247
|
else {
|
|
483
1248
|
out.push({ json: response });
|
|
@@ -486,32 +1251,83 @@ class DavixH2I {
|
|
|
486
1251
|
}
|
|
487
1252
|
// ---- PDF (multipart)
|
|
488
1253
|
if (resource === 'pdf') {
|
|
489
|
-
const action =
|
|
1254
|
+
const action = operation;
|
|
490
1255
|
const pdfBinaryProps = this.getNodeParameter('pdfBinaryProps', itemIndex);
|
|
491
|
-
const formData = {};
|
|
1256
|
+
const formData = { action };
|
|
492
1257
|
await attachFiles('files', pdfBinaryProps, formData);
|
|
493
|
-
|
|
1258
|
+
const setNumber = (name, value) => {
|
|
1259
|
+
if (value !== undefined && value !== null && value !== 0)
|
|
1260
|
+
formData[name] = String(value);
|
|
1261
|
+
};
|
|
1262
|
+
const setString = (name, value) => {
|
|
1263
|
+
if (value)
|
|
1264
|
+
formData[name] = value;
|
|
1265
|
+
};
|
|
1266
|
+
const setBool = (name, value) => {
|
|
1267
|
+
formData[name] = toBoolString(value);
|
|
1268
|
+
};
|
|
494
1269
|
if (action === 'merge') {
|
|
495
|
-
|
|
1270
|
+
setBool('sortByName', this.getNodeParameter('sortByName', itemIndex));
|
|
496
1271
|
}
|
|
497
1272
|
if (action === 'split') {
|
|
498
|
-
|
|
499
|
-
|
|
1273
|
+
setString('ranges', this.getNodeParameter('ranges', itemIndex));
|
|
1274
|
+
setString('prefix', this.getNodeParameter('prefix', itemIndex));
|
|
500
1275
|
}
|
|
501
1276
|
if (action === 'to-images') {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
formData.width = String(w);
|
|
508
|
-
if (h)
|
|
509
|
-
formData.height = String(h);
|
|
510
|
-
formData.dpi = String(this.getNodeParameter('dpi', itemIndex));
|
|
1277
|
+
setString('pages', this.getNodeParameter('pages', itemIndex));
|
|
1278
|
+
setString('toFormat', this.getNodeParameter('toFormat', itemIndex));
|
|
1279
|
+
setNumber('width', this.getNodeParameter('pdfWidth', itemIndex));
|
|
1280
|
+
setNumber('height', this.getNodeParameter('pdfHeight', itemIndex));
|
|
1281
|
+
setNumber('dpi', this.getNodeParameter('dpi', itemIndex));
|
|
511
1282
|
}
|
|
512
1283
|
if (action === 'extract-images') {
|
|
513
|
-
|
|
514
|
-
|
|
1284
|
+
setString('pages', this.getNodeParameter('pages', itemIndex));
|
|
1285
|
+
setString('imageFormat', this.getNodeParameter('extractImageFormat', itemIndex));
|
|
1286
|
+
}
|
|
1287
|
+
if (action === 'watermark') {
|
|
1288
|
+
setString('pages', this.getNodeParameter('pages', itemIndex));
|
|
1289
|
+
setString('watermarkText', this.getNodeParameter('watermarkText', itemIndex));
|
|
1290
|
+
setNumber('watermarkOpacity', this.getNodeParameter('watermarkOpacity', itemIndex));
|
|
1291
|
+
setString('watermarkPosition', this.getNodeParameter('watermarkPosition', itemIndex));
|
|
1292
|
+
setNumber('watermarkMargin', this.getNodeParameter('watermarkMargin', itemIndex));
|
|
1293
|
+
setNumber('watermarkFontSize', this.getNodeParameter('watermarkFontSize', itemIndex));
|
|
1294
|
+
setString('watermarkColor', this.getNodeParameter('watermarkColor', itemIndex));
|
|
1295
|
+
setNumber('watermarkScale', this.getNodeParameter('watermarkScale', itemIndex));
|
|
1296
|
+
await attachSingleFile('watermarkImage', this.getNodeParameter('watermarkImageBinaryProp', itemIndex), formData);
|
|
1297
|
+
}
|
|
1298
|
+
if (action === 'rotate') {
|
|
1299
|
+
setNumber('degrees', this.getNodeParameter('degrees', itemIndex));
|
|
1300
|
+
setString('pages', this.getNodeParameter('pages', itemIndex));
|
|
1301
|
+
}
|
|
1302
|
+
if (action === 'metadata') {
|
|
1303
|
+
setString('title', this.getNodeParameter('title', itemIndex));
|
|
1304
|
+
setString('author', this.getNodeParameter('author', itemIndex));
|
|
1305
|
+
setString('subject', this.getNodeParameter('subject', itemIndex));
|
|
1306
|
+
setString('keywords', this.getNodeParameter('keywords', itemIndex));
|
|
1307
|
+
setString('creator', this.getNodeParameter('creator', itemIndex));
|
|
1308
|
+
setString('producer', this.getNodeParameter('producer', itemIndex));
|
|
1309
|
+
setBool('cleanAllMetadata', this.getNodeParameter('cleanAllMetadata', itemIndex));
|
|
1310
|
+
}
|
|
1311
|
+
if (action === 'reorder') {
|
|
1312
|
+
setString('order', this.getNodeParameter('order', itemIndex));
|
|
1313
|
+
}
|
|
1314
|
+
if (action === 'delete-pages') {
|
|
1315
|
+
setString('pages', this.getNodeParameter('pages', itemIndex));
|
|
1316
|
+
}
|
|
1317
|
+
if (action === 'extract') {
|
|
1318
|
+
setString('pages', this.getNodeParameter('pages', itemIndex));
|
|
1319
|
+
setString('mode', this.getNodeParameter('mode', itemIndex));
|
|
1320
|
+
setString('prefix', this.getNodeParameter('prefix', itemIndex));
|
|
1321
|
+
}
|
|
1322
|
+
if (action === 'flatten') {
|
|
1323
|
+
setBool('flattenForms', this.getNodeParameter('flattenForms', itemIndex));
|
|
1324
|
+
}
|
|
1325
|
+
if (action === 'encrypt') {
|
|
1326
|
+
setString('userPassword', this.getNodeParameter('userPassword', itemIndex));
|
|
1327
|
+
setString('ownerPassword', this.getNodeParameter('ownerPassword', itemIndex));
|
|
1328
|
+
}
|
|
1329
|
+
if (action === 'decrypt') {
|
|
1330
|
+
setString('password', this.getNodeParameter('password', itemIndex));
|
|
515
1331
|
}
|
|
516
1332
|
const response = await GenericFunctions_1.davixRequest.call(this, {
|
|
517
1333
|
method: 'POST',
|
|
@@ -521,25 +1337,13 @@ class DavixH2I {
|
|
|
521
1337
|
});
|
|
522
1338
|
const downloadBinary = this.getNodeParameter('pdfDownloadBinary', itemIndex);
|
|
523
1339
|
if (downloadBinary) {
|
|
1340
|
+
const firstUrl = gatherFirstUrl(response);
|
|
1341
|
+
if (!firstUrl)
|
|
1342
|
+
throw new Error('No URL returned to download.');
|
|
524
1343
|
const binName = this.getNodeParameter('pdfOutputBinaryProperty', itemIndex);
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
if (Array.isArray(response.results)) {
|
|
529
|
-
for (const r of response.results) {
|
|
530
|
-
if (r?.url)
|
|
531
|
-
urls.push(String(r.url));
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
if (urls.length) {
|
|
535
|
-
const firstUrl = urls[0];
|
|
536
|
-
const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-pdf-result.bin`);
|
|
537
|
-
const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
|
|
538
|
-
out.push({ json: response, binary: { [binName]: binary } });
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
out.push({ json: response });
|
|
542
|
-
}
|
|
1344
|
+
const dl = await GenericFunctions_1.downloadToBinary.call(this, firstUrl, `pixlab-pdf-result.bin`);
|
|
1345
|
+
const binary = await this.helpers.prepareBinaryData(dl.data, dl.fileName, dl.mimeType);
|
|
1346
|
+
out.push({ json: response, binary: { [binName]: binary } });
|
|
543
1347
|
}
|
|
544
1348
|
else {
|
|
545
1349
|
out.push({ json: response });
|
|
@@ -548,14 +1352,51 @@ class DavixH2I {
|
|
|
548
1352
|
}
|
|
549
1353
|
// ---- TOOLS (multipart)
|
|
550
1354
|
if (resource === 'tools') {
|
|
1355
|
+
const action = operation;
|
|
551
1356
|
const toolsBinaryProps = this.getNodeParameter('toolsBinaryProps', itemIndex);
|
|
552
|
-
const formData = {};
|
|
1357
|
+
const formData = { action };
|
|
553
1358
|
await attachFiles('images', toolsBinaryProps, formData);
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
1359
|
+
const setString = (name, value) => {
|
|
1360
|
+
if (value)
|
|
1361
|
+
formData[name] = value;
|
|
1362
|
+
};
|
|
1363
|
+
const setNumber = (name, value) => {
|
|
1364
|
+
if (value !== undefined && value !== null && value !== 0)
|
|
1365
|
+
formData[name] = String(value);
|
|
1366
|
+
};
|
|
1367
|
+
const setBool = (name, value) => {
|
|
1368
|
+
formData[name] = toBoolString(value);
|
|
1369
|
+
};
|
|
1370
|
+
if (action === 'single') {
|
|
1371
|
+
const tool = this.getNodeParameter('tool', itemIndex);
|
|
1372
|
+
if (!tool)
|
|
1373
|
+
throw new Error('Select one tool for single action.');
|
|
1374
|
+
formData.tools = tool;
|
|
1375
|
+
}
|
|
1376
|
+
else {
|
|
1377
|
+
const tools = this.getNodeParameter('tools', itemIndex);
|
|
1378
|
+
formData.tools = tools.join(',');
|
|
1379
|
+
}
|
|
1380
|
+
const options = action === 'multitask' ? this.getNodeParameter('toolsMultitaskOptions', itemIndex) : [];
|
|
1381
|
+
const has = (key) => options.includes(key);
|
|
1382
|
+
if (action === 'single' || has('includeRawExif'))
|
|
1383
|
+
setBool('includeRawExif', this.getNodeParameter('includeRawExif', itemIndex));
|
|
1384
|
+
if (action === 'single' || has('paletteSize'))
|
|
1385
|
+
setNumber('paletteSize', this.getNodeParameter('paletteSize', itemIndex));
|
|
1386
|
+
if (action === 'single' || has('hashType'))
|
|
1387
|
+
setString('hashType', this.getNodeParameter('hashType', itemIndex));
|
|
1388
|
+
if (has('qualitySample'))
|
|
1389
|
+
setNumber('qualitySample', this.getNodeParameter('qualitySample', itemIndex));
|
|
1390
|
+
if (has('transparencySample'))
|
|
1391
|
+
setNumber('transparencySample', this.getNodeParameter('transparencySample', itemIndex));
|
|
1392
|
+
if (has('similarityMode'))
|
|
1393
|
+
setString('similarityMode', this.getNodeParameter('similarityMode', itemIndex));
|
|
1394
|
+
if (has('similarityThreshold'))
|
|
1395
|
+
setNumber('similarityThreshold', this.getNodeParameter('similarityThreshold', itemIndex));
|
|
1396
|
+
if (has('efficiencyFormat'))
|
|
1397
|
+
setString('efficiencyFormat', this.getNodeParameter('efficiencyFormat', itemIndex));
|
|
1398
|
+
if (has('efficiencyQuality'))
|
|
1399
|
+
setNumber('efficiencyQuality', this.getNodeParameter('efficiencyQuality', itemIndex));
|
|
559
1400
|
const response = await GenericFunctions_1.davixRequest.call(this, {
|
|
560
1401
|
method: 'POST',
|
|
561
1402
|
url: '/v1/tools',
|