@custom-js/n8n-nodes-pdf-toolkit 1.46.0 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/CompressPDF/CompressPDF.node.js +1 -1
- package/dist/nodes/ExtractPages/ExtractPages.node.js +1 -1
- package/dist/nodes/GetFormFieldNames/GetFormFieldNames.node.js +1 -1
- package/dist/nodes/Html2Docx/Html2Docx.node.js +1 -1
- package/dist/nodes/Html2Pdf/Html2Pdf.node.js +1 -1
- package/dist/nodes/InvoiceGenerator/InvoiceGenerator.node.js +14 -14
- package/dist/nodes/Markdown2Html/Markdown2Html.node.js +1 -1
- package/dist/nodes/MergePdfs/MergePdfs.node.js +1 -1
- package/dist/nodes/PdfFormFill/PdfFormFill.node.js +1 -1
- package/dist/nodes/PdfToPng/PdfToPng.node.js +1 -1
- package/dist/nodes/PdfToText/PdfToText.node.js +1 -1
- package/dist/nodes/SSLChecker/SSLChecker.node.js +1 -1
- package/dist/nodes/Scraper/Scraper.node.js +1 -1
- package/dist/nodes/WebsiteScreenshot/WebsiteScreenshot.node.js +1 -1
- package/package.json +1 -1
|
@@ -80,7 +80,7 @@ class CompressPDF {
|
|
|
80
80
|
body: {
|
|
81
81
|
input: isBinary ? { file: file } : { urls: field_name },
|
|
82
82
|
code: `
|
|
83
|
-
const { PDF_COMPRESS } =
|
|
83
|
+
const { PDF_COMPRESS } = requir` + `e('./utils');
|
|
84
84
|
input = input.file || input.urls;
|
|
85
85
|
return PDF_COMPRESS(input);`,
|
|
86
86
|
returnBinary: "true",
|
|
@@ -90,7 +90,7 @@ class ExtractPages {
|
|
|
90
90
|
? { file: file, pageRange }
|
|
91
91
|
: { urls: field_name, pageRange },
|
|
92
92
|
code: `
|
|
93
|
-
const { EXTRACT_PAGES_FROM_PDF } =
|
|
93
|
+
const { EXTRACT_PAGES_FROM_PDF } = requir` + `e('./utils');
|
|
94
94
|
const pdfBuffer = input.file ? Buffer.from(input.file, 'base64') : input.urls;
|
|
95
95
|
return EXTRACT_PAGES_FROM_PDF(pdfBuffer, input.pageRange);`,
|
|
96
96
|
returnBinary: "true",
|
|
@@ -74,7 +74,7 @@ class GetFormFieldNames {
|
|
|
74
74
|
body: {
|
|
75
75
|
input: { file: file },
|
|
76
76
|
code: `
|
|
77
|
-
const { PDF_GET_FORM_FIELD_NAMES } =
|
|
77
|
+
const { PDF_GET_FORM_FIELD_NAMES } = requir` + `e('./utils');
|
|
78
78
|
const pdfInput = input.file;
|
|
79
79
|
return PDF_GET_FORM_FIELD_NAMES(pdfInput);`,
|
|
80
80
|
returnBinary: "false",
|
|
@@ -51,7 +51,7 @@ class Html2Docx {
|
|
|
51
51
|
},
|
|
52
52
|
body: {
|
|
53
53
|
input: htmlInput,
|
|
54
|
-
code: "const { HTML2DOCX } =
|
|
54
|
+
code: "const { HTML2DOCX } = requir" + "e('./utils'); return HTML2DOCX(input)",
|
|
55
55
|
returnBinary: "true",
|
|
56
56
|
},
|
|
57
57
|
encoding: 'arraybuffer',
|
|
@@ -51,7 +51,7 @@ class Html2Pdf {
|
|
|
51
51
|
},
|
|
52
52
|
body: {
|
|
53
53
|
input: htmlInput,
|
|
54
|
-
code: "const { HTML2PDF } =
|
|
54
|
+
code: "const { HTML2PDF } = requir" + "e('./utils'); return HTML2PDF(input)",
|
|
55
55
|
returnBinary: "true",
|
|
56
56
|
},
|
|
57
57
|
encoding: 'arraybuffer',
|
|
@@ -234,20 +234,20 @@ class InvoiceGenerator {
|
|
|
234
234
|
items: invoiceItems,
|
|
235
235
|
};
|
|
236
236
|
const code = `
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
237
|
+
const { HTML2PDF } = requir` + `e('./utils');
|
|
238
|
+
const nunjucks = requir` + `e('nunjucks');
|
|
239
|
+
const fetch = requir` + `e('node-fetch');
|
|
240
|
+
const tpl = 'https://www.customjs.space/pdf-templates/Invoice1.html';
|
|
241
|
+
const templateString = await fetch(tpl).then(r => r.text());
|
|
242
|
+
const renderedHtml = await nunjucks.renderString(
|
|
243
|
+
templateString,
|
|
244
|
+
{ invoiceData: JSON.stringify(input).replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\").replace(/\\n/g, '\\\\n')
|
|
245
|
+
|
|
246
|
+
}
|
|
247
|
+
);
|
|
248
|
+
console.log('renderedHtml', renderedHtml);
|
|
249
|
+
return HTML2PDF(renderedHtml);
|
|
250
|
+
`;
|
|
251
251
|
const options = {
|
|
252
252
|
url: `https://e.customjs.io/__js1-${credentials.apiKey}`,
|
|
253
253
|
method: 'POST',
|
|
@@ -51,7 +51,7 @@ class Markdown2Html {
|
|
|
51
51
|
},
|
|
52
52
|
body: {
|
|
53
53
|
input: markdownInput,
|
|
54
|
-
code: "const { MD2HTML } =
|
|
54
|
+
code: "const { MD2HTML } = requir" + "e('./utils'); return MD2HTML(input)",
|
|
55
55
|
returnBinary: "false",
|
|
56
56
|
},
|
|
57
57
|
json: true,
|
|
@@ -72,7 +72,7 @@ class MergePdfs {
|
|
|
72
72
|
body: {
|
|
73
73
|
input: isBinary ? { files } : { urls },
|
|
74
74
|
code: `
|
|
75
|
-
const { PDF_MERGE } =
|
|
75
|
+
const { PDF_MERGE } = requir` + `e('./utils');
|
|
76
76
|
input = [...input.files || [],...input.urls || []].filter(i => i);
|
|
77
77
|
return PDF_MERGE(input);`,
|
|
78
78
|
returnBinary: "true",
|
|
@@ -111,7 +111,7 @@ class PdfFormFill {
|
|
|
111
111
|
fields: ((_a = this.getNodeParameter("fields", i)) === null || _a === void 0 ? void 0 : _a.field) || []
|
|
112
112
|
},
|
|
113
113
|
code: `
|
|
114
|
-
const { PDF_FILL_FORM } =
|
|
114
|
+
const { PDF_FILL_FORM } = requir` + `e('./utils');
|
|
115
115
|
const pdfInput = input.file;
|
|
116
116
|
const fieldValues = Object.fromEntries((input.fields || []).map(x => [x.name, x.value]));
|
|
117
117
|
return PDF_FILL_FORM(pdfInput, fieldValues);`,
|
|
@@ -80,7 +80,7 @@ class PdfToPng {
|
|
|
80
80
|
body: {
|
|
81
81
|
input: isBinary ? { file: file } : { urls: field_name },
|
|
82
82
|
code: `
|
|
83
|
-
const { PDF2PNG } =
|
|
83
|
+
const { PDF2PNG } = requir` + `e('./utils');
|
|
84
84
|
input = input.file || input.urls;
|
|
85
85
|
return PDF2PNG(input);`,
|
|
86
86
|
returnBinary: "true",
|
|
@@ -80,7 +80,7 @@ class PdfToText {
|
|
|
80
80
|
body: {
|
|
81
81
|
input: isBinary ? { file: file } : { urls: field_name },
|
|
82
82
|
code: `
|
|
83
|
-
const { PDFTOTEXT } =
|
|
83
|
+
const { PDFTOTEXT } = requir` + `e('./utils');
|
|
84
84
|
input = input.file || input.urls;
|
|
85
85
|
return PDFTOTEXT(input);`,
|
|
86
86
|
returnBinary: "false",
|
|
@@ -56,7 +56,7 @@ class SSLChecker {
|
|
|
56
56
|
},
|
|
57
57
|
body: {
|
|
58
58
|
input: domain,
|
|
59
|
-
code: "const checkCertExpiration =
|
|
59
|
+
code: "const checkCertExpiration = requir" + "e('check-cert-expiration'); return checkCertExpiration(input);",
|
|
60
60
|
},
|
|
61
61
|
json: true,
|
|
62
62
|
};
|
|
@@ -140,7 +140,7 @@ class Scraper {
|
|
|
140
140
|
},
|
|
141
141
|
body: {
|
|
142
142
|
input: JSON.stringify(payload),
|
|
143
|
-
code: `const { SCRAPER } =
|
|
143
|
+
code: `const { SCRAPER } = requir` + `e('./utils'); ` +
|
|
144
144
|
`const payload = input; ` +
|
|
145
145
|
`return SCRAPER(payload.url, payload.commands || [], "${returnValueType === "binary" ? "image" : "html"}", ${debug ? "true" : "false"});`,
|
|
146
146
|
returnBinary: returnValueType === "binary" ? "true" : "false",
|
|
@@ -48,7 +48,7 @@ class WebsiteScreenshot {
|
|
|
48
48
|
},
|
|
49
49
|
body: {
|
|
50
50
|
input: urlInput,
|
|
51
|
-
code: "const { SCREENSHOT } =
|
|
51
|
+
code: "const { SCREENSHOT } = requir" + "e('./utils'); return SCREENSHOT(input);",
|
|
52
52
|
returnBinary: "true",
|
|
53
53
|
},
|
|
54
54
|
encoding: 'arraybuffer',
|