chromiumly 2.4.0 → 2.5.1

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.
Files changed (77) hide show
  1. package/README.md +57 -40
  2. package/dist/chromium/converters/converter.d.ts +13 -0
  3. package/dist/chromium/converters/converter.js +10 -0
  4. package/dist/chromium/converters/converter.js.map +1 -1
  5. package/dist/chromium/converters/html.converter.d.ts +32 -6
  6. package/dist/chromium/converters/html.converter.js +30 -9
  7. package/dist/chromium/converters/html.converter.js.map +1 -1
  8. package/dist/chromium/converters/markdown.converter.d.ts +34 -7
  9. package/dist/chromium/converters/markdown.converter.js +32 -16
  10. package/dist/chromium/converters/markdown.converter.js.map +1 -1
  11. package/dist/chromium/converters/url.converter.d.ts +31 -5
  12. package/dist/chromium/converters/url.converter.js +29 -1
  13. package/dist/chromium/converters/url.converter.js.map +1 -1
  14. package/dist/chromium/index.js.map +1 -1
  15. package/dist/chromium/interfaces/converter.types.d.ts +3 -6
  16. package/dist/chromium/utils/converter.utils.d.ts +27 -1
  17. package/dist/chromium/utils/converter.utils.js +48 -21
  18. package/dist/chromium/utils/converter.utils.js.map +1 -1
  19. package/dist/common/constants.js.map +1 -1
  20. package/dist/common/gotenberg.utils.d.ts +18 -0
  21. package/dist/common/gotenberg.utils.js +18 -0
  22. package/dist/common/gotenberg.utils.js.map +1 -1
  23. package/dist/common/index.d.ts +1 -0
  24. package/dist/common/index.js.map +1 -1
  25. package/dist/common/types.d.ts +3 -0
  26. package/dist/common/types.js +3 -0
  27. package/dist/common/types.js.map +1 -0
  28. package/dist/gotenberg.d.ts +8 -0
  29. package/dist/gotenberg.js +8 -0
  30. package/dist/gotenberg.js.map +1 -1
  31. package/dist/libre-office/index.js.map +1 -1
  32. package/dist/libre-office/utils/constants.js +76 -76
  33. package/dist/libre-office/utils/constants.js.map +1 -1
  34. package/dist/libre-office/utils/libre-office.utils.d.ts +19 -4
  35. package/dist/libre-office/utils/libre-office.utils.js +39 -7
  36. package/dist/libre-office/utils/libre-office.utils.js.map +1 -1
  37. package/dist/main.config.d.ts +43 -0
  38. package/dist/main.config.js +43 -0
  39. package/dist/main.config.js.map +1 -1
  40. package/dist/main.js.map +1 -1
  41. package/dist/pdf-engines/index.js.map +1 -1
  42. package/dist/pdf-engines/pdf.engine.d.ts +31 -5
  43. package/dist/pdf-engines/pdf.engine.js +31 -3
  44. package/dist/pdf-engines/pdf.engine.js.map +1 -1
  45. package/dist/pdf-engines/utils/engine.utils.d.ts +12 -3
  46. package/dist/pdf-engines/utils/engine.utils.js +27 -8
  47. package/dist/pdf-engines/utils/engine.utils.js.map +1 -1
  48. package/package.json +8 -7
  49. package/src/chromium/converters/converter.ts +18 -5
  50. package/src/chromium/converters/html.converter.ts +82 -61
  51. package/src/chromium/converters/markdown.converter.ts +86 -69
  52. package/src/chromium/converters/tests/html.converter.test.ts +119 -135
  53. package/src/chromium/converters/tests/markdown.converter.test.ts +131 -150
  54. package/src/chromium/converters/tests/url.converter.test.ts +114 -123
  55. package/src/chromium/converters/url.converter.ts +84 -60
  56. package/src/chromium/index.ts +3 -3
  57. package/src/chromium/interfaces/converter.types.ts +27 -27
  58. package/src/chromium/utils/converter.utils.ts +165 -139
  59. package/src/chromium/utils/tests/converter.utils.test.ts +312 -311
  60. package/src/common/constants.ts +3 -3
  61. package/src/common/gotenberg.utils.ts +36 -17
  62. package/src/common/index.ts +3 -2
  63. package/src/common/tests/gotenberg.utils.test.ts +54 -54
  64. package/src/common/types.ts +3 -0
  65. package/src/gotenberg.ts +13 -4
  66. package/src/libre-office/index.ts +2 -2
  67. package/src/libre-office/interfaces/libre-office.types.ts +2 -2
  68. package/src/libre-office/utils/constants.ts +76 -76
  69. package/src/libre-office/utils/libre-office.utils.ts +72 -37
  70. package/src/libre-office/utils/tests/libre-office.utils.test.ts +100 -68
  71. package/src/main.config.ts +68 -22
  72. package/src/main.ts +3 -3
  73. package/src/pdf-engines/index.ts +1 -1
  74. package/src/pdf-engines/pdf.engine.ts +77 -49
  75. package/src/pdf-engines/tests/pdf.engine.test.ts +94 -94
  76. package/src/pdf-engines/utils/engine.utils.ts +30 -12
  77. package/src/pdf-engines/utils/tests/engine.utils.test.ts +60 -48
