chromiumly 5.2.1 → 6.0.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/README.md +663 -360
- package/dist/chromium/converters/html.converter.d.ts +2 -2
- package/dist/chromium/converters/html.converter.js +14 -4
- package/dist/chromium/converters/html.converter.js.map +1 -1
- package/dist/chromium/converters/markdown.converter.d.ts +2 -2
- package/dist/chromium/converters/markdown.converter.js +23 -5
- package/dist/chromium/converters/markdown.converter.js.map +1 -1
- package/dist/chromium/converters/url.converter.d.ts +2 -2
- package/dist/chromium/converters/url.converter.js +14 -4
- package/dist/chromium/converters/url.converter.js.map +1 -1
- package/dist/chromium/interfaces/common.types.d.ts +1 -0
- package/dist/chromium/interfaces/converter.types.d.ts +26 -17
- package/dist/chromium/interfaces/screenshot.types.d.ts +16 -7
- package/dist/chromium/screenshots/html.screenshot.d.ts +1 -2
- package/dist/chromium/screenshots/html.screenshot.js +8 -8
- package/dist/chromium/screenshots/html.screenshot.js.map +1 -1
- package/dist/chromium/screenshots/markdown.screenshot.d.ts +1 -2
- package/dist/chromium/screenshots/markdown.screenshot.js +14 -9
- package/dist/chromium/screenshots/markdown.screenshot.js.map +1 -1
- package/dist/chromium/screenshots/url.screenshot.d.ts +1 -2
- package/dist/chromium/screenshots/url.screenshot.js +4 -8
- package/dist/chromium/screenshots/url.screenshot.js.map +1 -1
- package/dist/chromium/utils/converter.utils.js +69 -43
- package/dist/chromium/utils/converter.utils.js.map +1 -1
- package/dist/chromium/utils/screenshot.utils.d.ts +0 -10
- package/dist/chromium/utils/screenshot.utils.js +6 -44
- package/dist/chromium/utils/screenshot.utils.js.map +1 -1
- package/dist/common/constants.d.ts +1 -0
- package/dist/common/constants.js +1 -0
- package/dist/common/constants.js.map +1 -1
- package/dist/common/factur-x.types.d.ts +24 -0
- package/dist/common/factur-x.types.js +3 -0
- package/dist/common/factur-x.types.js.map +1 -0
- package/dist/common/factur-x.utils.d.ts +6 -0
- package/dist/common/factur-x.utils.js +48 -0
- package/dist/common/factur-x.utils.js.map +1 -0
- package/dist/common/gotenberg.utils.d.ts +16 -2
- package/dist/common/gotenberg.utils.js +39 -6
- package/dist/common/gotenberg.utils.js.map +1 -1
- package/dist/common/index.d.ts +5 -1
- package/dist/common/index.js +5 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/pdf-engine-encryption.types.d.ts +14 -0
- package/dist/common/pdf-engine-encryption.types.js +3 -0
- package/dist/common/pdf-engine-encryption.types.js.map +1 -0
- package/dist/common/pdf-engine-encryption.utils.d.ts +7 -0
- package/dist/common/pdf-engine-encryption.utils.js +32 -0
- package/dist/common/pdf-engine-encryption.utils.js.map +1 -0
- package/dist/common/types.d.ts +29 -2
- package/dist/libre-office/interfaces/libre-office.types.d.ts +10 -5
- package/dist/libre-office/libre-office.d.ts +2 -2
- package/dist/libre-office/libre-office.js +12 -4
- package/dist/libre-office/libre-office.js.map +1 -1
- package/dist/libre-office/utils/constants.js +0 -2
- package/dist/libre-office/utils/constants.js.map +1 -1
- package/dist/libre-office/utils/libre-office.utils.js +8 -0
- package/dist/libre-office/utils/libre-office.utils.js.map +1 -1
- package/dist/main.config.d.ts +2 -0
- package/dist/main.config.js +2 -0
- package/dist/main.config.js.map +1 -1
- package/dist/pdf-engines/interfaces/pdf-engines.types.d.ts +18 -8
- package/dist/pdf-engines/pdf-engines.d.ts +56 -28
- package/dist/pdf-engines/pdf-engines.js +109 -28
- package/dist/pdf-engines/pdf-engines.js.map +1 -1
- package/dist/system/system.d.ts +20 -5
- package/dist/system/system.js +25 -10
- package/dist/system/system.js.map +1 -1
- package/package.json +85 -82
|
@@ -39,8 +39,8 @@ export declare class HtmlConverter extends Converter {
|
|
|
39
39
|
* @param {Metadata} options.metadata - Metadata to be written.
|
|
40
40
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
41
41
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
42
|
-
* @param {
|
|
42
|
+
* @param {ConvertSplit} [options.split] - Split the PDF into multiple files.
|
|
43
43
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
44
44
|
*/
|
|
45
|
-
convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, embeds, watermark, stamp, rotate }: HtmlConversionOptions): Promise<Buffer>;
|
|
45
|
+
convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, generateTaggedPdf, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, flatten, allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling, embeds, embedsMetadata, watermark, stamp, rotate, facturx, outputFilename, trace }: HtmlConversionOptions): Promise<Buffer>;
|
|
46
46
|
}
|
|
@@ -46,10 +46,10 @@ class HtmlConverter extends converter_1.Converter {
|
|
|
46
46
|
* @param {Metadata} options.metadata - Metadata to be written.
|
|
47
47
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
48
48
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
49
|
-
* @param {
|
|
49
|
+
* @param {ConvertSplit} [options.split] - Split the PDF into multiple files.
|
|
50
50
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
51
51
|
*/
|
|
52
|
-
async convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, embeds, watermark, stamp, rotate }) {
|
|
52
|
+
async convert({ html, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, generateTaggedPdf, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, flatten, allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling, embeds, embedsMetadata, watermark, stamp, rotate, facturx, outputFilename, trace }) {
|
|
53
53
|
const data = new FormData();
|
|
54
54
|
await common_1.GotenbergUtils.addFile(data, html, 'index.html');
|
|
55
55
|
if (assets?.length) {
|
|
@@ -76,6 +76,7 @@ class HtmlConverter extends converter_1.Converter {
|
|
|
76
76
|
skipNetworkIdleEvent,
|
|
77
77
|
skipNetworkAlmostIdleEvent,
|
|
78
78
|
generateDocumentOutline,
|
|
79
|
+
generateTaggedPdf,
|
|
79
80
|
metadata,
|
|
80
81
|
cookies,
|
|
81
82
|
downloadFrom,
|
|
@@ -83,12 +84,21 @@ class HtmlConverter extends converter_1.Converter {
|
|
|
83
84
|
split,
|
|
84
85
|
userPassword,
|
|
85
86
|
ownerPassword,
|
|
87
|
+
flatten,
|
|
88
|
+
allowPrinting,
|
|
89
|
+
allowCopying,
|
|
90
|
+
allowModifying,
|
|
91
|
+
allowAnnotating,
|
|
92
|
+
allowFillingForms,
|
|
93
|
+
allowAssembling,
|
|
86
94
|
embeds,
|
|
95
|
+
embedsMetadata,
|
|
87
96
|
watermark,
|
|
88
97
|
stamp,
|
|
89
|
-
rotate
|
|
98
|
+
rotate,
|
|
99
|
+
facturx
|
|
90
100
|
});
|
|
91
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.buildWebhookHeaders(webhook));
|
|
101
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.combineHeaders(common_1.GotenbergUtils.buildWebhookHeaders(webhook), common_1.GotenbergUtils.buildOutputHeaders({ outputFilename, trace })));
|
|
92
102
|
}
|
|
93
103
|
}
|
|
94
104
|
exports.HtmlConverter = HtmlConverter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,qBAAS;IACxC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,qBAAS;IACxC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,OAAO,EACP,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,cAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,EACN,OAAO,EACP,cA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,OAAO,CAAC,EAC3C,uBAAc,CAAC,kBAAkB,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAC/D,CACJ,CAAC;IACN,CAAC;CACJ;AA3JD,sCA2JC"}
|
|
@@ -40,8 +40,8 @@ export declare class MarkdownConverter extends Converter {
|
|
|
40
40
|
* @param {Metadata} options.metadata - Metadata to be written.
|
|
41
41
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
42
42
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
43
|
-
* @param {
|
|
43
|
+
* @param {ConvertSplit} [options.split] - Split the PDF into multiple files.
|
|
44
44
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
45
45
|
*/
|
|
46
|
-
convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, embeds, watermark, stamp, rotate }: MarkdownConversionOptions): Promise<Buffer>;
|
|
46
|
+
convert({ html, markdown, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, generateTaggedPdf, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, flatten, allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling, embeds, embedsMetadata, watermark, stamp, rotate, facturx, outputFilename, trace }: MarkdownConversionOptions): Promise<Buffer>;
|
|
47
47
|
}
|
|
@@ -47,13 +47,21 @@ class MarkdownConverter extends converter_1.Converter {
|
|
|
47
47
|
* @param {Metadata} options.metadata - Metadata to be written.
|
|
48
48
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
49
49
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
50
|
-
* @param {
|
|
50
|
+
* @param {ConvertSplit} [options.split] - Split the PDF into multiple files.
|
|
51
51
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
52
52
|
*/
|
|
53
|
-
async convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, embeds, watermark, stamp, rotate }) {
|
|
53
|
+
async convert({ html, markdown, assets, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, generateDocumentOutline, generateTaggedPdf, metadata, cookies, downloadFrom, webhook, split, userPassword, ownerPassword, flatten, allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling, embeds, embedsMetadata, watermark, stamp, rotate, facturx, outputFilename, trace }) {
|
|
54
54
|
const data = new FormData();
|
|
55
55
|
await common_1.GotenbergUtils.addFile(data, html, 'index.html');
|
|
56
|
-
|
|
56
|
+
if (Array.isArray(markdown)) {
|
|
57
|
+
await Promise.all(markdown.map(({ file, name }) => common_1.GotenbergUtils.addFile(data, file, name)));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
await common_1.GotenbergUtils.addFile(data, markdown, 'file.md');
|
|
61
|
+
}
|
|
62
|
+
if (assets?.length) {
|
|
63
|
+
await Promise.all(assets.map(({ file, name }) => common_1.GotenbergUtils.addFile(data, file, name)));
|
|
64
|
+
}
|
|
57
65
|
await converter_utils_1.ConverterUtils.customize(data, {
|
|
58
66
|
header,
|
|
59
67
|
footer,
|
|
@@ -80,14 +88,24 @@ class MarkdownConverter extends converter_1.Converter {
|
|
|
80
88
|
ignoreResourceHttpStatusDomains,
|
|
81
89
|
failOnResourceLoadingFailed,
|
|
82
90
|
generateDocumentOutline,
|
|
91
|
+
generateTaggedPdf,
|
|
83
92
|
userPassword,
|
|
84
93
|
ownerPassword,
|
|
94
|
+
flatten,
|
|
95
|
+
allowPrinting,
|
|
96
|
+
allowCopying,
|
|
97
|
+
allowModifying,
|
|
98
|
+
allowAnnotating,
|
|
99
|
+
allowFillingForms,
|
|
100
|
+
allowAssembling,
|
|
85
101
|
embeds,
|
|
102
|
+
embedsMetadata,
|
|
86
103
|
watermark,
|
|
87
104
|
stamp,
|
|
88
|
-
rotate
|
|
105
|
+
rotate,
|
|
106
|
+
facturx
|
|
89
107
|
});
|
|
90
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.buildWebhookHeaders(webhook));
|
|
108
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.combineHeaders(common_1.GotenbergUtils.buildWebhookHeaders(webhook), common_1.GotenbergUtils.buildOutputHeaders({ outputFilename, trace })));
|
|
91
109
|
}
|
|
92
110
|
}
|
|
93
111
|
exports.MarkdownConverter = MarkdownConverter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAC5C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC1B,uBAAuB,EACvB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAC5C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAA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} options.metadata - Metadata to be written.
|
|
40
40
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
41
41
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
42
|
-
* @param {
|
|
42
|
+
* @param {ConvertSplit} [options.split] - Split the PDF into multiple files.
|
|
43
43
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
44
44
|
*/
|
|
45
|
-
convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, metadata, cookies, downloadFrom, webhook, generateDocumentOutline, split, userPassword, ownerPassword, embeds, watermark, stamp, rotate }: UrlConversionOptions): Promise<Buffer>;
|
|
45
|
+
convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, metadata, cookies, downloadFrom, webhook, generateDocumentOutline, generateTaggedPdf, split, userPassword, ownerPassword, flatten, allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling, embeds, embedsMetadata, watermark, stamp, rotate, facturx, outputFilename, trace }: UrlConversionOptions): Promise<Buffer>;
|
|
46
46
|
}
|
|
@@ -47,10 +47,10 @@ class UrlConverter extends converter_1.Converter {
|
|
|
47
47
|
* @param {Metadata} options.metadata - Metadata to be written.
|
|
48
48
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
49
49
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
50
|
-
* @param {
|
|
50
|
+
* @param {ConvertSplit} [options.split] - Split the PDF into multiple files.
|
|
51
51
|
* @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a buffer
|
|
52
52
|
*/
|
|
53
|
-
async convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, metadata, cookies, downloadFrom, webhook, generateDocumentOutline, split, userPassword, ownerPassword, embeds, watermark, stamp, rotate }) {
|
|
53
|
+
async convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, metadata, cookies, downloadFrom, webhook, generateDocumentOutline, generateTaggedPdf, split, userPassword, ownerPassword, flatten, allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling, embeds, embedsMetadata, watermark, stamp, rotate, facturx, outputFilename, trace }) {
|
|
54
54
|
const _url = new url_1.URL(url);
|
|
55
55
|
const data = new FormData();
|
|
56
56
|
data.append('url', _url.href);
|
|
@@ -79,15 +79,25 @@ class UrlConverter extends converter_1.Converter {
|
|
|
79
79
|
ignoreResourceHttpStatusDomains,
|
|
80
80
|
failOnResourceLoadingFailed,
|
|
81
81
|
generateDocumentOutline,
|
|
82
|
+
generateTaggedPdf,
|
|
82
83
|
split,
|
|
83
84
|
userPassword,
|
|
84
85
|
ownerPassword,
|
|
86
|
+
flatten,
|
|
87
|
+
allowPrinting,
|
|
88
|
+
allowCopying,
|
|
89
|
+
allowModifying,
|
|
90
|
+
allowAnnotating,
|
|
91
|
+
allowFillingForms,
|
|
92
|
+
allowAssembling,
|
|
85
93
|
embeds,
|
|
94
|
+
embedsMetadata,
|
|
86
95
|
watermark,
|
|
87
96
|
stamp,
|
|
88
|
-
rotate
|
|
97
|
+
rotate,
|
|
98
|
+
facturx
|
|
89
99
|
});
|
|
90
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.buildWebhookHeaders(webhook));
|
|
100
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.combineHeaders(common_1.GotenbergUtils.buildWebhookHeaders(webhook), common_1.GotenbergUtils.buildOutputHeaders({ outputFilename, trace })));
|
|
91
101
|
}
|
|
92
102
|
}
|
|
93
103
|
exports.UrlConverter = UrlConverter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,qBAAS;IACvC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,OAAO,EACP,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,8DAA0D;AAC1D,2CAAwC;AACxC,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,qBAAS;IACvC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,OAAO,EACP,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,OAAO,EACP,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,cAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,E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|
|
17
17
|
export type ChromiumOptions = {
|
|
18
18
|
header?: PathLikeOrReadStream;
|
|
19
19
|
footer?: PathLikeOrReadStream;
|
|
20
|
+
userAgent?: string;
|
|
20
21
|
emulatedMediaType?: EmulatedMediaType;
|
|
21
22
|
emulatedMediaFeatures?: EmulatedMediaFeature[];
|
|
22
23
|
waitDelay?: string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Metadata, PathLikeOrReadStream, PdfFormat, PdfEngineStamp, PdfEngineWatermark } from '../../common';
|
|
2
|
-
import {
|
|
1
|
+
import { Metadata, PathLikeOrReadStream, PdfFormat, FacturXOptions, PdfEnginePermissions, PdfEngineStamp, PdfEngineWatermark } from '../../common';
|
|
2
|
+
import { ConvertSplit, EmbedsMetadata, OutputOptions, PdfEngineRotate } from '../../common/types';
|
|
3
3
|
import { ChromiumOptions, Cookie } from './common.types';
|
|
4
4
|
type PageSize = {
|
|
5
|
-
width
|
|
6
|
-
height
|
|
5
|
+
width?: number | string;
|
|
6
|
+
height?: number | string;
|
|
7
7
|
};
|
|
8
8
|
type PageMargins = {
|
|
9
|
-
top
|
|
10
|
-
bottom
|
|
11
|
-
left
|
|
12
|
-
right
|
|
9
|
+
top?: number | string;
|
|
10
|
+
bottom?: number | string;
|
|
11
|
+
left?: number | string;
|
|
12
|
+
right?: number | string;
|
|
13
13
|
};
|
|
14
14
|
export type PageProperties = {
|
|
15
15
|
singlePage?: boolean;
|
|
@@ -23,9 +23,9 @@ export type PageProperties = {
|
|
|
23
23
|
nativePageRanges?: {
|
|
24
24
|
from: number;
|
|
25
25
|
to: number;
|
|
26
|
-
};
|
|
26
|
+
} | string;
|
|
27
27
|
};
|
|
28
|
-
export type ConversionOptions = ChromiumOptions & {
|
|
28
|
+
export type ConversionOptions = ChromiumOptions & OutputOptions & PdfEnginePermissions & {
|
|
29
29
|
properties?: PageProperties;
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated Starting from Gotenberg version 8.0.0, Chromium no longer provides support for pdfFormat.
|
|
@@ -33,23 +33,24 @@ export type ConversionOptions = ChromiumOptions & {
|
|
|
33
33
|
*/
|
|
34
34
|
pdfFormat?: PdfFormat;
|
|
35
35
|
pdfUA?: boolean;
|
|
36
|
-
|
|
37
|
-
* @deprecated Starting from Gotenberg version 8.0.0, Chromium no longer provides support for userAgent.
|
|
38
|
-
* @see {@link https://github.com/gotenberg/gotenberg/releases/tag/v8.0.0}
|
|
39
|
-
*/
|
|
40
|
-
userAgent?: string;
|
|
36
|
+
generateTaggedPdf?: boolean;
|
|
41
37
|
metadata?: Metadata;
|
|
42
38
|
cookies?: Cookie[];
|
|
43
|
-
split?:
|
|
39
|
+
split?: ConvertSplit;
|
|
44
40
|
userPassword?: string;
|
|
45
41
|
ownerPassword?: string;
|
|
42
|
+
flatten?: boolean;
|
|
46
43
|
embeds?: PathLikeOrReadStream[];
|
|
44
|
+
/** Per-attachment metadata keyed by filename, for PDF/A-3 and Factur-X compliance */
|
|
45
|
+
embedsMetadata?: EmbedsMetadata;
|
|
47
46
|
/** PDF-engine post-processing watermark (behind content) */
|
|
48
47
|
watermark?: PdfEngineWatermark;
|
|
49
48
|
/** PDF-engine post-processing stamp (on top of content) */
|
|
50
49
|
stamp?: PdfEngineStamp;
|
|
51
50
|
/** PDF-engine post-process page rotation */
|
|
52
51
|
rotate?: PdfEngineRotate;
|
|
52
|
+
/** Turn the resulting PDF into a Factur-X / ZUGFeRD e-invoice */
|
|
53
|
+
facturx?: FacturXOptions;
|
|
53
54
|
};
|
|
54
55
|
export type HtmlConversionOptions = ConversionOptions & {
|
|
55
56
|
html: PathLikeOrReadStream;
|
|
@@ -67,8 +68,16 @@ export type UrlConversionOptions = ConversionOptions & {
|
|
|
67
68
|
};
|
|
68
69
|
export type MarkdownConversionOptions = ConversionOptions & {
|
|
69
70
|
html: PathLikeOrReadStream;
|
|
71
|
+
assets?: {
|
|
72
|
+
file: PathLikeOrReadStream;
|
|
73
|
+
name: string;
|
|
74
|
+
}[];
|
|
70
75
|
header?: PathLikeOrReadStream;
|
|
71
76
|
footer?: PathLikeOrReadStream;
|
|
72
|
-
markdown
|
|
77
|
+
/** A single markdown file, or multiple distinctly-named markdown files. */
|
|
78
|
+
markdown: PathLikeOrReadStream | {
|
|
79
|
+
file: PathLikeOrReadStream;
|
|
80
|
+
name: string;
|
|
81
|
+
}[];
|
|
73
82
|
};
|
|
74
83
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PathLikeOrReadStream } from '../../common';
|
|
2
|
+
import { OutputOptions } from '../../common/types';
|
|
2
3
|
import { ChromiumOptions } from './common.types';
|
|
3
4
|
export type ImageProperties = {
|
|
4
5
|
format: 'png' | 'jpeg' | 'webp';
|
|
@@ -7,23 +8,31 @@ export type ImageProperties = {
|
|
|
7
8
|
width?: number;
|
|
8
9
|
height?: number;
|
|
9
10
|
clip?: boolean;
|
|
11
|
+
deviceScaleFactor?: number;
|
|
10
12
|
};
|
|
11
|
-
export type ScreenshotOptions = Omit<ChromiumOptions, 'assets' | 'header' | 'footer'> & {
|
|
13
|
+
export type ScreenshotOptions = Omit<ChromiumOptions, 'assets' | 'header' | 'footer' | 'generateDocumentOutline'> & OutputOptions & {
|
|
12
14
|
properties?: ImageProperties;
|
|
13
15
|
optimizeForSpeed?: boolean;
|
|
14
|
-
userPassword?: string;
|
|
15
|
-
ownerPassword?: string;
|
|
16
|
-
embeds?: PathLikeOrReadStream[];
|
|
17
16
|
};
|
|
18
17
|
export type HtmlScreenshotOptions = ScreenshotOptions & {
|
|
19
18
|
html: PathLikeOrReadStream;
|
|
19
|
+
assets?: {
|
|
20
|
+
file: PathLikeOrReadStream;
|
|
21
|
+
name: string;
|
|
22
|
+
}[];
|
|
20
23
|
};
|
|
21
24
|
export type UrlScreenshotOptions = ScreenshotOptions & {
|
|
22
25
|
url: string;
|
|
23
26
|
};
|
|
24
27
|
export type MarkdownScreenshotOptions = ScreenshotOptions & {
|
|
25
28
|
html: PathLikeOrReadStream;
|
|
26
|
-
markdown
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
/** A single markdown file, or multiple distinctly-named markdown files. */
|
|
30
|
+
markdown: PathLikeOrReadStream | {
|
|
31
|
+
file: PathLikeOrReadStream;
|
|
32
|
+
name: string;
|
|
33
|
+
}[];
|
|
34
|
+
assets?: {
|
|
35
|
+
file: PathLikeOrReadStream;
|
|
36
|
+
name: string;
|
|
37
|
+
}[];
|
|
29
38
|
};
|
|
@@ -32,8 +32,7 @@ export declare class HtmlScreenshot extends Screenshot {
|
|
|
32
32
|
* @param {boolean} [options.skipNetworkIdleEvent] - Whether to skip network idle event.
|
|
33
33
|
* @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
|
|
34
34
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
35
|
-
* @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
|
|
36
35
|
* @returns {Promise<Buffer>} A Promise resolving to the image buffer.
|
|
37
36
|
*/
|
|
38
|
-
capture({ html, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, downloadFrom, webhook,
|
|
37
|
+
capture({ html, assets, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook, outputFilename, trace }: HtmlScreenshotOptions): Promise<Buffer>;
|
|
39
38
|
}
|
|
@@ -39,12 +39,14 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
|
|
|
39
39
|
* @param {boolean} [options.skipNetworkIdleEvent] - Whether to skip network idle event.
|
|
40
40
|
* @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
|
|
41
41
|
* @param {DownloadFrom} [options.downloadFrom] - Download a file from a URL. It must return a Content-Disposition header with a filename parameter.
|
|
42
|
-
* @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
|
|
43
42
|
* @returns {Promise<Buffer>} A Promise resolving to the image buffer.
|
|
44
43
|
*/
|
|
45
|
-
async capture({ html, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, downloadFrom, webhook,
|
|
44
|
+
async capture({ html, assets, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnConsoleExceptions, failOnHttpStatusCodes, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook, outputFilename, trace }) {
|
|
46
45
|
const data = new FormData();
|
|
47
46
|
await common_1.GotenbergUtils.addFile(data, html, 'index.html');
|
|
47
|
+
if (assets?.length) {
|
|
48
|
+
await Promise.all(assets.map(({ file, name }) => common_1.GotenbergUtils.addFile(data, file, name)));
|
|
49
|
+
}
|
|
48
50
|
await screenshot_utils_1.ScreenshotUtils.customize(data, {
|
|
49
51
|
properties,
|
|
50
52
|
emulatedMediaType,
|
|
@@ -52,6 +54,7 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
|
|
|
52
54
|
waitDelay,
|
|
53
55
|
waitForExpression,
|
|
54
56
|
waitForSelector,
|
|
57
|
+
userAgent,
|
|
55
58
|
extraHttpHeaders,
|
|
56
59
|
failOnHttpStatusCodes,
|
|
57
60
|
failOnConsoleExceptions,
|
|
@@ -61,14 +64,11 @@ class HtmlScreenshot extends screenshot_1.Screenshot {
|
|
|
61
64
|
skipNetworkIdleEvent,
|
|
62
65
|
skipNetworkAlmostIdleEvent,
|
|
63
66
|
optimizeForSpeed,
|
|
67
|
+
cookies,
|
|
64
68
|
downloadFrom,
|
|
65
|
-
webhook
|
|
66
|
-
generateDocumentOutline,
|
|
67
|
-
userPassword,
|
|
68
|
-
ownerPassword,
|
|
69
|
-
embeds
|
|
69
|
+
webhook
|
|
70
70
|
});
|
|
71
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.buildWebhookHeaders(webhook));
|
|
71
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.combineHeaders(common_1.GotenbergUtils.buildWebhookHeaders(webhook), common_1.GotenbergUtils.buildOutputHeaders({ outputFilename, trace })));
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
exports.HtmlScreenshot = HtmlScreenshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/html.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,mDAA8D;AAC9D,gEAA4D;AAC5D,6CAA0C;AAG1C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,uBAAU;IAC1C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"html.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/html.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAC9C,mDAA8D;AAC9D,gEAA4D;AAC5D,6CAA0C;AAG1C;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,uBAAU;IAC1C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,cAAc,EACd,KAAK,EACe;QACpB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAE5B,MAAM,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEvD,IAAI,MAAM,EAAE,MAAM,EAAE,CAAC;YACjB,MAAM,OAAO,CAAC,GAAG,CACb,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAC1B,uBAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAC3C,CACJ,CAAC;QACN,CAAC;QAED,MAAM,kCAAe,CAAC,SAAS,CAAC,IAAI,EAAE;YAClC,UAAU;YACV,iBAAiB;YACjB,qBAAqB;YACrB,SAAS;YACT,iBAAiB;YACjB,eAAe;YACf,SAAS;YACT,gBAAgB;YAChB,qBAAqB;YACrB,uBAAuB;YACvB,6BAA6B;YAC7B,+BAA+B;YAC/B,2BAA2B;YAC3B,oBAAoB;YACpB,0BAA0B;YAC1B,gBAAgB;YAChB,OAAO;YACP,YAAY;YACZ,OAAO;SACV,CAAC,CAAC;QAEH,OAAO,uBAAc,CAAC,KAAK,CACvB,IAAI,CAAC,QAAQ,EACb,IAAI,EACJ,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,gCAAgC,EAAE,EAC7C,wBAAU,CAAC,oBAAoB,EAAE,EACjC,wBAAU,CAAC,kBAAkB,EAAE,EAC/B,uBAAc,CAAC,cAAc,CACzB,uBAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAC3C,uBAAc,CAAC,kBAAkB,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAC/D,CACJ,CAAC;IACN,CAAC;CACJ;AAvGD,wCAuGC"}
|
|
@@ -33,8 +33,7 @@ export declare class MarkdownScreenshot extends Screenshot {
|
|
|
33
33
|
* @param {number[]} [options.failOnResourceHttpStatusCodes] - Whether to fail on resource HTTP status code.
|
|
34
34
|
* @param {string[]} [options.ignoreResourceHttpStatusDomains] - Domains to exclude from resource HTTP status code checks.
|
|
35
35
|
* @param {boolean} [options.failOnResourceLoadingFailed] - Whether to fail on resource loading failed.
|
|
36
|
-
* @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
|
|
37
36
|
* @returns {Promise<Buffer>} A Promise resolving to the image buffer.
|
|
38
37
|
*/
|
|
39
|
-
capture({ html, markdown, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, downloadFrom, webhook, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed,
|
|
38
|
+
capture({ html, markdown, assets, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, outputFilename, trace }: MarkdownScreenshotOptions): Promise<Buffer>;
|
|
40
39
|
}
|
|
@@ -40,13 +40,20 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
|
|
|
40
40
|
* @param {number[]} [options.failOnResourceHttpStatusCodes] - Whether to fail on resource HTTP status code.
|
|
41
41
|
* @param {string[]} [options.ignoreResourceHttpStatusDomains] - Domains to exclude from resource HTTP status code checks.
|
|
42
42
|
* @param {boolean} [options.failOnResourceLoadingFailed] - Whether to fail on resource loading failed.
|
|
43
|
-
* @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
|
|
44
43
|
* @returns {Promise<Buffer>} A Promise resolving to the image buffer.
|
|
45
44
|
*/
|
|
46
|
-
async capture({ html, markdown, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, downloadFrom, webhook, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed,
|
|
45
|
+
async capture({ html, markdown, assets, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, outputFilename, trace }) {
|
|
47
46
|
const data = new FormData();
|
|
48
47
|
await common_1.GotenbergUtils.addFile(data, html, 'index.html');
|
|
49
|
-
|
|
48
|
+
if (Array.isArray(markdown)) {
|
|
49
|
+
await Promise.all(markdown.map(({ file, name }) => common_1.GotenbergUtils.addFile(data, file, name)));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
await common_1.GotenbergUtils.addFile(data, markdown, 'file.md');
|
|
53
|
+
}
|
|
54
|
+
if (assets?.length) {
|
|
55
|
+
await Promise.all(assets.map(({ file, name }) => common_1.GotenbergUtils.addFile(data, file, name)));
|
|
56
|
+
}
|
|
50
57
|
await screenshot_utils_1.ScreenshotUtils.customize(data, {
|
|
51
58
|
properties,
|
|
52
59
|
emulatedMediaType,
|
|
@@ -54,6 +61,7 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
|
|
|
54
61
|
waitDelay,
|
|
55
62
|
waitForExpression,
|
|
56
63
|
waitForSelector,
|
|
64
|
+
userAgent,
|
|
57
65
|
extraHttpHeaders,
|
|
58
66
|
failOnHttpStatusCodes,
|
|
59
67
|
failOnConsoleExceptions,
|
|
@@ -63,14 +71,11 @@ class MarkdownScreenshot extends screenshot_1.Screenshot {
|
|
|
63
71
|
skipNetworkIdleEvent,
|
|
64
72
|
skipNetworkAlmostIdleEvent,
|
|
65
73
|
optimizeForSpeed,
|
|
74
|
+
cookies,
|
|
66
75
|
downloadFrom,
|
|
67
|
-
webhook
|
|
68
|
-
generateDocumentOutline,
|
|
69
|
-
userPassword,
|
|
70
|
-
ownerPassword,
|
|
71
|
-
embeds
|
|
76
|
+
webhook
|
|
72
77
|
});
|
|
73
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.buildWebhookHeaders(webhook));
|
|
78
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.combineHeaders(common_1.GotenbergUtils.buildWebhookHeaders(webhook), common_1.GotenbergUtils.buildOutputHeaders({ outputFilename, trace })));
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
exports.MarkdownScreenshot = MarkdownScreenshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/markdown.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,uBAAU;IAC9C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"markdown.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/markdown.screenshot.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,kBAAmB,SAAQ,uBAAU;IAC9C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,OAAO,CAAC,EACV,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,OAAO,EACP,6BAA6B,EAC7B,+BAA+B,EAC/B,2BAA2B,EAC3B,cAAc,EACd,KAAK,EACmB;QACxB,MAAM,IAAI,GA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BAAU,CAAC,kBAAkB,EAAE,EAC/B,uBAAc,CAAC,cAAc,CACzB,uBAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAC3C,uBAAc,CAAC,kBAAkB,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAC/D,CACJ,CAAC;IACN,CAAC;CACJ;AAnHD,gDAmHC"}
|
|
@@ -32,8 +32,7 @@ export declare class UrlScreenshot extends Screenshot {
|
|
|
32
32
|
* @param {boolean} [options.skipNetworkIdleEvent] - Whether to skip network idle event.
|
|
33
33
|
* @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
|
|
34
34
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
35
|
-
* @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
|
|
36
35
|
* @returns {Promise<Buffer>} A Promise resolving to the image buffer.
|
|
37
36
|
*/
|
|
38
|
-
capture({ url, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook,
|
|
37
|
+
capture({ url, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook, outputFilename, trace }: UrlScreenshotOptions): Promise<Buffer>;
|
|
39
38
|
}
|
|
@@ -40,10 +40,9 @@ class UrlScreenshot extends screenshot_1.Screenshot {
|
|
|
40
40
|
* @param {boolean} [options.skipNetworkIdleEvent] - Whether to skip network idle event.
|
|
41
41
|
* @param {boolean} [options.optimizeForSpeed] - Whether to optimize for speed.
|
|
42
42
|
* @param {Cookie[]} options.cookies - Cookies to be written.
|
|
43
|
-
* @param {boolean} [options.generateDocumentOutline] - Whether to generate document outline.
|
|
44
43
|
* @returns {Promise<Buffer>} A Promise resolving to the image buffer.
|
|
45
44
|
*/
|
|
46
|
-
async capture({ url, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook,
|
|
45
|
+
async capture({ url, properties, emulatedMediaType, emulatedMediaFeatures, waitDelay, waitForExpression, waitForSelector, userAgent, extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent, skipNetworkAlmostIdleEvent, optimizeForSpeed, cookies, downloadFrom, webhook, outputFilename, trace }) {
|
|
47
46
|
const _url = new url_1.URL(url);
|
|
48
47
|
const data = new FormData();
|
|
49
48
|
data.append('url', _url.href);
|
|
@@ -54,6 +53,7 @@ class UrlScreenshot extends screenshot_1.Screenshot {
|
|
|
54
53
|
waitDelay,
|
|
55
54
|
waitForExpression,
|
|
56
55
|
waitForSelector,
|
|
56
|
+
userAgent,
|
|
57
57
|
extraHttpHeaders,
|
|
58
58
|
failOnHttpStatusCodes,
|
|
59
59
|
failOnConsoleExceptions,
|
|
@@ -65,13 +65,9 @@ class UrlScreenshot extends screenshot_1.Screenshot {
|
|
|
65
65
|
optimizeForSpeed,
|
|
66
66
|
cookies,
|
|
67
67
|
downloadFrom,
|
|
68
|
-
webhook
|
|
69
|
-
generateDocumentOutline,
|
|
70
|
-
userPassword,
|
|
71
|
-
ownerPassword,
|
|
72
|
-
embeds
|
|
68
|
+
webhook
|
|
73
69
|
});
|
|
74
|
-
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.buildWebhookHeaders(webhook));
|
|
70
|
+
return common_1.GotenbergUtils.fetch(this.endpoint, data, main_config_1.Chromiumly.getGotenbergApiBasicAuthUsername(), main_config_1.Chromiumly.getGotenbergApiBasicAuthPassword(), main_config_1.Chromiumly.getCustomHttpHeaders(), main_config_1.Chromiumly.getGotenbergApiKey(), common_1.GotenbergUtils.combineHeaders(common_1.GotenbergUtils.buildWebhookHeaders(webhook), common_1.GotenbergUtils.buildOutputHeaders({ outputFilename, trace })));
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
exports.UrlScreenshot = UrlScreenshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/url.screenshot.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,uBAAU;IACzC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"url.screenshot.js","sourceRoot":"","sources":["../../../src/chromium/screenshots/url.screenshot.ts"],"names":[],"mappings":";;;AAAA,6BAA0B;AAE1B,yCAA8C;AAE9C,gEAA4D;AAC5D,6CAA0C;AAC1C,mDAA8D;AAE9D;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,uBAAU;IACzC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH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