node-poppler 6.2.3 → 6.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-poppler",
3
- "version": "6.2.3",
3
+ "version": "6.2.4",
4
4
  "description": "Asynchronous node.js wrapper for the Poppler PDF rendering library",
5
5
  "keywords": [
6
6
  "async",
package/src/index.js CHANGED
@@ -17,7 +17,7 @@ const errorMessages = {
17
17
 
18
18
  /**
19
19
  * @author Frazer Smith
20
- * @description Check each option provided is valid, of the correct type, and can be used by specified
20
+ * @description Checks each option provided is valid, of the correct type, and can be used by specified
21
21
  * version of binary.
22
22
  * @ignore
23
23
  * @param {object} acceptedOptions - Object containing options that a binary accepts.
@@ -104,7 +104,7 @@ class Poppler {
104
104
  * @param {object=} options - Object containing options to pass to binary.
105
105
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
106
106
  * @param {boolean=} options.replace - Replace embedded file with same name (if it exists).
107
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
107
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
108
108
  */
109
109
  async pdfAttach(file, fileToAttach, outputFile, options = {}) {
110
110
  const acceptedOptions = {
@@ -152,7 +152,7 @@ class Poppler {
152
152
  * By default, this uses the file name associated with the embedded file (as printed by
153
153
  * `options.listEmbedded`); the file name can be changed with `options.outputPath`.
154
154
  * @param {string=} options.userPassword - User password (for encrypted files).
155
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
155
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
156
156
  */
157
157
  async pdfDetach(file, options = {}) {
158
158
  const acceptedOptions = {
@@ -197,7 +197,7 @@ class Poppler {
197
197
  * @param {string=} options.ownerPassword - Owner password (for encrypted files).
198
198
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
199
199
  * @param {string=} options.userPassword - User password (for encrypted files). *
200
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
200
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
201
201
  */
202
202
  async pdfFonts(file, options = {}) {
203
203
  const acceptedOptions = {
@@ -282,7 +282,7 @@ class Poppler {
282
282
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
283
283
  * @param {boolean=} options.tiffFile - Change the default output format to TIFF.
284
284
  * @param {string=} options.userPassword - Specify the user password for the PDF file.
285
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
285
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
286
286
  */
287
287
  async pdfImages(file, outputPrefix, options = {}) {
288
288
  const acceptedOptions = {
@@ -393,7 +393,7 @@ class Poppler {
393
393
  * such as Link Annotations are listed, not URL strings in the text content.
394
394
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
395
395
  * @param {string=} options.userPassword - User password (for encrypted files).
396
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
396
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
397
397
  */
398
398
  async pdfInfo(file, options = {}) {
399
399
  const acceptedOptions = {
@@ -498,7 +498,7 @@ class Poppler {
498
498
 
499
499
  /**
500
500
  * @author Frazer Smith
501
- * @description Extract single pages from a PDF file,
501
+ * @description Extracts single pages from a PDF file,
502
502
  * and writes one PDF file for each page to outputPattern.
503
503
  * This will not work if the file is encrypted.
504
504
  * @param {string} file - Filepath of the PDF file to read.
@@ -511,7 +511,7 @@ class Poppler {
511
511
  * @param {number=} options.lastPageToExtract - Specifies the last page to extract.
512
512
  * This defaults to the last page of the PDF file.
513
513
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
514
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
514
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
515
515
  */
516
516
  async pdfSeparate(file, outputPattern, options = {}) {
517
517
  const acceptedOptions = {
@@ -645,7 +645,7 @@ class Poppler {
645
645
  * @param {boolean=} options.transparentPageColor - Use a transparent page color
646
646
  * instead of white (PNG and TIFF only).
647
647
  * @param {string=} options.userPassword - Specify the user password for the PDF file.
648
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
648
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
649
649
  */
650
650
  async pdfToCairo(file, outputFile, options = {}) {
651
651
  const acceptedOptions = {
@@ -804,7 +804,7 @@ class Poppler {
804
804
  * than this percent of character height.
805
805
  * @param {boolean=} options.xmlOutput - Output for XML post-processing.
806
806
  * @param {number=} options.zoom - Zoom the PDF document (default 1.5).
807
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
807
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
808
808
  */
809
809
  async pdfToHtml(file, outputFile, options = {}) {
810
810
  const acceptedOptions = {
@@ -968,7 +968,7 @@ class Poppler {
968
968
  * @param {('none'|'packbits'|'jpeg'|'lzw'|'deflate')=} options.tiffCompression - Set TIFF compression.
969
969
  * @param {boolean=} options.tiffFile - Generate TIFF file instead a PPM file.
970
970
  * @param {string=} options.userPassword - Specify the user password for the PDF file.
971
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
971
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
972
972
  */
973
973
  async pdfToPpm(file, outputPath, options = {}) {
974
974
  const acceptedOptions = {
@@ -1199,7 +1199,7 @@ class Poppler {
1199
1199
  * @param {number=} options.resolutionXYAxis - Specifies the X and Y resolution, in pixels per
1200
1200
  * inch of image files (or rasterized regions in vector output). The default is 300 PPI.
1201
1201
  * @param {string=} options.userPassword - User password (for encrypted files).
1202
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
1202
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
1203
1203
  */
1204
1204
  async pdfToPs(file, outputFile, options = {}) {
1205
1205
  const acceptedOptions = {
@@ -1379,7 +1379,7 @@ class Poppler {
1379
1379
  * @param {boolean=} options.rawLayout - Keep the text in content stream order. This is a
1380
1380
  * hack which often undoes column formatting, etc. Use of raw mode is no longer recommended.
1381
1381
  * @param {string=} options.userPassword - User password (for encrypted files).
1382
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
1382
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
1383
1383
  */
1384
1384
  async pdfToText(file, outputFile, options = {}) {
1385
1385
  const acceptedOptions = {
@@ -1491,7 +1491,7 @@ class Poppler {
1491
1491
  * @param {string} outputFile - Filepath of the file to output the resulting merged PDF to.
1492
1492
  * @param {object=} options - Object containing options to pass to binary.
1493
1493
  * @param {boolean=} options.printVersionInfo - Print copyright and version information.
1494
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
1494
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
1495
1495
  */
1496
1496
  async pdfUnite(files, outputFile, options = {}) {
1497
1497
  const acceptedOptions = {
package/types/index.d.ts CHANGED
@@ -14,14 +14,14 @@ export class Poppler {
14
14
  * @param {object=} options - Object containing options to pass to binary.
15
15
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
16
16
  * @param {boolean=} options.replace - Replace embedded file with same name (if it exists).
17
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
17
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
18
18
  */
19
19
  pdfAttach(
20
20
  file: string,
21
21
  fileToAttach: string,
22
22
  outputFile: string,
23
23
  options?: object | undefined
24
- ): Promise<string | Error>;
24
+ ): Promise<string>;
25
25
  /**
26
26
  * @author Frazer Smith
27
27
  * @description Lists or extracts embedded files (attachments) from a PDF file.
@@ -46,12 +46,9 @@ export class Poppler {
46
46
  * By default, this uses the file name associated with the embedded file (as printed by
47
47
  * `options.listEmbedded`); the file name can be changed with `options.outputPath`.
48
48
  * @param {string=} options.userPassword - User password (for encrypted files).
49
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
49
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
50
50
  */
51
- pdfDetach(
52
- file: string,
53
- options?: object | undefined
54
- ): Promise<string | Error>;
51
+ pdfDetach(file: string, options?: object | undefined): Promise<string>;
55
52
  /**
56
53
  * @author Frazer Smith
57
54
  * @description Lists the fonts used in a PDF file along with various information for each font.
@@ -64,12 +61,12 @@ export class Poppler {
64
61
  * @param {string=} options.ownerPassword - Owner password (for encrypted files).
65
62
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
66
63
  * @param {string=} options.userPassword - User password (for encrypted files). *
67
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
64
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
68
65
  */
69
66
  pdfFonts(
70
67
  file: Buffer | string,
71
68
  options?: object | undefined
72
- ): Promise<string | Error>;
69
+ ): Promise<string>;
73
70
  /**
74
71
  * @author Frazer Smith
75
72
  * @description Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 files.
@@ -92,13 +89,13 @@ export class Poppler {
92
89
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
93
90
  * @param {boolean=} options.tiffFile - Change the default output format to TIFF.
94
91
  * @param {string=} options.userPassword - Specify the user password for the PDF file.
95
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
92
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
96
93
  */
97
94
  pdfImages(
98
95
  file: Buffer | string,
99
96
  outputPrefix?: string | undefined,
100
97
  options?: object | undefined
101
- ): Promise<string | Error>;
98
+ ): Promise<string>;
102
99
  /**
103
100
  * @author Frazer Smith
104
101
  * @description Prints the contents of the `Info` dictionary from a PDF file.
@@ -131,15 +128,15 @@ export class Poppler {
131
128
  * such as Link Annotations are listed, not URL strings in the text content.
132
129
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
133
130
  * @param {string=} options.userPassword - User password (for encrypted files).
134
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
131
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
135
132
  */
136
133
  pdfInfo(
137
134
  file: Buffer | string,
138
135
  options?: object | undefined
139
- ): Promise<string | Error>;
136
+ ): Promise<string>;
140
137
  /**
141
138
  * @author Frazer Smith
142
- * @description Extract single pages from a PDF file,
139
+ * @description Extracts single pages from a PDF file,
143
140
  * and writes one PDF file for each page to outputPattern.
144
141
  * This will not work if the file is encrypted.
145
142
  * @param {string} file - Filepath of the PDF file to read.
@@ -152,13 +149,13 @@ export class Poppler {
152
149
  * @param {number=} options.lastPageToExtract - Specifies the last page to extract.
153
150
  * This defaults to the last page of the PDF file.
154
151
  * @param {boolean=} options.printVersionInfo - Print copyright and version info.
155
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
152
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
156
153
  */
157
154
  pdfSeparate(
158
155
  file: string,
159
156
  outputPattern: string,
160
157
  options?: object | undefined
161
- ): Promise<string | Error>;
158
+ ): Promise<string>;
162
159
  /**
163
160
  * @author Frazer Smith
164
161
  * @description Converts a PDF file to EPS/JPEG/PDF/PNG/PS/SVG/TIFF.
@@ -262,13 +259,13 @@ export class Poppler {
262
259
  * @param {boolean=} options.transparentPageColor - Use a transparent page color
263
260
  * instead of white (PNG and TIFF only).
264
261
  * @param {string=} options.userPassword - Specify the user password for the PDF file.
265
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
262
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
266
263
  */
267
264
  pdfToCairo(
268
265
  file: Buffer | string,
269
266
  outputFile?: string | undefined,
270
267
  options?: object | undefined
271
- ): Promise<string | Error>;
268
+ ): Promise<string>;
272
269
  /**
273
270
  * @author Frazer Smith
274
271
  * @description Converts a PDF file to HTML.
@@ -307,13 +304,13 @@ export class Poppler {
307
304
  * than this percent of character height.
308
305
  * @param {boolean=} options.xmlOutput - Output for XML post-processing.
309
306
  * @param {number=} options.zoom - Zoom the PDF document (default 1.5).
310
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
307
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
311
308
  */
312
309
  pdfToHtml(
313
310
  file: Buffer | string,
314
311
  outputFile?: string | undefined,
315
312
  options?: object | undefined
316
- ): Promise<string | Error>;
313
+ ): Promise<string>;
317
314
  /**
318
315
  * @author Frazer Smith
319
316
  * @description Converts a PDF file to colour image files in Portable Pixmap (PPM) format,
@@ -386,13 +383,13 @@ export class Poppler {
386
383
  * @param {('none'|'packbits'|'jpeg'|'lzw'|'deflate')=} options.tiffCompression - Set TIFF compression.
387
384
  * @param {boolean=} options.tiffFile - Generate TIFF file instead a PPM file.
388
385
  * @param {string=} options.userPassword - Specify the user password for the PDF file.
389
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
386
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
390
387
  */
391
388
  pdfToPpm(
392
389
  file: Buffer | string,
393
390
  outputPath: string,
394
391
  options?: object | undefined
395
- ): Promise<string | Error>;
392
+ ): Promise<string>;
396
393
  /**
397
394
  * @author Frazer Smith
398
395
  * @description Converts a PDF file to PostScript (PS).
@@ -500,13 +497,13 @@ export class Poppler {
500
497
  * @param {number=} options.resolutionXYAxis - Specifies the X and Y resolution, in pixels per
501
498
  * inch of image files (or rasterized regions in vector output). The default is 300 PPI.
502
499
  * @param {string=} options.userPassword - User password (for encrypted files).
503
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
500
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
504
501
  */
505
502
  pdfToPs(
506
503
  file: Buffer | string,
507
504
  outputFile?: string | undefined,
508
505
  options?: object | undefined
509
- ): Promise<string | Error>;
506
+ ): Promise<string>;
510
507
  /**
511
508
  * @author Frazer Smith
512
509
  * @description Converts a PDF file to TXT.
@@ -553,13 +550,13 @@ export class Poppler {
553
550
  * @param {boolean=} options.rawLayout - Keep the text in content stream order. This is a
554
551
  * hack which often undoes column formatting, etc. Use of raw mode is no longer recommended.
555
552
  * @param {string=} options.userPassword - User password (for encrypted files).
556
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
553
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
557
554
  */
558
555
  pdfToText(
559
556
  file: Buffer | string,
560
557
  outputFile?: string | undefined,
561
558
  options?: object | undefined
562
- ): Promise<string | Error>;
559
+ ): Promise<string>;
563
560
  /**
564
561
  * @author Frazer Smith
565
562
  * @description Merges several PDF files in order of their occurrence in the files array to
@@ -569,11 +566,11 @@ export class Poppler {
569
566
  * @param {string} outputFile - Filepath of the file to output the resulting merged PDF to.
570
567
  * @param {object=} options - Object containing options to pass to binary.
571
568
  * @param {boolean=} options.printVersionInfo - Print copyright and version information.
572
- * @returns {Promise<string|Error>} Promise of stdout string on resolve, or Error object on rejection.
569
+ * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
573
570
  */
574
571
  pdfUnite(
575
572
  files: any[],
576
573
  outputFile: string,
577
574
  options?: object | undefined
578
- ): Promise<string | Error>;
575
+ ): Promise<string>;
579
576
  }