package/README.md CHANGED
@@ -8,7 +8,8 @@
8
8
  [![downloads](https://img.shields.io/npm/dt/chromiumly.svg?color=brightgreen&style=flat-square)](https://npm-stat.com/charts.html?package=chromiumly)
9
9
  ![licence](https://img.shields.io/github/license/cherfia/chromiumly?style=flat-square)
10
10
 
11
- A lightweight Typescript library that interacts with [Gotenberg](https://gotenberg.dev/)'s different modules to convert a variety of document formats to PDF files.
11
+ A lightweight Typescript library that interacts with [Gotenberg](https://gotenberg.dev/)'s different modules to convert
12
+ a variety of document formats to PDF files.
12
13
 
13
14
  ## Install
14
15
 
@@ -26,7 +27,8 @@ yarn add chromiumly
26
27
 
27
28
  ## Prerequisites
28
29
 
29
- Before attempting to use Chromiumly, be sure you install [Docker](https://www.docker.com/) if you have not already done so.
30
+ Before attempting to use Chromiumly, be sure you install [Docker](https://www.docker.com/) if you have not already done
31
+ so.
30
32
 
31
33
  After that, you can start a default Docker container of [Gotenberg](https://gotenberg.dev/) as follows:
32
34
 
@@ -38,7 +40,8 @@ docker run --rm -p 3000:3000 gotenberg/gotenberg:7
38
40
 
39
41
  ### Configuration
40
42
 
41
- Chromiumly supports both [dotenv](https://www.npmjs.com/package/dotenv) and [config](https://www.npmjs.com/package/config) configuration libraries to add Gotenberg endpoint to your project.
43
+ Chromiumly supports both [dotenv](https://www.npmjs.com/package/dotenv)
44
+ and [config](https://www.npmjs.com/package/config) configuration libraries to add Gotenberg endpoint to your project.
42
45
 
43
46
  #### dotenv
44
47
 
@@ -58,16 +61,21 @@ GOTENBERG_ENDPOINT=http://localhost:3000
58
61
 
59
62
  ## Modules
60
63
 
61
- Chromiumly introduces different classes that serve as wrappers to Gotenberg's [modules](https://gotenberg.dev/docs/modules/api#modules).
64
+ Chromiumly introduces different classes that serve as wrappers to
65
+ Gotenberg's [modules](https://gotenberg.dev/docs/modules/api#modules). These classes encompass methods featuring an
66
+ input file parameter, such as `html`, `header`, `footer`, and `markdown`, capable of accepting inputs in the form of a
67
+ `string` (i.e. file path), `Buffer`, or `ReadStream`.
62
68
 
63
69
  ### Chormium
64
70
 
65
- There are three different classes that come with a single method (i.e.`convert`) which calls one of Chromium's [routes](https://gotenberg.dev/docs/modules/chromium#routes) to convert `html` and `markdown` files, or a `url` to a `buffer` which contains the converted PDF file content.
71
+ There are three different classes that come with a single method (i.e.`convert`) which calls one of
72
+ Chromium's [routes](https://gotenberg.dev/docs/modules/chromium#routes) to convert `html` and `markdown` files, or
73
+ a `url` to a `buffer` which contains the converted PDF file content.
66
74
 
67
75
  #### URL
68
76
 
69
77
  ```typescript
70
- import { UrlConverter } from "chromiumly";
78
+ import {UrlConverter} from "chromiumly";
71
79
 
72
80
  const urlConverter = new UrlConverter();
73
81
  const buffer = await urlConverter.convert({
@@ -80,7 +88,7 @@ const buffer = await urlConverter.convert({
80
88
  The only requirement is that the file name should be `index.html`.
81
89
 
82
90
  ```typescript
83
- import { HtmlConverter } from "chromiumly";
91
+ import {HtmlConverter} from "chromiumly";
84
92
 
85
93
  const htmlConverter = new HtmlConverter();
86
94
  const buffer = await htmlConverter.convert({
@@ -94,7 +102,7 @@ const buffer = await htmlConverter.convert({
94
102
  This route accepts an `index.html` file plus a markdown file.
95
103
 
96
104
  ```typescript
97
- import { MarkdownConverter } from "chromiumly";
105
+ import {MarkdownConverter} from "chromiumly";
98
106
 
99
107
  const markdownConverter = new MarkdownConverter();
100
108
  const buffer = await markdownConverter.convert({
@@ -105,42 +113,47 @@ const buffer = await markdownConverter.convert({
105
113
 
106
114
  ### Customization
107
115
 
108
- `convert()` method takes an optional `properties` parameter of the following type which dictates how the PDF generated file will look like.
116
+ `convert()` method takes an optional `properties` parameter of the following type which dictates how the PDF generated
117
+ file will look like.
109
118
 
110
119
  ```typescript
111
120
  type PageProperties = {
112
- size?: {
113
- width: number; // Paper width, in inches (default 8.5)
114
- height: number; //Paper height, in inches (default 11)
115
- };
116
- margins?: {
117
- top: number; // Top margin, in inches (default 0.39)
118
- bottom: number; // Bottom margin, in inches (default 0.39)
119
- left: number; // Left margin, in inches (default 0.39)
120
- right: number; // Right margin, in inches (default 0.39)
121
- };
122
- preferCssPageSize?: boolean; // Define whether to prefer page size as defined by CSS (default false)
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)
125
- landscape?: boolean; // Set the paper orientation to landscape (default false)
126
- scale?: number; // The scale of the page rendering (default 1.0)
127
- nativePageRanges?: { from: number; to: number }; // Page ranges to print
121
+ size?: {
122
+ width: number; // Paper width, in inches (default 8.5)
123
+ height: number; //Paper height, in inches (default 11)
124
+ };
125
+ margins?: {
126
+ top: number; // Top margin, in inches (default 0.39)
127
+ bottom: number; // Bottom margin, in inches (default 0.39)
128
+ left: number; // Left margin, in inches (default 0.39)
129
+ right: number; // Right margin, in inches (default 0.39)
130
+ };
131
+ preferCssPageSize?: boolean; // Define whether to prefer page size as defined by CSS (default false)
132
+ printBackground?: boolean; // Print the background graphics (default false)
133
+ omitBackground?: boolean; // Hide the default white background and allow generating PDFs with transparency (default false)
134
+ landscape?: boolean; // Set the paper orientation to landscape (default false)
135
+ scale?: number; // The scale of the page rendering (default 1.0)
136
+ nativePageRanges?: { from: number; to: number }; // Page ranges to print
128
137
  };
129
138
  ```
130
139
 
131
140
  ### PDF Engine
132
141
 
133
- The `PDFEngine` combines the functionality of both Gotenberg's [PDF Engines](https://gotenberg.dev/docs/modules/pdf-engines) and [LibreOffice](https://gotenberg.dev/docs/modules/libreoffice) modules to manipulate different file formats.
142
+ The `PDFEngine` combines the functionality of both
143
+ Gotenberg's [PDF Engines](https://gotenberg.dev/docs/modules/pdf-engines)
144
+ and [LibreOffice](https://gotenberg.dev/docs/modules/libreoffice) modules to manipulate different file formats.
134
145
 
135
146
  #### convert
136
147
 
137
- This method interacts with [LibreOffice](https://gotenberg.dev/docs/modules/libreoffice) module to convert different documents to PDF files. You can find the file extensions accepted [here](https://gotenberg.dev/docs/modules/libreoffice#route).
148
+ This method interacts with [LibreOffice](https://gotenberg.dev/docs/modules/libreoffice) module to convert different
149
+ documents to PDF files. You can find the file extensions
150
+ accepted [here](https://gotenberg.dev/docs/modules/libreoffice#route).
138
151
 
139
152
  ```typescript
140
- import { PDFEngine } from "chromiumly";
153
+ import {PDFEngine} from "chromiumly";
141
154
 
142
155
  const buffer = await PDFEngine.convert({
143
- files: ["path/to/file.docx", "path/to/file.png"],
156
+ files: ["path/to/file.docx", "path/to/file.png"],
144
157
  });
145
158
  ```
146
159
 
@@ -152,36 +165,40 @@ Similarly to Chromium's module `convert` method, this method takes the following
152
165
 
153
166
  #### merge
154
167
 
155
- This method interacts with [PDF Engines](https://gotenberg.dev/docs/modules/pdf-engines) module which gathers different engines that can manipulate and merge PDF files such as: [PDFtk](https://gitlab.com/pdftk-java/pdftk), [PDFcpu](https://github.com/pdfcpu/pdfcpu), [QPDF](https://github.com/qpdf/qpdf), and [UNO](https://github.com/unoconv/unoconv).
168
+ This method interacts with [PDF Engines](https://gotenberg.dev/docs/modules/pdf-engines) module which gathers different
169
+ engines that can manipulate and merge PDF files such
170
+ as: [PDFtk](https://gitlab.com/pdftk-java/pdftk), [PDFcpu](https://github.com/pdfcpu/pdfcpu), [QPDF](https://github.com/qpdf/qpdf),
171
+ and [UNO](https://github.com/unoconv/unoconv).
156
172
 
157
173
  ```typescript
158
- import { PDFEngine } from "chromiumly";
174
+ import {PDFEngine} from "chromiumly";
159
175
 
160
176
  const buffer = await PDFEngine.merge({
161
- files: ["path/to/file.docx", "path/to/file.png"],
177
+ files: ["path/to/file.docx", "path/to/file.png"],
162
178
  });
163
179
  ```
164
180
 
165
181
  #### generate
166
182
 
167
- It is just a generic complementary method that takes the `buffer` returned by the `convert` method, and a chosen `filename` to generate the PDF file.
183
+ It is just a generic complementary method that takes the `buffer` returned by the `convert` method, and a
184
+ chosen `filename` to generate the PDF file.
168
185
 
169
- Please note that all the PDF files can be found `__generated__` folder in the root folder of your project.
186
+ Please note that all the PDF files can be found `__generated__` folder in the root folder of your project.
170
187
 
171
188
  ## Snippet
172
189
 
173
190
  The following is a short snippet of how to use the library.
174
191
 
175
192
  ```typescript
176
- import { PDFEngine, UrlConverter } from "chromiumly";
193
+ import {PDFEngine, UrlConverter} from "chromiumly";
177
194
 
178
195
  async function run() {
179
- const urlConverter = new UrlConverter();
180
- const buffer = await urlConverter.convert({
181
- url: "https://gotenberg.dev/",
182
- });
196
+ const urlConverter = new UrlConverter();
197
+ const buffer = await urlConverter.convert({
198
+ url: "https://gotenberg.dev/",
199
+ });
183
200
 
184
- await PDFEngine.generate("gotenberg.pdf", buffer);
201
+ await PDFEngine.generate("gotenberg.pdf", buffer);
185
202
  }
186
203
 
187
204
  run();
@@ -1,5 +1,18 @@
1
1
  import { ChromiumRoute } from "../../main.config";
2
+ /**
3
+ * Abstract class representing a generic converter.
4
+ * Concrete converter classes should extend this class and implement specific conversion logic.
5
+ */
2
6
  export declare abstract class Converter {
7
+ /**
8
+ * The endpoint URL for the converter.
9
+ */
3
10
  readonly endpoint: string;
11
+ /**
12
+ * Creates an instance of the Converter class.
13
+ * Initializes the endpoint URL based on the provided ChromiumRoute.
14
+ *
15
+ * @param {ChromiumRoute} route - The ChromiumRoute enum value representing the conversion route.
16
+ */
4
17
  constructor(route: ChromiumRoute);
5
18
  }
@@ -2,7 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Converter = void 0;
4
4
  const main_config_1 = require("../../main.config");
5
+ /**
6
+ * Abstract class representing a generic converter.
7
+ * Concrete converter classes should extend this class and implement specific conversion logic.
8
+ */
5
9
  class Converter {
10
+ /**
11
+ * Creates an instance of the Converter class.
12
+ * Initializes the endpoint URL based on the provided ChromiumRoute.
13
+ *
14
+ * @param {ChromiumRoute} route - The ChromiumRoute enum value representing the conversion route.
15
+ */
6
16
  constructor(route) {
7
17
  this.endpoint = `${main_config_1.Chromiumly.GOTENBERG_ENDPOINT}/${main_config_1.Chromiumly.CHROMIUM_PATH}/${main_config_1.Chromiumly.CHROMIUM_ROUTES[route]}`;
8
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/converter.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAE9D,MAAsB,SAAS;IAG7B,YAAY,KAAoB;QAC9B,IAAI,CAAC,QAAQ,GAAG,GAAG,wBAAU,CAAC,kBAAkB,IAAI,wBAAU,CAAC,aAAa,IAAI,wBAAU,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IACtH,CAAC;CACF;AAND,8BAMC"}
1
+ {"version":3,"file":"converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/converter.ts"],"names":[],"mappings":";;;AAAA,mDAA4D;AAE5D;;;GAGG;AACH,MAAsB,SAAS;IAM3B;;;;;OAKG;IACH,YAAY,KAAoB;QAC5B,IAAI,CAAC,QAAQ,GAAG,GAAG,wBAAU,CAAC,kBAAkB,IAAI,wBAAU,CAAC,aAAa,IAAI,wBAAU,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IACxH,CAAC;CACJ;AAfD,8BAeC"}
@@ -1,15 +1,41 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { PathLike } from "fs";
4
- import { PdfFormat } from "../../common";
2
+ import { PathLikeOrReadStream, PdfFormat } from "../../common";
5
3
  import { EmulatedMediaType, PageProperties } from "../interfaces/converter.types";
6
4
  import { Converter } from "./converter";
5
+ /**
6
+ * Class representing an HTML converter that extends the base Converter class.
7
+ * This class is used to convert HTML content to PDF using Gotenberg service.
8
+ *
9
+ * @extends Converter
10
+ */
7
11
  export declare class HtmlConverter extends Converter {
12
+ /**
13
+ * Creates an instance of HtmlConverter.
14
+ * Initializes the converter with the HTML conversion route.
15
+ */
8
16
  constructor();
17
+ /**
18
+ * Converts HTML content to PDF.
19
+ *
20
+ * @param {Object} options - Conversion options.
21
+ * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be converted.
22
+ * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
23
+ * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
24
+ * @param {PageProperties} [options.properties] - Page properties for the conversion.
25
+ * @param {PdfFormat} [options.pdfFormat] - PDF format options.
26
+ * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
27
+ * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
28
+ * @param {string} [options.waitDelay] - Delay before the conversion process starts.
29
+ * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
30
+ * @param {string} [options.userAgent] - User agent string to use during the conversion.
31
+ * @param {Record<string, string>} [options.extraHttpHeaders] - Additional HTTP headers for the conversion.
32
+ * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during conversion.
33
+ * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a Buffer.
34
+ */
9
35
  convert({ html, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }: {
10
- html: PathLike;
11
- header?: PathLike;
12
- footer?: PathLike;
36
+ html: PathLikeOrReadStream;
37
+ header?: PathLikeOrReadStream;
38
+ footer?: PathLikeOrReadStream;
13
39
  properties?: PageProperties;
14
40
  pdfFormat?: PdfFormat;
15
41
  pdfUA?: boolean;
@@ -2,27 +2,48 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HtmlConverter = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fs_1 = require("fs");
6
5
  const form_data_1 = tslib_1.__importDefault(require("form-data"));
7
6
  const common_1 = require("../../common");
8
7
  const converter_utils_1 = require("../utils/converter.utils");
9
8
  const converter_1 = require("./converter");
10
9
  const main_config_1 = require("../../main.config");
10
+ /**
11
+ * Class representing an HTML converter that extends the base Converter class.
12
+ * This class is used to convert HTML content to PDF using Gotenberg service.
13
+ *
14
+ * @extends Converter
15
+ */
11
16
  class HtmlConverter extends converter_1.Converter {
17
+ /**
18
+ * Creates an instance of HtmlConverter.
19
+ * Initializes the converter with the HTML conversion route.
20
+ */
12
21
  constructor() {
13
22
  super(main_config_1.ChromiumRoute.HTML);
14
23
  }
24
+ /**
25
+ * Converts HTML content to PDF.
26
+ *
27
+ * @param {Object} options - Conversion options.
28
+ * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be converted.
29
+ * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
30
+ * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
31
+ * @param {PageProperties} [options.properties] - Page properties for the conversion.
32
+ * @param {PdfFormat} [options.pdfFormat] - PDF format options.
33
+ * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
34
+ * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
35
+ * @param {string} [options.waitDelay] - Delay before the conversion process starts.
36
+ * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
37
+ * @param {string} [options.userAgent] - User agent string to use during the conversion.
38
+ * @param {Record<string, string>} [options.extraHttpHeaders] - Additional HTTP headers for the conversion.
39
+ * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during conversion.
40
+ * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a Buffer.
41
+ */
15
42
  convert({ html, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }) {
16
43
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
44
  const data = new form_data_1.default();
18
- if (Buffer.isBuffer(html)) {
19
- data.append("files", html, "index.html");
20
- }
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");
24
- }
25
- converter_utils_1.ConverterUtils.customize(data, {
45
+ yield converter_utils_1.ConverterUtils.addFile(data, html, "index.html");
46
+ yield converter_utils_1.ConverterUtils.customize(data, {
26
47
  header,
27
48
  footer,
28
49
  properties,
@@ -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;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"}
1
+ {"version":3,"file":"html.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/html.converter.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAEjC,yCAA6E;AAK7E,8DAAwD;AACxD,2CAAsC;AACtC,mDAAgD;AAEhD;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,qBAAS;IACxC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO,CAAC,EACI,IAAI,EACJ,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,uBAAuB,GAcxC;;YACG,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,MAAM,gCAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAEvD,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;gBACjC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,KAAK;gBACL,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,SAAS;gBACT,gBAAgB;gBAChB,uBAAuB;aAC1B,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;KAAA;CACJ;AA1ED,sCA0EC"}
@@ -1,16 +1,43 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { PathLike } from "fs";
4
- import { PdfFormat } from "../../common";
2
+ import { PdfFormat, PathLikeOrReadStream } from "../../common";
5
3
  import { EmulatedMediaType, PageProperties } from "../interfaces/converter.types";
6
4
  import { Converter } from "./converter";
5
+ /**
6
+ * Class representing a Markdown converter that extends the base Converter class.
7
+ * This class is used to convert HTML with markdown content to PDF using Gotenberg service.
8
+ *
9
+ * @extends Converter
10
+ */
7
11
  export declare class MarkdownConverter extends Converter {
12
+ /**
13
+ * Creates an instance of MarkdownConverter.
14
+ * Initializes the converter with the Markdown conversion route.
15
+ */
8
16
  constructor();
17
+ /**
18
+ * Converts HTML with markdown content to PDF.
19
+ *
20
+ * @param {Object} options - Conversion options.
21
+ * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be converted.
22
+ * @param {PathLikeOrReadStream} options.markdown - PathLike or ReadStream of the Markdown content to be converted.
23
+ * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
24
+ * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
25
+ * @param {PageProperties} [options.properties] - Page properties for the conversion.
26
+ * @param {PdfFormat} [options.pdfFormat] - PDF format options.
27
+ * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
28
+ * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
29
+ * @param {string} [options.waitDelay] - Delay before the conversion process starts.
30
+ * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
31
+ * @param {string} [options.userAgent] - User agent string to use during the conversion.
32
+ * @param {Record<string, string>} [options.extraHttpHeaders] - Additional HTTP headers for the conversion.
33
+ * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during conversion.
34
+ * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a Buffer.
35
+ */
9
36
  convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }: {
10
- html: PathLike;
11
- markdown: PathLike;
12
- header?: PathLike;
13
- footer?: PathLike;
37
+ html: PathLikeOrReadStream;
38
+ markdown: PathLikeOrReadStream;
39
+ header?: PathLikeOrReadStream;
40
+ footer?: PathLikeOrReadStream;
14
41
  properties?: PageProperties;
15
42
  pdfFormat?: PdfFormat;
16
43
  pdfUA?: boolean;
@@ -2,34 +2,50 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MarkdownConverter = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fs_1 = require("fs");
6
5
  const form_data_1 = tslib_1.__importDefault(require("form-data"));
7
6
  const common_1 = require("../../common");
8
7
  const converter_utils_1 = require("../utils/converter.utils");
9
8
  const converter_1 = require("./converter");
10
9
  const main_config_1 = require("../../main.config");
10
+ /**
11
+ * Class representing a Markdown converter that extends the base Converter class.
12
+ * This class is used to convert HTML with markdown content to PDF using Gotenberg service.
13
+ *
14
+ * @extends Converter
15
+ */
11
16
  class MarkdownConverter extends converter_1.Converter {
17
+ /**
18
+ * Creates an instance of MarkdownConverter.
19
+ * Initializes the converter with the Markdown conversion route.
20
+ */
12
21
  constructor() {
13
22
  super(main_config_1.ChromiumRoute.MARKDOWN);
14
23
  }
24
+ /**
25
+ * Converts HTML with markdown content to PDF.
26
+ *
27
+ * @param {Object} options - Conversion options.
28
+ * @param {PathLikeOrReadStream} options.html - PathLike or ReadStream of the HTML content to be converted.
29
+ * @param {PathLikeOrReadStream} options.markdown - PathLike or ReadStream of the Markdown content to be converted.
30
+ * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
31
+ * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
32
+ * @param {PageProperties} [options.properties] - Page properties for the conversion.
33
+ * @param {PdfFormat} [options.pdfFormat] - PDF format options.
34
+ * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
35
+ * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
36
+ * @param {string} [options.waitDelay] - Delay before the conversion process starts.
37
+ * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
38
+ * @param {string} [options.userAgent] - User agent string to use during the conversion.
39
+ * @param {Record<string, string>} [options.extraHttpHeaders] - Additional HTTP headers for the conversion.
40
+ * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during conversion.
41
+ * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a Buffer.
42
+ */
15
43
  convert({ html, markdown, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }) {
16
44
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
45
  const data = new form_data_1.default();
18
- if (Buffer.isBuffer(html)) {
19
- data.append("files", html, "index.html");
20
- }
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");
24
- }
25
- if (Buffer.isBuffer(markdown)) {
26
- data.append("files", (0, fs_1.createReadStream)(markdown), "file.md");
27
- }
28
- else {
29
- yield fs_1.promises.access(markdown, fs_1.constants.R_OK);
30
- data.append("file.md", (0, fs_1.createReadStream)(markdown));
31
- }
32
- converter_utils_1.ConverterUtils.customize(data, {
46
+ yield converter_utils_1.ConverterUtils.addFile(data, html, "index.html");
47
+ yield converter_utils_1.ConverterUtils.addFile(data, markdown, "file.md");
48
+ yield converter_utils_1.ConverterUtils.customize(data, {
33
49
  header,
34
50
  footer,
35
51
  properties,
@@ -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;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"}
1
+ {"version":3,"file":"markdown.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/markdown.converter.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AAEjC,yCAA6E;AAK7E,8DAAwD;AACxD,2CAAsC;AACtC,mDAAgD;AAEhD;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,qBAAS;IAC5C;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,OAAO,CAAC,EACI,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,GAexC;;YACG,MAAM,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;YAE5B,MAAM,gCAAc,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;YAEvD,MAAM,gCAAc,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;YAExD,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;gBACjC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,KAAK;gBACL,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,SAAS;gBACT,gBAAgB;gBAChB,uBAAuB;aAC1B,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;KAAA;CACJ;AA/ED,8CA+EC"}
@@ -1,15 +1,41 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { PathLike } from "fs";
4
- import { PdfFormat } from "../../common";
2
+ import { PdfFormat, PathLikeOrReadStream } from "../../common";
5
3
  import { EmulatedMediaType, PageProperties } from "../interfaces/converter.types";
6
4
  import { Converter } from "./converter";
5
+ /**
6
+ * Class representing a URL converter that extends the base Converter class.
7
+ * This class is used to convert content from a URL to PDF using Gotenberg service.
8
+ *
9
+ * @extends Converter
10
+ */
7
11
  export declare class UrlConverter extends Converter {
12
+ /**
13
+ * Creates an instance of UrlConverter.
14
+ * Initializes the converter with the URL conversion route.
15
+ */
8
16
  constructor();
17
+ /**
18
+ * Converts content from a URL to PDF.
19
+ *
20
+ * @param {Object} options - Conversion options.
21
+ * @param {string} options.url - The URL of the content to be converted to PDF.
22
+ * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
23
+ * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
24
+ * @param {PageProperties} [options.properties] - Page properties for the conversion.
25
+ * @param {PdfFormat} [options.pdfFormat] - PDF format options.
26
+ * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
27
+ * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
28
+ * @param {string} [options.waitDelay] - Delay before the conversion process starts.
29
+ * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
30
+ * @param {string} [options.userAgent] - User agent string to use during the conversion.
31
+ * @param {Record<string, string>} [options.extraHttpHeaders] - Additional HTTP headers for the conversion.
32
+ * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during conversion.
33
+ * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a Buffer.
34
+ */
9
35
  convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }: {
10
36
  url: string;
11
- header?: PathLike;
12
- footer?: PathLike;
37
+ header?: PathLikeOrReadStream;
38
+ footer?: PathLikeOrReadStream;
13
39
  properties?: PageProperties;
14
40
  pdfFormat?: PdfFormat;
15
41
  pdfUA?: boolean;
@@ -8,16 +8,44 @@ const common_1 = require("../../common");
8
8
  const converter_utils_1 = require("../utils/converter.utils");
9
9
  const converter_1 = require("./converter");
10
10
  const main_config_1 = require("../../main.config");
11
+ /**
12
+ * Class representing a URL converter that extends the base Converter class.
13
+ * This class is used to convert content from a URL to PDF using Gotenberg service.
14
+ *
15
+ * @extends Converter
16
+ */
11
17
  class UrlConverter extends converter_1.Converter {
18
+ /**
19
+ * Creates an instance of UrlConverter.
20
+ * Initializes the converter with the URL conversion route.
21
+ */
12
22
  constructor() {
13
23
  super(main_config_1.ChromiumRoute.URL);
14
24
  }
25
+ /**
26
+ * Converts content from a URL to PDF.
27
+ *
28
+ * @param {Object} options - Conversion options.
29
+ * @param {string} options.url - The URL of the content to be converted to PDF.
30
+ * @param {PathLikeOrReadStream} [options.header] - PathLike or ReadStream of the header HTML content.
31
+ * @param {PathLikeOrReadStream} [options.footer] - PathLike or ReadStream of the footer HTML content.
32
+ * @param {PageProperties} [options.properties] - Page properties for the conversion.
33
+ * @param {PdfFormat} [options.pdfFormat] - PDF format options.
34
+ * @param {boolean} [options.pdfUA] - Indicates whether to generate PDF/UA compliant output.
35
+ * @param {EmulatedMediaType} [options.emulatedMediaType] - Emulated media type for the conversion.
36
+ * @param {string} [options.waitDelay] - Delay before the conversion process starts.
37
+ * @param {string} [options.waitForExpression] - JavaScript expression to wait for before completing the conversion.
38
+ * @param {string} [options.userAgent] - User agent string to use during the conversion.
39
+ * @param {Record<string, string>} [options.extraHttpHeaders] - Additional HTTP headers for the conversion.
40
+ * @param {boolean} [options.failOnConsoleExceptions] - Whether to fail on console exceptions during conversion.
41
+ * @returns {Promise<Buffer>} A Promise resolving to the converted PDF content as a Buffer.
42
+ */
15
43
  convert({ url, header, footer, properties, pdfFormat, pdfUA, emulatedMediaType, waitDelay, waitForExpression, userAgent, extraHttpHeaders, failOnConsoleExceptions, }) {
16
44
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
17
45
  const _url = new url_1.URL(url);
18
46
  const data = new form_data_1.default();
19
47
  data.append("url", _url.href);
20
- converter_utils_1.ConverterUtils.customize(data, {
48
+ yield converter_utils_1.ConverterUtils.customize(data, {
21
49
  header,
22
50
  footer,
23
51
  properties,
@@ -1 +1 @@
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
+ {"version":3,"file":"url.converter.js","sourceRoot":"","sources":["../../../src/chromium/converters/url.converter.ts"],"names":[],"mappings":";;;;AAAA,6BAAwB;AACxB,kEAAiC;AACjC,yCAA6E;AAK7E,8DAAwD;AACxD,2CAAsC;AACtC,mDAAgD;AAEhD;;;;;GAKG;AACH,MAAa,YAAa,SAAQ,qBAAS;IACvC;;;OAGG;IACH;QACI,KAAK,CAAC,2BAAa,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO,CAAC,EACI,GAAG,EACH,MAAM,EACN,MAAM,EACN,UAAU,EACV,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,uBAAuB,GAcxC;;YACG,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,MAAM,gCAAc,CAAC,SAAS,CAAC,IAAI,EAAE;gBACjC,MAAM;gBACN,MAAM;gBACN,UAAU;gBACV,SAAS;gBACT,KAAK;gBACL,iBAAiB;gBACjB,SAAS;gBACT,iBAAiB;gBACjB,SAAS;gBACT,gBAAgB;gBAChB,uBAAuB;aAC1B,CAAC,CAAC;YAEH,OAAO,uBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;KAAA;CACJ;AA3ED,oCA2EC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chromium/index.ts"],"names":[],"mappings":";;;AAAA,8DAA4D;AAAnD,+GAAA,aAAa,OAAA;AACtB,sEAAoE;AAA3D,uHAAA,iBAAiB,OAAA;AAC1B,4DAA0D;AAAjD,6GAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chromium/index.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAAlD,+GAAA,aAAa,OAAA;AACrB,sEAAkE;AAA1D,uHAAA,iBAAiB,OAAA;AACzB,4DAAwD;AAAhD,6GAAA,YAAY,OAAA"}
@@ -1,7 +1,4 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { PathLike } from "fs";
4
- import { PdfFormat } from "../../common";
1
+ import { PathLikeOrReadStream, PdfFormat } from "../../common";
5
2
  type PageSize = {
6
3
  width: number;
7
4
  height: number;
@@ -27,8 +24,8 @@ export type PageProperties = {
27
24
  };
28
25
  export type EmulatedMediaType = "screen" | "print";
29
26
  export type ConversionOptions = {
30
- header?: PathLike | Buffer;
31
- footer?: PathLike | Buffer;
27
+ header?: PathLikeOrReadStream;
28
+ footer?: PathLikeOrReadStream;
32
29
  properties?: PageProperties;
33
30
  pdfFormat?: PdfFormat;
34
31
  pdfUA?: boolean;