chromiumly 2.2.0 → 2.4.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 +1 -0
- package/dist/chromium/converters/html.converter.d.ts +8 -3
- package/dist/chromium/converters/html.converter.js +19 -18
- package/dist/chromium/converters/html.converter.js.map +1 -1
- package/dist/chromium/converters/markdown.converter.d.ts +8 -3
- package/dist/chromium/converters/markdown.converter.js +24 -18
- package/dist/chromium/converters/markdown.converter.js.map +1 -1
- package/dist/chromium/converters/url.converter.d.ts +8 -3
- package/dist/chromium/converters/url.converter.js +14 -19
- package/dist/chromium/converters/url.converter.js.map +1 -1
- package/dist/chromium/interfaces/converter.types.d.ts +18 -0
- package/dist/chromium/utils/converter.utils.d.ts +2 -1
- package/dist/chromium/utils/converter.utils.js +56 -0
- package/dist/chromium/utils/converter.utils.js.map +1 -1
- package/dist/common/gotenberg.utils.js.map +1 -1
- package/dist/gotenberg.js.map +1 -1
- package/dist/libre-office/utils/libre-office.utils.js.map +1 -1
- package/dist/pdf-engines/pdf.engine.d.ts +2 -1
- package/dist/pdf-engines/pdf.engine.js +5 -2
- package/dist/pdf-engines/pdf.engine.js.map +1 -1
- package/dist/pdf-engines/utils/engine.utils.js.map +1 -1
- package/package.json +27 -12
- package/src/chromium/converters/html.converter.ts +31 -24
- package/src/chromium/converters/markdown.converter.ts +36 -22
- package/src/chromium/converters/tests/html.converter.test.ts +11 -0
- package/src/chromium/converters/tests/markdown.converter.test.ts +13 -1
- package/src/chromium/converters/url.converter.ts +27 -22
- package/src/chromium/interfaces/converter.types.ts +18 -0
- package/src/chromium/utils/converter.utils.ts +73 -1
- package/src/chromium/utils/tests/converter.utils.test.ts +267 -7
- package/src/pdf-engines/pdf.engine.ts +13 -1
- package/src/pdf-engines/tests/pdf.engine.test.ts +2 -1
- package/dist/chromium/interfaces/converter.interface.d.ts +0 -10
- package/dist/chromium/interfaces/converter.interface.js +0 -3
- package/dist/chromium/interfaces/converter.interface.js.map +0 -1
- package/src/chromium/interfaces/converter.interface.ts +0 -12
package/README.md
CHANGED
|
@@ -121,6 +121,7 @@ type PageProperties = {
|
|
|
121
121
|
};
|
|
122
122
|
preferCssPageSize?: boolean; // Define whether to prefer page size as defined by CSS (default false)
|
|
123
123
|
printBackground?: boolean; // Print the background graphics (default false)
|
|
124
|
+
omitBackground?: boolean; // Hide the default white background and allow generating PDFs with transparency (default false)
|
|
124
125
|
landscape?: boolean; // Set the paper orientation to landscape (default false)
|
|
125
126
|
scale?: number; // The scale of the page rendering (default 1.0)
|
|
126
127
|
nativePageRanges?: { from: number; to: number }; // Page ranges to print
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { PathLike } from "fs";
|
|
4
4
|
import { PdfFormat } from "../../common";
|
|
5
|
-
import { IConverter } from "../interfaces/converter.interface";
|
|
6
5
|
import { EmulatedMediaType, PageProperties } from "../interfaces/converter.types";
|
|
7
6
|
import { Converter } from "./converter";
|
|
8
|
-
export declare class HtmlConverter extends Converter
|
|
7
|
+
export declare class HtmlConverter extends Converter {
|
|
9
8
|
constructor();
|
|
10
|
-
convert({ html, header, footer, properties, pdfFormat, emulatedMediaType, }: {
|
|
9
|
+
convert({ html, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }: {
|
|
11
10
|
html: PathLike;
|
|
12
11
|
header?: PathLike;
|
|
13
12
|
footer?: PathLike;
|
|
14
13
|
properties?: PageProperties;
|
|
15
14
|
pdfFormat?: PdfFormat;
|
|
15
|
+
pdfUA?: boolean;
|
|
16
16
|
emulatedMediaType?: EmulatedMediaType;
|
|
17
|
+
waitDelay?: string;
|
|
18
|
+
waitForExpression?: string;
|
|
19
|
+
userAgent?: string;
|
|
20
|
+
extraHttpHeaders?: Record<string, string>;
|
|
21
|
+
failOnConsoleExceptions?: boolean;
|
|
17
22
|
}): Promise<Buffer>;
|
|
18
23
|
}
|
|
@@ -12,28 +12,29 @@ class HtmlConverter extends converter_1.Converter {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super(main_config_1.ChromiumRoute.HTML);
|
|
14
14
|
}
|
|
15
|
-
convert({ html, header, footer, properties, pdfFormat, emulatedMediaType, }) {
|
|
15
|
+
convert({ html, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }) {
|
|
16
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
yield fs_1.promises.access(html, fs_1.constants.R_OK);
|
|
18
17
|
const data = new form_data_1.default();
|
|
19
|
-
if (
|
|
20
|
-
data.append("
|
|
18
|
+
if (Buffer.isBuffer(html)) {
|
|
19
|
+
data.append("files", html, "index.html");
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
data.append("header.html", (0, fs_1.createReadStream)(header));
|
|
26
|
-
}
|
|
27
|
-
if (footer) {
|
|
28
|
-
yield fs_1.promises.access(footer, fs_1.constants.R_OK);
|
|
29
|
-
data.append("footer.html", (0, fs_1.createReadStream)(footer));
|
|
30
|
-
}
|
|
31
|
-
if (emulatedMediaType) {
|
|
32
|
-
data.append("emulatedMediaType", emulatedMediaType);
|
|
33
|
-
}
|
|
34
|
-
if (properties) {
|
|
35
|
-
converter_utils_1.ConverterUtils.injectPageProperties(data, properties);
|
|
21
|
+
else {
|
|
22
|
+
yield fs_1.promises.access(html, fs_1.constants.R_OK);
|
|
23
|
+
data.append("files", (0, fs_1.createReadStream)(html), "index.html");
|
|
36
24
|
}
|
|
25
|
+
converter_utils_1.ConverterUtils.customize(data, {
|
|
26
|
+
header,
|
|
27
|
+
footer,
|
|
28
|
+
properties,
|
|
29
|
+
pdfFormat,
|
|
30
|
+
pdfUA,
|
|
31
|
+
emulatedMediaType,
|
|
32
|
+
waitDelay,
|
|
33
|
+
waitForExpression,
|
|
34
|
+
userAgent,
|
|
35
|
+
extraHttpHeaders,
|
|
36
|
+
failOnConsoleExceptions,
|
|
37
|
+
});
|
|
37
38
|
return common_1.GotenbergUtils.fetch(this.endpoint, data);
|
|
38
39
|
});
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AAErE,kEAAiC;AAEjC,yCAAyD;
|
|
1
|
+
{"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AAErE,kEAAiC;AAEjC,yCAAyD;AAKzD,8DAA0D;AAC1D,2CAAwC;AACxC,mDAAkD;AAElD,MAAa,aAAc,SAAQ,qBAAS;IAC1C;QACE,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEK,OAAO,CAAC,EACZ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,uBAAuB,GAcxB;;YACC,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,MAAM,aAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,qBAAgB,EAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;YAC7D,CAAC;YAED,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;gBAC7B,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,KAAK;gBACL,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,SAAS;gBACT,gBAAgB;gBAChB,uBAAuB;aACxB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;KAAA;CACF;AAzDD,sCAyDC"}
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { PathLike } from "fs";
|
|
4
4
|
import { PdfFormat } from "../../common";
|
|
5
|
-
import { IConverter } from "../interfaces/converter.interface";
|
|
6
5
|
import { EmulatedMediaType, PageProperties } from "../interfaces/converter.types";
|
|
7
6
|
import { Converter } from "./converter";
|
|
8
|
-
export declare class MarkdownConverter extends Converter
|
|
7
|
+
export declare class MarkdownConverter extends Converter {
|
|
9
8
|
constructor();
|
|
10
|
-
convert({ html, markdown, header, footer, properties, pdfFormat, emulatedMediaType, }: {
|
|
9
|
+
convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }: {
|
|
11
10
|
html: PathLike;
|
|
12
11
|
markdown: PathLike;
|
|
13
12
|
header?: PathLike;
|
|
14
13
|
footer?: PathLike;
|
|
15
14
|
properties?: PageProperties;
|
|
16
15
|
pdfFormat?: PdfFormat;
|
|
16
|
+
pdfUA?: boolean;
|
|
17
17
|
emulatedMediaType?: EmulatedMediaType;
|
|
18
|
+
waitDelay?: string;
|
|
19
|
+
waitForExpression?: string;
|
|
20
|
+
userAgent?: string;
|
|
21
|
+
extraHttpHeaders?: Record<string, string>;
|
|
22
|
+
failOnConsoleExceptions?: boolean;
|
|
18
23
|
}): Promise<Buffer>;
|
|
19
24
|
}
|
|
@@ -12,30 +12,36 @@ class MarkdownConverter extends converter_1.Converter {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super(main_config_1.ChromiumRoute.MARKDOWN);
|
|
14
14
|
}
|
|
15
|
-
convert({ html, markdown, header, footer, properties, pdfFormat, emulatedMediaType, }) {
|
|
15
|
+
convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }) {
|
|
16
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
yield fs_1.promises.access(html, fs_1.constants.R_OK);
|
|
18
|
-
yield fs_1.promises.access(markdown, fs_1.constants.R_OK);
|
|
19
17
|
const data = new form_data_1.default();
|
|
20
|
-
if (
|
|
21
|
-
data.append("
|
|
18
|
+
if (Buffer.isBuffer(html)) {
|
|
19
|
+
data.append("files", html, "index.html");
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
yield fs_1.promises.access(header, fs_1.constants.R_OK);
|
|
27
|
-
data.append("header.html", (0, fs_1.createReadStream)(header));
|
|
21
|
+
else {
|
|
22
|
+
yield fs_1.promises.access(html, fs_1.constants.R_OK);
|
|
23
|
+
data.append("files", (0, fs_1.createReadStream)(html), "index.html");
|
|
28
24
|
}
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
data.append("footer.html", (0, fs_1.createReadStream)(footer));
|
|
25
|
+
if (Buffer.isBuffer(markdown)) {
|
|
26
|
+
data.append("files", (0, fs_1.createReadStream)(markdown), "file.md");
|
|
32
27
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (properties) {
|
|
37
|
-
converter_utils_1.ConverterUtils.injectPageProperties(data, properties);
|
|
28
|
+
else {
|
|
29
|
+
yield fs_1.promises.access(markdown, fs_1.constants.R_OK);
|
|
30
|
+
data.append("file.md", (0, fs_1.createReadStream)(markdown));
|
|
38
31
|
}
|
|
32
|
+
converter_utils_1.ConverterUtils.customize(data, {
|
|
33
|
+
header,
|
|
34
|
+
footer,
|
|
35
|
+
properties,
|
|
36
|
+
pdfFormat,
|
|
37
|
+
pdfUA,
|
|
38
|
+
emulatedMediaType,
|
|
39
|
+
waitDelay,
|
|
40
|
+
waitForExpression,
|
|
41
|
+
userAgent,
|
|
42
|
+
extraHttpHeaders,
|
|
43
|
+
failOnConsoleExceptions,
|
|
44
|
+
});
|
|
39
45
|
return common_1.GotenbergUtils.fetch(this.endpoint, data);
|
|
40
46
|
});
|
|
41
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AAErE,kEAAiC;AAEjC,yCAAyD;
|
|
1
|
+
{"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AAErE,kEAAiC;AAEjC,yCAAyD;AAKzD,8DAA0D;AAC1D,2CAAwC;AACxC,mDAAkD;AAElD,MAAa,iBAAkB,SAAQ,qBAAS;IAC9C;QACE,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAEK,OAAO,CAAC,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,uBAAuB,GAexB;;YACC,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,MAAM,aAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,qBAAgB,EAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;YAC7D,CAAC;YAED,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAA,qBAAgB,EAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;YAC9D,CAAC;iBAAM,CAAC;gBACN,MAAM,aAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;gBAChD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAA,qBAAgB,EAAC,QAAQ,CAAC,CAAC,CAAC;YACrD,CAAC;YAED,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;gBAC7B,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,KAAK;gBACL,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,SAAS;gBACT,gBAAgB;gBAChB,uBAAuB;aACxB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;KAAA;CACF;AAlED,8CAkEC"}
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { PathLike } from "fs";
|
|
4
4
|
import { PdfFormat } from "../../common";
|
|
5
|
-
import { IConverter } from "../interfaces/converter.interface";
|
|
6
5
|
import { EmulatedMediaType, PageProperties } from "../interfaces/converter.types";
|
|
7
6
|
import { Converter } from "./converter";
|
|
8
|
-
export declare class UrlConverter extends Converter
|
|
7
|
+
export declare class UrlConverter extends Converter {
|
|
9
8
|
constructor();
|
|
10
|
-
convert({ url, header, footer, properties, pdfFormat, emulatedMediaType, }: {
|
|
9
|
+
convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }: {
|
|
11
10
|
url: string;
|
|
12
11
|
header?: PathLike;
|
|
13
12
|
footer?: PathLike;
|
|
14
13
|
properties?: PageProperties;
|
|
15
14
|
pdfFormat?: PdfFormat;
|
|
15
|
+
pdfUA?: boolean;
|
|
16
16
|
emulatedMediaType?: EmulatedMediaType;
|
|
17
|
+
waitDelay?: string;
|
|
18
|
+
waitForExpression?: string;
|
|
19
|
+
userAgent?: string;
|
|
20
|
+
extraHttpHeaders?: Record<string, string>;
|
|
21
|
+
failOnConsoleExceptions?: boolean;
|
|
17
22
|
}): Promise<Buffer>;
|
|
18
23
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UrlConverter = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
5
|
const url_1 = require("url");
|
|
7
6
|
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
8
7
|
const common_1 = require("../../common");
|
|
@@ -13,28 +12,24 @@ class UrlConverter extends converter_1.Converter {
|
|
|
13
12
|
constructor() {
|
|
14
13
|
super(main_config_1.ChromiumRoute.URL);
|
|
15
14
|
}
|
|
16
|
-
convert({ url, header, footer, properties, pdfFormat, emulatedMediaType, }) {
|
|
15
|
+
convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }) {
|
|
17
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
const _url = new url_1.URL(url);
|
|
19
18
|
const data = new form_data_1.default();
|
|
20
|
-
if (pdfFormat) {
|
|
21
|
-
data.append("pdfFormat", pdfFormat);
|
|
22
|
-
}
|
|
23
19
|
data.append("url", _url.href);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
20
|
+
converter_utils_1.ConverterUtils.customize(data, {
|
|
21
|
+
header,
|
|
22
|
+
footer,
|
|
23
|
+
properties,
|
|
24
|
+
pdfFormat,
|
|
25
|
+
pdfUA,
|
|
26
|
+
emulatedMediaType,
|
|
27
|
+
waitDelay,
|
|
28
|
+
waitForExpression,
|
|
29
|
+
userAgent,
|
|
30
|
+
extraHttpHeaders,
|
|
31
|
+
failOnConsoleExceptions,
|
|
32
|
+
});
|
|
38
33
|
return common_1.GotenbergUtils.fetch(this.endpoint, data);
|
|
39
34
|
});
|
|
40
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;;AAEA,6BAA0B;AAE1B,kEAAiC;AAEjC,yCAAyD;AAKzD,8DAA0D;AAC1D,2CAAwC;AACxC,mDAAkD;AAElD,MAAa,YAAa,SAAQ,qBAAS;IACzC;QACE,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAEK,OAAO,CAAC,EACZ,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,uBAAuB,GAcxB;;YACC,MAAM,IAAI,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAE9B,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;gBAC7B,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,KAAK;gBACL,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,SAAS;gBACT,gBAAgB;gBAChB,uBAAuB;aACxB,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnD,CAAC;KAAA;CACF;AArDD,oCAqDC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { PathLike } from "fs";
|
|
4
|
+
import { PdfFormat } from "../../common";
|
|
1
5
|
type PageSize = {
|
|
2
6
|
width: number;
|
|
3
7
|
height: number;
|
|
@@ -13,6 +17,7 @@ export type PageProperties = {
|
|
|
13
17
|
margins?: PageMargins;
|
|
14
18
|
preferCssPageSize?: boolean;
|
|
15
19
|
printBackground?: boolean;
|
|
20
|
+
omitBackground?: boolean;
|
|
16
21
|
landscape?: boolean;
|
|
17
22
|
scale?: number;
|
|
18
23
|
nativePageRanges?: {
|
|
@@ -21,4 +26,17 @@ export type PageProperties = {
|
|
|
21
26
|
};
|
|
22
27
|
};
|
|
23
28
|
export type EmulatedMediaType = "screen" | "print";
|
|
29
|
+
export type ConversionOptions = {
|
|
30
|
+
header?: PathLike | Buffer;
|
|
31
|
+
footer?: PathLike | Buffer;
|
|
32
|
+
properties?: PageProperties;
|
|
33
|
+
pdfFormat?: PdfFormat;
|
|
34
|
+
pdfUA?: boolean;
|
|
35
|
+
emulatedMediaType?: EmulatedMediaType;
|
|
36
|
+
waitDelay?: string;
|
|
37
|
+
waitForExpression?: string;
|
|
38
|
+
userAgent?: string;
|
|
39
|
+
extraHttpHeaders?: Record<string, string>;
|
|
40
|
+
failOnConsoleExceptions?: boolean;
|
|
41
|
+
};
|
|
24
42
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import FormData from "form-data";
|
|
2
|
-
import { PageProperties } from "../interfaces/converter.types";
|
|
2
|
+
import { ConversionOptions, PageProperties } from "../interfaces/converter.types";
|
|
3
3
|
export declare class ConverterUtils {
|
|
4
4
|
static injectPageProperties(data: FormData, pageProperties: PageProperties): void;
|
|
5
|
+
static customize(data: FormData, options: ConversionOptions): Promise<void>;
|
|
5
6
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConverterUtils = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fs_1 = require("fs");
|
|
4
6
|
const gotenberg_utils_1 = require("../../common/gotenberg.utils");
|
|
5
7
|
class ConverterUtils {
|
|
6
8
|
static injectPageProperties(data, pageProperties) {
|
|
@@ -25,6 +27,9 @@ class ConverterUtils {
|
|
|
25
27
|
if (pageProperties.printBackground) {
|
|
26
28
|
data.append("printBackground", String(pageProperties.printBackground));
|
|
27
29
|
}
|
|
30
|
+
if (pageProperties.omitBackground) {
|
|
31
|
+
data.append("omitBackground", String(pageProperties.omitBackground));
|
|
32
|
+
}
|
|
28
33
|
if (pageProperties.landscape) {
|
|
29
34
|
data.append("landscape", String(pageProperties.landscape));
|
|
30
35
|
}
|
|
@@ -40,6 +45,57 @@ class ConverterUtils {
|
|
|
40
45
|
data.append("nativePageRanges", `${pageProperties.nativePageRanges.from}-${pageProperties.nativePageRanges.to}`);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
48
|
+
static customize(data, options) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
if (options.pdfFormat) {
|
|
51
|
+
data.append("pdfa", options.pdfFormat);
|
|
52
|
+
}
|
|
53
|
+
if (options.pdfUA) {
|
|
54
|
+
data.append("pdfua", String(options.pdfUA));
|
|
55
|
+
}
|
|
56
|
+
if (options.header) {
|
|
57
|
+
const { header } = options;
|
|
58
|
+
if (Buffer.isBuffer(header)) {
|
|
59
|
+
data.append("files", header, "header.html");
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
yield fs_1.promises.access(options.header, fs_1.constants.R_OK);
|
|
63
|
+
data.append("files", (0, fs_1.createReadStream)(options.header), "header.html");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (options.footer) {
|
|
67
|
+
const { footer } = options;
|
|
68
|
+
if (Buffer.isBuffer(footer)) {
|
|
69
|
+
data.append("files", footer, "footer.html");
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
yield fs_1.promises.access(options.footer, fs_1.constants.R_OK);
|
|
73
|
+
data.append("files", (0, fs_1.createReadStream)(options.footer), "footer.html");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (options.emulatedMediaType) {
|
|
77
|
+
data.append("emulatedMediaType", options.emulatedMediaType);
|
|
78
|
+
}
|
|
79
|
+
if (options.properties) {
|
|
80
|
+
ConverterUtils.injectPageProperties(data, options.properties);
|
|
81
|
+
}
|
|
82
|
+
if (options.waitDelay) {
|
|
83
|
+
data.append("waitDelay", options.waitDelay);
|
|
84
|
+
}
|
|
85
|
+
if (options.waitForExpression) {
|
|
86
|
+
data.append("waitForExpression", options.waitForExpression);
|
|
87
|
+
}
|
|
88
|
+
if (options.userAgent) {
|
|
89
|
+
data.append("userAgent", options.userAgent);
|
|
90
|
+
}
|
|
91
|
+
if (options.extraHttpHeaders) {
|
|
92
|
+
data.append("extraHttpHeaders", JSON.stringify(options.extraHttpHeaders));
|
|
93
|
+
}
|
|
94
|
+
if (options.failOnConsoleExceptions) {
|
|
95
|
+
data.append("failOnConsoleExceptions", String(options.failOnConsoleExceptions));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
43
99
|
}
|
|
44
100
|
exports.ConverterUtils = ConverterUtils;
|
|
45
101
|
//# sourceMappingURL=converter.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/converter.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"converter.utils.js","sourceRoot":"","sources":["../../../src/chromium/utils/converter.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAA2D;AAG3D,kEAA8D;AAM9D,MAAa,cAAc;IAClB,MAAM,CAAC,oBAAoB,CAChC,IAAc,EACd,cAA8B;QAE9B,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC;YACxB,gCAAc,CAAC,MAAM,CACnB,cAAc,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,IAAI,GAAG,EACrE,4EAA4E,CAC7E,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrD,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;YAC3B,gCAAc,CAAC,MAAM,CACnB,cAAc,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;gBAC7B,cAAc,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC;gBAClC,cAAc,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;gBAChC,cAAc,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,EAClC,kCAAkC,CACnC,CAAC;YAEF,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACrD,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3D,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACvD,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC3D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";;;;AACA,oEAA+B;AAE/B,MAAa,cAAc;IAClB,MAAM,CAAC,MAAM,CAAC,SAAkB,EAAE,OAAe;QACtD,IAAI,CAAC,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"gotenberg.utils.js","sourceRoot":"","sources":["../../src/common/gotenberg.utils.ts"],"names":[],"mappings":";;;;AACA,oEAA+B;AAE/B,MAAa,cAAc;IAClB,MAAM,CAAC,MAAM,CAAC,SAAkB,EAAE,OAAe;QACtD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAEM,MAAM,CAAO,KAAK,CAAC,QAAgB,EAAE,IAAc;;YACxD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,QAAQ,EAAE;gBACrC,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI;gBACV,OAAO,oBACF,IAAI,CAAC,UAAU,EAAE,CACrB;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,OAAO,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC3B,CAAC;KAAA;CACF;AArBD,wCAqBC"}
|
package/dist/gotenberg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gotenberg.js","sourceRoot":"","sources":["../src/gotenberg.ts"],"names":[],"mappings":";;;;AAAA,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,CAAC;AAE7C,uDAAiC;AACjC,mDAA6B;AAC7B,4DAA4B;AAE5B,wEAAwE;AACxE,MAAM,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/C,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAEpE,oDAAoD;AACpD,IAAI,YAAY,CAAC,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"gotenberg.js","sourceRoot":"","sources":["../src/gotenberg.ts"],"names":[],"mappings":";;;;AAAA,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,CAAC;AAE7C,uDAAiC;AACjC,mDAA6B;AAC7B,4DAA4B;AAE5B,wEAAwE;AACxE,MAAM,OAAO,GAAG,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/C,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAEpE,oDAAoD;AACpD,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;IACvB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AACzD,CAAC;AAED,MAAa,SAAS;;AAAtB,8BAGC;AAFe,kBAAQ,GACpB,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,gBAAM,CAAC,GAAG,CAAS,oBAAoB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libre-office.utils.js","sourceRoot":"","sources":["../../../src/libre-office/utils/libre-office.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AACrE,wDAAwB;AAIxB,yCAA8C;AAC9C,2CAAsD;AAGtD,MAAa,gBAAgB;IACpB,MAAM,CAAO,WAAW,CAAC,KAAiB,EAAE,IAAc;;YAC/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;
|
|
1
|
+
{"version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AAI,EACxC,0BAA0B,CAC3B,CAAC;YAEF,IAAI,CAAC,MAAM,CACT,kBAAkB,EAClB,GAAG,cAAc,CAAC,gBAAgB,CAAC,IAAI,IAAI,cAAc,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAChF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AArCD,4CAqCC"}
|
|
@@ -7,10 +7,11 @@ export declare class PDFEngine {
|
|
|
7
7
|
static merge({ files }: {
|
|
8
8
|
files: PathLike[];
|
|
9
9
|
}): Promise<Buffer>;
|
|
10
|
-
static convert({ files, properties, pdfFormat, merge, }: {
|
|
10
|
+
static convert({ files, properties, pdfFormat, pdfUA, merge, }: {
|
|
11
11
|
files: PathLike[];
|
|
12
12
|
properties?: PageProperties;
|
|
13
13
|
pdfFormat?: PdfFormat;
|
|
14
|
+
pdfUA?: boolean;
|
|
14
15
|
merge?: boolean;
|
|
15
16
|
}): Promise<Buffer>;
|
|
16
17
|
static generate(filename: string, buffer: Buffer): Promise<void>;
|
|
@@ -18,11 +18,14 @@ class PDFEngine {
|
|
|
18
18
|
return common_1.GotenbergUtils.fetch(endpoint, data);
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
static convert({ files, properties, pdfFormat, merge, }) {
|
|
21
|
+
static convert({ files, properties, pdfFormat, pdfUA, merge, }) {
|
|
22
22
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
const data = new form_data_1.default();
|
|
24
24
|
if (pdfFormat) {
|
|
25
|
-
data.append("
|
|
25
|
+
data.append("pdfa", pdfFormat);
|
|
26
|
+
}
|
|
27
|
+
if (pdfUA) {
|
|
28
|
+
data.append("pdfUA", String(pdfUA));
|
|
26
29
|
}
|
|
27
30
|
if (merge) {
|
|
28
31
|
data.append("merge", String(merge));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.engine.js","sourceRoot":"","sources":["../../src/pdf-engines/pdf.engine.ts"],"names":[],"mappings":";;;;AAAA,2BAAwC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CACF;AAtDD,8BAsDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.utils.js","sourceRoot":"","sources":["../../../src/pdf-engines/utils/engine.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AACrE,wDAAwB;AAIxB,MAAa,cAAc;IAClB,MAAM,CAAO,WAAW,CAAC,KAAiB,EAAE,IAAc;;YAC/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"engine.utils.js","sourceRoot":"","sources":["../../../src/pdf-engines/utils/engine.utils.ts"],"names":[],"mappings":";;;;AAAA,2BAAqE;AACrE,wDAAwB;AAIxB,MAAa,cAAc;IAClB,MAAM,CAAO,WAAW,CAAC,KAAiB,EAAE,IAAc;;YAC/D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,aAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,cAAS,CAAC,IAAI,CAAC,CAAC;gBAC5C,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAChD,MAAM,SAAS,GAAG,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACzC,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;oBACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAA,qBAAgB,EAAC,IAAI,CAAC,CAAC,CAAC;gBAChD,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,mBAAmB,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;KAAA;CACF;AAbD,wCAaC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chromiumly",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A lightweight Typescript library that interacts with Gotenberg's different modules to convert a variety of document formats to PDF files.",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "Taha Cherfia <taha.cherfia@gmail.com>",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=18.x"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"gotenberg",
|
|
@@ -29,25 +29,40 @@
|
|
|
29
29
|
"clean": "rm -rf dist build",
|
|
30
30
|
"lint": "eslint src/ --ext .js,.ts",
|
|
31
31
|
"build": "yarn clean && tsc -p tsconfig.json",
|
|
32
|
-
"test": "jest --runInBand --ci --coverage --reporters=default --reporters=jest-junit"
|
|
32
|
+
"test": "jest --runInBand --ci --coverage --reporters=default --reporters=jest-junit",
|
|
33
|
+
"commit": "git-cz",
|
|
34
|
+
"release": "release-it"
|
|
35
|
+
},
|
|
36
|
+
"config": {
|
|
37
|
+
"commitizen": {
|
|
38
|
+
"path": "@commitlint/cz-commitlint"
|
|
39
|
+
}
|
|
33
40
|
},
|
|
34
41
|
"devDependencies": {
|
|
35
|
-
"@babel/preset-typescript": "7.23.
|
|
36
|
-
"@
|
|
42
|
+
"@babel/preset-typescript": "7.23.3",
|
|
43
|
+
"@commitlint/cli": "18.4.3",
|
|
44
|
+
"@commitlint/config-conventional": "18.4.3",
|
|
45
|
+
"@commitlint/cz-commitlint": "^18.4.3",
|
|
46
|
+
"@release-it/conventional-changelog": "8.0.1",
|
|
47
|
+
"@types/config": "3.3.3",
|
|
37
48
|
"@types/dotenv": "8.2.0",
|
|
38
49
|
"@types/form-data": "2.5.0",
|
|
39
|
-
"@types/jest": "29.5.
|
|
40
|
-
"@types/node": "20.
|
|
41
|
-
"@types/node-fetch": "2.6.
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
43
|
-
"@typescript-eslint/parser": "6.
|
|
44
|
-
"
|
|
50
|
+
"@types/jest": "29.5.10",
|
|
51
|
+
"@types/node": "20.10.2",
|
|
52
|
+
"@types/node-fetch": "2.6.9",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "6.13.1",
|
|
54
|
+
"@typescript-eslint/parser": "6.13.1",
|
|
55
|
+
"commitizen": "4.3.0",
|
|
56
|
+
"eslint": "8.55.0",
|
|
57
|
+
"husky": "8.0.3",
|
|
58
|
+
"inquirer": "8",
|
|
45
59
|
"jest": "29.7.0",
|
|
46
60
|
"jest-junit": "16.0.0",
|
|
61
|
+
"release-it": "17.0.0",
|
|
47
62
|
"ts-jest": "29.1.1",
|
|
48
63
|
"ts-node": "10.9.1",
|
|
49
64
|
"tslib": "2.6.2",
|
|
50
|
-
"typescript": "5.
|
|
65
|
+
"typescript": "5.3.2"
|
|
51
66
|
},
|
|
52
67
|
"dependencies": {
|
|
53
68
|
"config": "3.3.9",
|