node-poppler 6.2.7 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -81,7 +81,7 @@ Example of an `async` `await` call to `poppler.pdfToCairo()`, to convert only th
81
81
  PDF file using stdout:
82
82
 
83
83
  ```js
84
- const fs = require("fs");
84
+ const { writeFile } = require("node:fs/promises");
85
85
  const { Poppler } = require("node-poppler");
86
86
 
87
87
  const file = "test_document.pdf";
@@ -93,7 +93,7 @@ const options = {
93
93
 
94
94
  const res = await poppler.pdfToCairo(file, undefined, options);
95
95
  // pdfToCairo writes to stdout using binary encoding if pdfFile or singleFile options are used
96
- await fs.writeFile("new_file.pdf", res, { encoding: "binary" });
96
+ await writeFile("new_file.pdf", res, { encoding: "binary" });
97
97
  ```
98
98
 
99
99
  ### poppler.pdfToHtml
@@ -110,27 +110,39 @@ const options = {
110
110
  lastPageToConvert: 2,
111
111
  };
112
112
 
113
- poppler.pdfToHtml(file, undefined, options).then((res) => {
114
- console.log(res);
115
- });
113
+ poppler
114
+ .pdfToHtml(file, undefined, options)
115
+ .then((res) => {
116
+ console.log(res);
117
+ })
118
+ .catch((err) => {
119
+ console.error(err);
120
+ throw err;
121
+ });
116
122
  ```
117
123
 
118
124
  Example of calling `poppler.pdfToHtml()` with a promise chain, providing a Buffer as an input:
119
125
 
120
126
  ```js
121
- const fs = require("fs");
127
+ const { readFileSync } = require("node:fs");
122
128
  const { Poppler } = require("node-poppler");
123
129
 
124
- const file = fs.readFileSync("test_document.pdf");
130
+ const file = readFileSync("test_document.pdf");
125
131
  const poppler = new Poppler();
126
132
  const options = {
127
133
  firstPageToConvert: 1,
128
134
  lastPageToConvert: 2,
129
135
  };
130
136
 
131
- poppler.pdfToHtml(file, "tester.html", options).then((res) => {
132
- console.log(res);
133
- });
137
+ poppler
138
+ .pdfToHtml(file, "tester.html", options)
139
+ .then((res) => {
140
+ console.log(res);
141
+ })
142
+ .catch((err) => {
143
+ console.error(err);
144
+ throw err;
145
+ });
134
146
  ```
135
147
 
136
148
  ### poppler.pdfToText
@@ -147,9 +159,15 @@ const options = {
147
159
  lastPageToConvert: 2,
148
160
  };
149
161
 
150
- poppler.pdfToText(file, options).then((res) => {
151
- console.log(res);
152
- });
162
+ poppler
163
+ .pdfToText(file, options)
164
+ .then((res) => {
165
+ console.log(res);
166
+ })
167
+ .catch((err) => {
168
+ console.error(err);
169
+ throw err;
170
+ });
153
171
  ```
154
172
 
155
173
  ## Contributing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-poppler",
3
- "version": "6.2.7",
3
+ "version": "7.0.0",
4
4
  "description": "Asynchronous node.js wrapper for the Poppler PDF rendering library",
5
5
  "keywords": [
6
6
  "async",
@@ -33,6 +33,7 @@
33
33
  "unite"
34
34
  ],
35
35
  "main": "src/index.js",
36
+ "type": "commonjs",
36
37
  "types": "types/index.d.ts",
37
38
  "repository": "git+https://github.com/Fdawgs/node-poppler.git",
38
39
  "homepage": "https://github.com/Fdawgs/node-poppler",
@@ -43,7 +44,7 @@
43
44
  "author": "Frazer Smith <frazer.dev@outlook.com>",
44
45
  "funding": "https://github.com/sponsors/Fdawgs",
45
46
  "engines": {
46
- "node": ">=14.0.0"
47
+ "node": ">=18.0.0"
47
48
  },
48
49
  "dependencies": {
49
50
  "camelcase": "^6.3.0",
package/src/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- const { execFile, spawn } = require("child_process");
4
- const { promisify } = require("util");
3
+ const { execFile, spawn } = require("node:child_process");
4
+ const { promisify } = require("node:util");
5
5
  const camelCase = require("camelcase");
6
6
  const { lt } = require("semver");
7
- const path = require("upath");
7
+ const { joinSafe, normalizeTrim } = require("upath");
8
8
 
9
9
  const execFileAsync = promisify(execFile);
10
10
 
@@ -16,6 +16,7 @@ const errorMessages = {
16
16
  4: "Error related to ICC profile",
17
17
  99: "Other error",
18
18
  3221226505: "Internal process error",
19
+ unk: "Unknown error",
19
20
  };
20
21
 
21
22
  /**
@@ -23,24 +24,28 @@ const errorMessages = {
23
24
  * @description Checks each option provided is valid, of the correct type, and can be used by specified
24
25
  * version of binary.
25
26
  * @ignore
26
- * @param {object} acceptedOptions - Object containing options that a binary accepts.
27
+ * @param {object} acceptedOptions - Object containing accepted options.
27
28
  * @param {object} options - Object containing options to pass to binary.
28
29
  * @param {string} [version] - Version of binary.
29
30
  * @returns {string[]} Array of CLI arguments.
30
31
  * @throws If invalid arguments provided.
31
32
  */
32
33
  function parseOptions(acceptedOptions, options, version) {
34
+ /** @type {string[]} */
33
35
  const args = [];
36
+ /** @type {string[]} */
34
37
  const invalidArgs = [];
35
38
  Object.keys(options).forEach((key) => {
36
- if (Object.prototype.hasOwnProperty.call(acceptedOptions, key)) {
39
+ if (Object.hasOwn(acceptedOptions, key)) {
37
40
  // eslint-disable-next-line valid-typeof
38
41
  if (typeof options[key] === acceptedOptions[key].type) {
39
42
  // Skip boolean options if false
43
+
40
44
  if (acceptedOptions[key].type === "boolean" && !options[key]) {
41
45
  return;
42
46
  }
43
47
  // Arg will be empty for some non-standard options
48
+
44
49
  if (acceptedOptions[key].arg !== "") {
45
50
  args.push(acceptedOptions[key].arg);
46
51
  }
@@ -59,6 +64,7 @@ function parseOptions(acceptedOptions, options, version) {
59
64
  if (
60
65
  acceptedOptions[key].minVersion &&
61
66
  version &&
67
+ // @ts-ignore: type checking is done above
62
68
  lt(version, acceptedOptions[key].minVersion, { loose: true })
63
69
  ) {
64
70
  invalidArgs.push(
@@ -76,14 +82,12 @@ function parseOptions(acceptedOptions, options, version) {
76
82
  }
77
83
 
78
84
  class Poppler {
79
- /**
80
- * @param {string} [binPath] - Path of poppler-utils binaries.
81
- */
85
+ /** @param {string} [binPath] - Path of poppler-utils binaries. */
82
86
  constructor(binPath) {
83
87
  if (binPath) {
84
- this.popplerPath = path.normalizeTrim(binPath);
88
+ this.popplerPath = normalizeTrim(binPath);
85
89
  } else if (process.platform === "win32") {
86
- this.popplerPath = path.joinSafe(
90
+ this.popplerPath = joinSafe(
87
91
  __dirname,
88
92
  "lib",
89
93
  "win32",
@@ -122,7 +126,7 @@ class Poppler {
122
126
  args.push(outputFile);
123
127
 
124
128
  const { stdout } = await execFileAsync(
125
- path.joinSafe(this.popplerPath, "pdfattach"),
129
+ joinSafe(this.popplerPath, "pdfattach"),
126
130
  args
127
131
  );
128
132
  return Promise.resolve(stdout);
@@ -179,7 +183,7 @@ class Poppler {
179
183
  args.push(file);
180
184
 
181
185
  const { stdout } = await execFileAsync(
182
- path.joinSafe(this.popplerPath, "pdfdetach"),
186
+ joinSafe(this.popplerPath, "pdfdetach"),
183
187
  args
184
188
  );
185
189
  return Promise.resolve(stdout);
@@ -214,10 +218,11 @@ class Poppler {
214
218
 
215
219
  try {
216
220
  const { stderr } = await execFileAsync(
217
- path.joinSafe(this.popplerPath, "pdffonts"),
221
+ joinSafe(this.popplerPath, "pdffonts"),
218
222
  ["-v"]
219
223
  );
220
224
 
225
+ // @ts-ignore: parseOptions checks if falsy
221
226
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
222
227
 
223
228
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -230,7 +235,7 @@ class Poppler {
230
235
  }
231
236
 
232
237
  const child = spawn(
233
- path.joinSafe(this.popplerPath, "pdffonts"),
238
+ joinSafe(this.popplerPath, "pdffonts"),
234
239
  args
235
240
  );
236
241
 
@@ -306,10 +311,11 @@ class Poppler {
306
311
 
307
312
  try {
308
313
  const { stderr } = await execFileAsync(
309
- path.joinSafe(this.popplerPath, "pdfimages"),
314
+ joinSafe(this.popplerPath, "pdfimages"),
310
315
  ["-v"]
311
316
  );
312
317
 
318
+ // @ts-ignore: parseOptions checks if falsy
313
319
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
314
320
 
315
321
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -326,7 +332,7 @@ class Poppler {
326
332
  }
327
333
 
328
334
  const child = spawn(
329
- path.joinSafe(this.popplerPath, "pdfimages"),
335
+ joinSafe(this.popplerPath, "pdfimages"),
330
336
  args
331
337
  );
332
338
 
@@ -347,6 +353,7 @@ class Poppler {
347
353
  });
348
354
 
349
355
  child.on("close", (code) => {
356
+ /* istanbul ignore else */
350
357
  if (stdOut !== "") {
351
358
  resolve(stdOut.trim());
352
359
  } else if (code === 0) {
@@ -354,8 +361,11 @@ class Poppler {
354
361
  } else if (stdErr !== "") {
355
362
  reject(new Error(stdErr.trim()));
356
363
  } else {
357
- /* istanbul ignore next */
358
- reject(new Error(errorMessages[code]));
364
+ reject(
365
+ new Error(
366
+ code ? errorMessages[code] : errorMessages.unk
367
+ )
368
+ );
359
369
  }
360
370
  });
361
371
  });
@@ -396,7 +406,8 @@ class Poppler {
396
406
  * such as Link Annotations are listed, not URL strings in the text content.
397
407
  * @param {boolean} [options.printVersionInfo] - Print copyright and version info.
398
408
  * @param {string} [options.userPassword] - User password (for encrypted files).
399
- * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
409
+ * @returns {Promise<object|string>} A promise that resolves with a stdout string or JSON object if
410
+ * `options.printAsJson` is `true`, or rejects with an `Error` object.
400
411
  */
401
412
  async pdfInfo(file, options = {}) {
402
413
  const acceptedOptions = {
@@ -421,10 +432,11 @@ class Poppler {
421
432
 
422
433
  try {
423
434
  const { stderr } = await execFileAsync(
424
- path.joinSafe(this.popplerPath, "pdfinfo"),
435
+ joinSafe(this.popplerPath, "pdfinfo"),
425
436
  ["-v"]
426
437
  );
427
438
 
439
+ // @ts-ignore: parseOptions checks if falsy
428
440
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
429
441
 
430
442
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -433,6 +445,7 @@ class Poppler {
433
445
  * Poppler does not set the "File size" metadata value if passed
434
446
  * a Buffer via stdin, so need to retrieve it from the Buffer
435
447
  */
448
+ /** @type {number} */
436
449
  let fileSize;
437
450
 
438
451
  return new Promise((resolve, reject) => {
@@ -443,8 +456,8 @@ class Poppler {
443
456
  args.push(file);
444
457
  }
445
458
 
446
- const child = execFile(
447
- path.joinSafe(this.popplerPath, "pdfinfo"),
459
+ const child = spawn(
460
+ joinSafe(this.popplerPath, "pdfinfo"),
448
461
  args
449
462
  );
450
463
 
@@ -473,15 +486,16 @@ class Poppler {
473
486
  );
474
487
  }
475
488
 
489
+ /**
490
+ * Convert output to JSON.
491
+ * @see {@link https://github.com/Fdawgs/node-poppler/issues/248#issuecomment-845948080 | Node-Poppler Issue #248}
492
+ */
476
493
  if (options.printAsJson === true) {
477
- /**
478
- * Thanks to @sainf for this solution
479
- * https://github.com/Fdawgs/node-poppler/issues/248#issuecomment-845948080
480
- */
481
494
  const info = {};
482
495
  stdOut.split("\n").forEach((line) => {
483
496
  const lines = line.split(": ");
484
497
  if (lines.length > 1) {
498
+ // @ts-ignore: creating dynamic object keys
485
499
  info[camelCase(lines[0])] = lines[1].trim();
486
500
  }
487
501
  });
@@ -525,10 +539,11 @@ class Poppler {
525
539
 
526
540
  try {
527
541
  const { stderr } = await execFileAsync(
528
- path.joinSafe(this.popplerPath, "pdfseparate"),
542
+ joinSafe(this.popplerPath, "pdfseparate"),
529
543
  ["-v"]
530
544
  );
531
545
 
546
+ // @ts-ignore: parseOptions checks if falsy
532
547
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
533
548
 
534
549
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -536,7 +551,7 @@ class Poppler {
536
551
  args.push(outputPattern);
537
552
 
538
553
  const { stdout } = await execFileAsync(
539
- path.joinSafe(this.popplerPath, "pdfseparate"),
554
+ joinSafe(this.popplerPath, "pdfseparate"),
540
555
  args
541
556
  );
542
557
  return Promise.resolve(stdout);
@@ -702,10 +717,11 @@ class Poppler {
702
717
 
703
718
  try {
704
719
  const { stderr } = await execFileAsync(
705
- path.joinSafe(this.popplerPath, "pdftocairo"),
720
+ joinSafe(this.popplerPath, "pdftocairo"),
706
721
  ["-v"]
707
722
  );
708
723
 
724
+ // @ts-ignore: parseOptions checks if falsy
709
725
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
710
726
 
711
727
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -724,7 +740,7 @@ class Poppler {
724
740
  }
725
741
 
726
742
  const child = spawn(
727
- path.joinSafe(this.popplerPath, "pdftocairo"),
743
+ joinSafe(this.popplerPath, "pdftocairo"),
728
744
  args
729
745
  );
730
746
 
@@ -752,6 +768,7 @@ class Poppler {
752
768
  });
753
769
 
754
770
  child.on("close", (code) => {
771
+ /* istanbul ignore else */
755
772
  if (stdOut !== "") {
756
773
  resolve(stdOut.trim());
757
774
  } else if (code === 0) {
@@ -759,8 +776,11 @@ class Poppler {
759
776
  } else if (stdErr !== "") {
760
777
  reject(new Error(stdErr.trim()));
761
778
  } else {
762
- /* istanbul ignore next */
763
- reject(new Error(errorMessages[code]));
779
+ reject(
780
+ new Error(
781
+ code ? errorMessages[code] : errorMessages.unk
782
+ )
783
+ );
764
784
  }
765
785
  });
766
786
  });
@@ -842,10 +862,11 @@ class Poppler {
842
862
 
843
863
  try {
844
864
  const { stderr } = await execFileAsync(
845
- path.joinSafe(this.popplerPath, "pdftohtml"),
865
+ joinSafe(this.popplerPath, "pdftohtml"),
846
866
  ["-v"]
847
867
  );
848
868
 
869
+ // @ts-ignore: parseOptions checks if falsy
849
870
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
850
871
 
851
872
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -862,7 +883,7 @@ class Poppler {
862
883
  }
863
884
 
864
885
  const child = spawn(
865
- path.joinSafe(this.popplerPath, "pdftohtml"),
886
+ joinSafe(this.popplerPath, "pdftohtml"),
866
887
  args
867
888
  );
868
889
 
@@ -884,7 +905,7 @@ class Poppler {
884
905
 
885
906
  /**
886
907
  * pdfToHtml does not return an exit code so check output to see if it was successful.
887
- * See https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/utils/pdftohtml.1
908
+ * @see {@link https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/utils/pdftohtml.1 | Poppler pdftohtml man}
888
909
  */
889
910
  child.on("close", () => {
890
911
  if (stdOut !== "") {
@@ -1046,10 +1067,11 @@ class Poppler {
1046
1067
 
1047
1068
  try {
1048
1069
  const { stderr } = await execFileAsync(
1049
- path.joinSafe(this.popplerPath, "pdftoppm"),
1070
+ joinSafe(this.popplerPath, "pdftoppm"),
1050
1071
  ["-v"]
1051
1072
  );
1052
1073
 
1074
+ // @ts-ignore: parseOptions checks if falsy
1053
1075
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
1054
1076
 
1055
1077
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -1064,7 +1086,7 @@ class Poppler {
1064
1086
  args.push(outputPath);
1065
1087
 
1066
1088
  const child = spawn(
1067
- path.joinSafe(this.popplerPath, "pdftoppm"),
1089
+ joinSafe(this.popplerPath, "pdftoppm"),
1068
1090
  args
1069
1091
  );
1070
1092
 
@@ -1080,13 +1102,17 @@ class Poppler {
1080
1102
  });
1081
1103
 
1082
1104
  child.on("close", (code) => {
1105
+ /* istanbul ignore else */
1083
1106
  if (stdErr !== "") {
1084
1107
  reject(new Error(stdErr.trim()));
1085
1108
  } else if (code === 0) {
1086
1109
  resolve(errorMessages[code]);
1087
1110
  } else {
1088
- /* istanbul ignore next */
1089
- reject(new Error(errorMessages[code]));
1111
+ reject(
1112
+ new Error(
1113
+ code ? errorMessages[code] : errorMessages.unk
1114
+ )
1115
+ );
1090
1116
  }
1091
1117
  });
1092
1118
  });
@@ -1266,7 +1292,7 @@ class Poppler {
1266
1292
  processColorFormat: { arg: "-processcolorformat", type: "string" },
1267
1293
  quiet: { arg: "-q", type: "boolean" },
1268
1294
  rasterize: {
1269
- args: "-rasterize",
1295
+ arg: "-rasterize",
1270
1296
  type: "string",
1271
1297
  minVersion: "0.90.0",
1272
1298
  },
@@ -1276,10 +1302,11 @@ class Poppler {
1276
1302
 
1277
1303
  try {
1278
1304
  const { stderr } = await execFileAsync(
1279
- path.joinSafe(this.popplerPath, "pdftops"),
1305
+ joinSafe(this.popplerPath, "pdftops"),
1280
1306
  ["-v"]
1281
1307
  );
1282
1308
 
1309
+ // @ts-ignore: parseOptions checks if falsy
1283
1310
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
1284
1311
 
1285
1312
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -1298,7 +1325,7 @@ class Poppler {
1298
1325
  }
1299
1326
 
1300
1327
  const child = spawn(
1301
- path.joinSafe(this.popplerPath, "pdftops"),
1328
+ joinSafe(this.popplerPath, "pdftops"),
1302
1329
  args
1303
1330
  );
1304
1331
 
@@ -1319,6 +1346,7 @@ class Poppler {
1319
1346
  });
1320
1347
 
1321
1348
  child.on("close", (code) => {
1349
+ /* istanbul ignore else */
1322
1350
  if (stdOut !== "") {
1323
1351
  resolve(stdOut.trim());
1324
1352
  } else if (code === 0) {
@@ -1326,8 +1354,11 @@ class Poppler {
1326
1354
  } else if (stdErr !== "") {
1327
1355
  reject(new Error(stdErr.trim()));
1328
1356
  } else {
1329
- /* istanbul ignore next */
1330
- reject(new Error(errorMessages[code]));
1357
+ reject(
1358
+ new Error(
1359
+ code ? errorMessages[code] : errorMessages.unk
1360
+ )
1361
+ );
1331
1362
  }
1332
1363
  });
1333
1364
  });
@@ -1425,10 +1456,11 @@ class Poppler {
1425
1456
 
1426
1457
  try {
1427
1458
  const { stderr } = await execFileAsync(
1428
- path.joinSafe(this.popplerPath, "pdftotext"),
1459
+ joinSafe(this.popplerPath, "pdftotext"),
1429
1460
  ["-v"]
1430
1461
  );
1431
1462
 
1463
+ // @ts-ignore: parseOptions checks if falsy
1432
1464
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
1433
1465
 
1434
1466
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -1447,7 +1479,7 @@ class Poppler {
1447
1479
  }
1448
1480
 
1449
1481
  const child = spawn(
1450
- path.joinSafe(this.popplerPath, "pdftotext"),
1482
+ joinSafe(this.popplerPath, "pdftotext"),
1451
1483
  args
1452
1484
  );
1453
1485
 
@@ -1468,6 +1500,7 @@ class Poppler {
1468
1500
  });
1469
1501
 
1470
1502
  child.on("close", (code) => {
1503
+ /* istanbul ignore else */
1471
1504
  if (stdOut !== "") {
1472
1505
  resolve(stdOut.trim());
1473
1506
  } else if (code === 0) {
@@ -1475,8 +1508,11 @@ class Poppler {
1475
1508
  } else if (stdErr !== "") {
1476
1509
  reject(new Error(stdErr.trim()));
1477
1510
  } else {
1478
- /* istanbul ignore next */
1479
- reject(new Error(errorMessages[code]));
1511
+ reject(
1512
+ new Error(
1513
+ code ? errorMessages[code] : errorMessages.unk
1514
+ )
1515
+ );
1480
1516
  }
1481
1517
  });
1482
1518
  });
@@ -1503,10 +1539,11 @@ class Poppler {
1503
1539
 
1504
1540
  try {
1505
1541
  const { stderr } = await execFileAsync(
1506
- path.joinSafe(this.popplerPath, "pdfunite"),
1542
+ joinSafe(this.popplerPath, "pdfunite"),
1507
1543
  ["-v"]
1508
1544
  );
1509
1545
 
1546
+ // @ts-ignore: parseOptions checks if falsy
1510
1547
  const versionInfo = /(\d{1,2}\.\d{1,2}\.\d{1,2})/u.exec(stderr)[1];
1511
1548
 
1512
1549
  const args = parseOptions(acceptedOptions, options, versionInfo);
@@ -1516,7 +1553,7 @@ class Poppler {
1516
1553
  args.push(outputFile);
1517
1554
 
1518
1555
  const { stdout } = await execFileAsync(
1519
- path.joinSafe(this.popplerPath, "pdfunite"),
1556
+ joinSafe(this.popplerPath, "pdfunite"),
1520
1557
  args
1521
1558
  );
1522
1559
  return Promise.resolve(stdout);
package/types/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  export default Poppler;
2
2
  export class Poppler {
3
- /**
4
- * @param {string} [binPath] - Path of poppler-utils binaries.
5
- */
6
- constructor(binPath?: string | undefined);
3
+ /** @param {string} [binPath] - Path of poppler-utils binaries. */
4
+ constructor(binPath?: string);
7
5
  popplerPath: string;
8
6
  /**
9
7
  * @author Frazer Smith
@@ -20,12 +18,10 @@ export class Poppler {
20
18
  file: string,
21
19
  fileToAttach: string,
22
20
  outputFile: string,
23
- options?:
24
- | {
25
- printVersionInfo?: boolean | undefined;
26
- replace?: boolean | undefined;
27
- }
28
- | undefined
21
+ options?: {
22
+ printVersionInfo?: boolean;
23
+ replace?: boolean;
24
+ }
29
25
  ): Promise<string>;
30
26
  /**
31
27
  * @author Frazer Smith
@@ -55,19 +51,17 @@ export class Poppler {
55
51
  */
56
52
  pdfDetach(
57
53
  file: string,
58
- options?:
59
- | {
60
- listEmbedded?: boolean | undefined;
61
- ownerPassword?: string | undefined;
62
- outputEncoding?: string | undefined;
63
- outputPath?: string | undefined;
64
- printVersionInfo?: boolean | undefined;
65
- saveAllFiles?: boolean | undefined;
66
- saveFile?: string | undefined;
67
- saveSpecificFile?: number | undefined;
68
- userPassword?: string | undefined;
69
- }
70
- | undefined
54
+ options?: {
55
+ listEmbedded?: boolean;
56
+ ownerPassword?: string;
57
+ outputEncoding?: string;
58
+ outputPath?: string;
59
+ printVersionInfo?: boolean;
60
+ saveAllFiles?: boolean;
61
+ saveFile?: string;
62
+ saveSpecificFile?: number;
63
+ userPassword?: string;
64
+ }
71
65
  ): Promise<string>;
72
66
  /**
73
67
  * @author Frazer Smith
@@ -85,16 +79,14 @@ export class Poppler {
85
79
  */
86
80
  pdfFonts(
87
81
  file: Buffer | string,
88
- options?:
89
- | {
90
- firstPageToExamine?: number | undefined;
91
- lastPageToExamine?: number | undefined;
92
- listSubstitutes?: boolean | undefined;
93
- ownerPassword?: string | undefined;
94
- printVersionInfo?: boolean | undefined;
95
- userPassword?: string | undefined;
96
- }
97
- | undefined
82
+ options?: {
83
+ firstPageToExamine?: number;
84
+ lastPageToExamine?: number;
85
+ listSubstitutes?: boolean;
86
+ ownerPassword?: string;
87
+ printVersionInfo?: boolean;
88
+ userPassword?: string;
89
+ }
98
90
  ): Promise<string>;
99
91
  /**
100
92
  * @author Frazer Smith
@@ -122,24 +114,22 @@ export class Poppler {
122
114
  */
123
115
  pdfImages(
124
116
  file: Buffer | string,
125
- outputPrefix?: string | undefined,
126
- options?:
127
- | {
128
- allFiles?: boolean | undefined;
129
- ccittFile?: boolean | undefined;
130
- firstPageToConvert?: number | undefined;
131
- lastPageToConvert?: number | undefined;
132
- list?: boolean | undefined;
133
- jbig2File?: boolean | undefined;
134
- jpeg2000File?: boolean | undefined;
135
- jpegFile?: boolean | undefined;
136
- ownerPassword?: string | undefined;
137
- pngFile?: boolean | undefined;
138
- printVersionInfo?: boolean | undefined;
139
- tiffFile?: boolean | undefined;
140
- userPassword?: string | undefined;
141
- }
142
- | undefined
117
+ outputPrefix?: string,
118
+ options?: {
119
+ allFiles?: boolean;
120
+ ccittFile?: boolean;
121
+ firstPageToConvert?: number;
122
+ lastPageToConvert?: number;
123
+ list?: boolean;
124
+ jbig2File?: boolean;
125
+ jpeg2000File?: boolean;
126
+ jpegFile?: boolean;
127
+ ownerPassword?: string;
128
+ pngFile?: boolean;
129
+ printVersionInfo?: boolean;
130
+ tiffFile?: boolean;
131
+ userPassword?: string;
132
+ }
143
133
  ): Promise<string>;
144
134
  /**
145
135
  * @author Frazer Smith
@@ -173,32 +163,31 @@ export class Poppler {
173
163
  * such as Link Annotations are listed, not URL strings in the text content.
174
164
  * @param {boolean} [options.printVersionInfo] - Print copyright and version info.
175
165
  * @param {string} [options.userPassword] - User password (for encrypted files).
176
- * @returns {Promise<string>} A promise that resolves with a stdout string, or rejects with an `Error` object.
166
+ * @returns {Promise<object|string>} A promise that resolves with a stdout string or JSON object if
167
+ * `options.printAsJson` is `true`, or rejects with an `Error` object.
177
168
  */
178
169
  pdfInfo(
179
170
  file: Buffer | string,
180
- options?:
181
- | {
182
- firstPageToConvert?: number | undefined;
183
- lastPageToConvert?: number | undefined;
184
- listEncodingOptions?: boolean | undefined;
185
- outputEncoding?: string | undefined;
186
- ownerPassword?: string | undefined;
187
- printAsJson?: boolean | undefined;
188
- printBoundingBoxes?: boolean | undefined;
189
- printDocStruct?: boolean | undefined;
190
- printDocStructText?: boolean | undefined;
191
- printIsoDates?: boolean | undefined;
192
- printJS?: boolean | undefined;
193
- printMetadata?: boolean | undefined;
194
- printNamedDests?: boolean | undefined;
195
- printRawDates?: boolean | undefined;
196
- printUrls?: boolean | undefined;
197
- printVersionInfo?: boolean | undefined;
198
- userPassword?: string | undefined;
199
- }
200
- | undefined
201
- ): Promise<string>;
171
+ options?: {
172
+ firstPageToConvert?: number;
173
+ lastPageToConvert?: number;
174
+ listEncodingOptions?: boolean;
175
+ outputEncoding?: string;
176
+ ownerPassword?: string;
177
+ printAsJson?: boolean;
178
+ printBoundingBoxes?: boolean;
179
+ printDocStruct?: boolean;
180
+ printDocStructText?: boolean;
181
+ printIsoDates?: boolean;
182
+ printJS?: boolean;
183
+ printMetadata?: boolean;
184
+ printNamedDests?: boolean;
185
+ printRawDates?: boolean;
186
+ printUrls?: boolean;
187
+ printVersionInfo?: boolean;
188
+ userPassword?: string;
189
+ }
190
+ ): Promise<object | string>;
202
191
  /**
203
192
  * @author Frazer Smith
204
193
  * @description Extracts single pages from a PDF file,
@@ -219,13 +208,11 @@ export class Poppler {
219
208
  pdfSeparate(
220
209
  file: string,
221
210
  outputPattern: string,
222
- options?:
223
- | {
224
- firstPageToExtract?: number | undefined;
225
- lastPageToExtract?: number | undefined;
226
- printVersionInfo?: boolean | undefined;
227
- }
228
- | undefined
211
+ options?: {
212
+ firstPageToExtract?: number;
213
+ lastPageToExtract?: number;
214
+ printVersionInfo?: boolean;
215
+ }
229
216
  ): Promise<string>;
230
217
  /**
231
218
  * @author Frazer Smith
@@ -334,77 +321,62 @@ export class Poppler {
334
321
  */
335
322
  pdfToCairo(
336
323
  file: Buffer | string,
337
- outputFile?: string | undefined,
338
- options?:
339
- | {
340
- antialias?:
341
- | "default"
342
- | "none"
343
- | "best"
344
- | "fast"
345
- | "good"
346
- | "gray"
347
- | "subpixel"
348
- | undefined;
349
- cropBox?: boolean | undefined;
350
- cropHeight?: number | undefined;
351
- cropSize?: number | undefined;
352
- cropWidth?: number | undefined;
353
- cropXAxis?: number | undefined;
354
- cropYAxis?: number | undefined;
355
- duplex?: boolean | undefined;
356
- epsFile?: boolean | undefined;
357
- evenPagesOnly?: boolean | undefined;
358
- fillPage?: boolean | undefined;
359
- firstPageToConvert?: number | undefined;
360
- grayscaleFile?: boolean | undefined;
361
- iccFile?: string | undefined;
362
- jpegFile?: boolean | undefined;
363
- jpegOptions?: string | undefined;
364
- lastPageToConvert?: number | undefined;
365
- monochromeFile?: boolean | undefined;
366
- noCenter?: boolean | undefined;
367
- noCrop?: boolean | undefined;
368
- noShrink?: boolean | undefined;
369
- oddPagesOnly?: boolean | undefined;
370
- originalPageSizes?: boolean | undefined;
371
- ownerPassword?: string | undefined;
372
- paperHeight?: number | undefined;
373
- paperSize?:
374
- | "match"
375
- | "A3"
376
- | "A4"
377
- | "legal"
378
- | "letter"
379
- | undefined;
380
- paperWidth?: number | undefined;
381
- pdfFile?: boolean | undefined;
382
- pngFile?: boolean | undefined;
383
- printVersionInfo?: boolean | undefined;
384
- psFile?: boolean | undefined;
385
- psLevel2?: boolean | undefined;
386
- psLevel3?: boolean | undefined;
387
- quiet?: boolean | undefined;
388
- resolutionXAxis?: number | undefined;
389
- resolutionXYAxis?: number | undefined;
390
- resolutionYAxis?: number | undefined;
391
- scalePageTo?: number | undefined;
392
- scalePageToXAxis?: number | undefined;
393
- scalePageToYAxis?: number | undefined;
394
- singleFile?: boolean | undefined;
395
- svgFile?: boolean | undefined;
396
- tiffCompression?:
397
- | "none"
398
- | "deflate"
399
- | "jpeg"
400
- | "lzw"
401
- | "packbits"
402
- | undefined;
403
- tiffFile?: boolean | undefined;
404
- transparentPageColor?: boolean | undefined;
405
- userPassword?: string | undefined;
406
- }
407
- | undefined
324
+ outputFile?: string,
325
+ options?: {
326
+ antialias?:
327
+ | "best"
328
+ | "default"
329
+ | "fast"
330
+ | "good"
331
+ | "gray"
332
+ | "none"
333
+ | "subpixel";
334
+ cropBox?: boolean;
335
+ cropHeight?: number;
336
+ cropSize?: number;
337
+ cropWidth?: number;
338
+ cropXAxis?: number;
339
+ cropYAxis?: number;
340
+ duplex?: boolean;
341
+ epsFile?: boolean;
342
+ evenPagesOnly?: boolean;
343
+ fillPage?: boolean;
344
+ firstPageToConvert?: number;
345
+ grayscaleFile?: boolean;
346
+ iccFile?: string;
347
+ jpegFile?: boolean;
348
+ jpegOptions?: string;
349
+ lastPageToConvert?: number;
350
+ monochromeFile?: boolean;
351
+ noCenter?: boolean;
352
+ noCrop?: boolean;
353
+ noShrink?: boolean;
354
+ oddPagesOnly?: boolean;
355
+ originalPageSizes?: boolean;
356
+ ownerPassword?: string;
357
+ paperHeight?: number;
358
+ paperSize?: "A3" | "A4" | "legal" | "letter" | "match";
359
+ paperWidth?: number;
360
+ pdfFile?: boolean;
361
+ pngFile?: boolean;
362
+ printVersionInfo?: boolean;
363
+ psFile?: boolean;
364
+ psLevel2?: boolean;
365
+ psLevel3?: boolean;
366
+ quiet?: boolean;
367
+ resolutionXAxis?: number;
368
+ resolutionXYAxis?: number;
369
+ resolutionYAxis?: number;
370
+ scalePageTo?: number;
371
+ scalePageToXAxis?: number;
372
+ scalePageToYAxis?: number;
373
+ singleFile?: boolean;
374
+ svgFile?: boolean;
375
+ tiffCompression?: "deflate" | "jpeg" | "lzw" | "none" | "packbits";
376
+ tiffFile?: boolean;
377
+ transparentPageColor?: boolean;
378
+ userPassword?: string;
379
+ }
408
380
  ): Promise<string>;
409
381
  /**
410
382
  * @author Frazer Smith
@@ -448,34 +420,32 @@ export class Poppler {
448
420
  */
449
421
  pdfToHtml(
450
422
  file: Buffer | string,
451
- outputFile?: string | undefined,
452
- options?:
453
- | {
454
- complexOutput?: boolean | undefined;
455
- dataUrls?: boolean | undefined;
456
- exchangePdfLinks?: boolean | undefined;
457
- extractHidden?: boolean | undefined;
458
- firstPageToConvert?: number | undefined;
459
- fontFullName?: boolean | undefined;
460
- ignoreImages?: boolean | undefined;
461
- imageFormat?: "JPG" | "PNG" | undefined;
462
- lastPageToConvert?: number | undefined;
463
- noDrm?: boolean | undefined;
464
- noFrames?: boolean | undefined;
465
- noMergeParagraph?: boolean | undefined;
466
- noRoundedCoordinates?: boolean | undefined;
467
- outputEncoding?: string | undefined;
468
- ownerPassword?: string | undefined;
469
- printVersionInfo?: boolean | undefined;
470
- quiet?: boolean | undefined;
471
- singlePage?: boolean | undefined;
472
- stdout?: boolean | undefined;
473
- userPassword?: string | undefined;
474
- wordBreakThreshold?: number | undefined;
475
- xmlOutput?: boolean | undefined;
476
- zoom?: number | undefined;
477
- }
478
- | undefined
423
+ outputFile?: string,
424
+ options?: {
425
+ complexOutput?: boolean;
426
+ dataUrls?: boolean;
427
+ exchangePdfLinks?: boolean;
428
+ extractHidden?: boolean;
429
+ firstPageToConvert?: number;
430
+ fontFullName?: boolean;
431
+ ignoreImages?: boolean;
432
+ imageFormat?: "JPG" | "PNG";
433
+ lastPageToConvert?: number;
434
+ noDrm?: boolean;
435
+ noFrames?: boolean;
436
+ noMergeParagraph?: boolean;
437
+ noRoundedCoordinates?: boolean;
438
+ outputEncoding?: string;
439
+ ownerPassword?: string;
440
+ printVersionInfo?: boolean;
441
+ quiet?: boolean;
442
+ singlePage?: boolean;
443
+ stdout?: boolean;
444
+ userPassword?: string;
445
+ wordBreakThreshold?: number;
446
+ xmlOutput?: boolean;
447
+ zoom?: number;
448
+ }
479
449
  ): Promise<string>;
480
450
  /**
481
451
  * @author Frazer Smith
@@ -554,55 +524,47 @@ export class Poppler {
554
524
  pdfToPpm(
555
525
  file: Buffer | string,
556
526
  outputPath: string,
557
- options?:
558
- | {
559
- antialiasFonts?: "no" | "yes" | undefined;
560
- antialiasVectors?: "no" | "yes" | undefined;
561
- cropBox?: boolean | undefined;
562
- cropHeight?: number | undefined;
563
- cropSize?: number | undefined;
564
- cropWidth?: number | undefined;
565
- cropXAxis?: number | undefined;
566
- cropYAxis?: number | undefined;
567
- defaultCmykProfile?: string | undefined;
568
- defaultGrayProfile?: string | undefined;
569
- defaultRgbProfile?: string | undefined;
570
- displayProfile?: string | undefined;
571
- evenPagesOnly?: boolean | undefined;
572
- firstPageToConvert?: number | undefined;
573
- freetype?: "no" | "yes" | undefined;
574
- forcePageNumber?: boolean | undefined;
575
- grayscaleFile?: boolean | undefined;
576
- hideAnnotations?: boolean | undefined;
577
- jpegFile?: boolean | undefined;
578
- lastPageToConvert?: number | undefined;
579
- monochromeFile?: boolean | undefined;
580
- oddPagesOnly?: boolean | undefined;
581
- ownerPassword?: string | undefined;
582
- pngFile?: boolean | undefined;
583
- printProgress?: boolean | undefined;
584
- printVersionInfo?: boolean | undefined;
585
- quiet?: boolean | undefined;
586
- resolutionXAxis?: number | undefined;
587
- resolutionXYAxis?: number | undefined;
588
- resolutionYAxis?: number | undefined;
589
- scalePageTo?: number | undefined;
590
- scalePageToXAxis?: number | undefined;
591
- scalePageToYAxis?: number | undefined;
592
- separator?: string | undefined;
593
- singleFile?: boolean | undefined;
594
- thinLineMode?: "none" | "shape" | "solid" | undefined;
595
- tiffCompression?:
596
- | "none"
597
- | "deflate"
598
- | "jpeg"
599
- | "lzw"
600
- | "packbits"
601
- | undefined;
602
- tiffFile?: boolean | undefined;
603
- userPassword?: string | undefined;
604
- }
605
- | undefined
527
+ options?: {
528
+ antialiasFonts?: "no" | "yes";
529
+ antialiasVectors?: "no" | "yes";
530
+ cropBox?: boolean;
531
+ cropHeight?: number;
532
+ cropSize?: number;
533
+ cropWidth?: number;
534
+ cropXAxis?: number;
535
+ cropYAxis?: number;
536
+ defaultCmykProfile?: string;
537
+ defaultGrayProfile?: string;
538
+ defaultRgbProfile?: string;
539
+ displayProfile?: string;
540
+ evenPagesOnly?: boolean;
541
+ firstPageToConvert?: number;
542
+ freetype?: "no" | "yes";
543
+ forcePageNumber?: boolean;
544
+ grayscaleFile?: boolean;
545
+ hideAnnotations?: boolean;
546
+ jpegFile?: boolean;
547
+ lastPageToConvert?: number;
548
+ monochromeFile?: boolean;
549
+ oddPagesOnly?: boolean;
550
+ ownerPassword?: string;
551
+ pngFile?: boolean;
552
+ printProgress?: boolean;
553
+ printVersionInfo?: boolean;
554
+ quiet?: boolean;
555
+ resolutionXAxis?: number;
556
+ resolutionXYAxis?: number;
557
+ resolutionYAxis?: number;
558
+ scalePageTo?: number;
559
+ scalePageToXAxis?: number;
560
+ scalePageToYAxis?: number;
561
+ separator?: string;
562
+ singleFile?: boolean;
563
+ thinLineMode?: "none" | "shape" | "solid";
564
+ tiffCompression?: "deflate" | "jpeg" | "lzw" | "none" | "packbits";
565
+ tiffFile?: boolean;
566
+ userPassword?: string;
567
+ }
606
568
  ): Promise<string>;
607
569
  /**
608
570
  * @author Frazer Smith
@@ -715,58 +677,50 @@ export class Poppler {
715
677
  */
716
678
  pdfToPs(
717
679
  file: Buffer | string,
718
- outputFile?: string | undefined,
719
- options?:
720
- | {
721
- antialias?: "no" | "yes" | undefined;
722
- binary?: boolean | undefined;
723
- defaultCmykProfile?: string | undefined;
724
- defaultGrayProfile?: string | undefined;
725
- defaultRgbProfile?: string | undefined;
726
- duplex?: boolean | undefined;
727
- epsFile?: boolean | undefined;
728
- fillPage?: boolean | undefined;
729
- firstPageToConvert?: number | undefined;
730
- form?: number | undefined;
731
- lastPageToConvert?: number | undefined;
732
- level1?: boolean | undefined;
733
- level1Sep?: boolean | undefined;
734
- level2?: boolean | undefined;
735
- level2Sep?: boolean | undefined;
736
- level3?: boolean | undefined;
737
- level3Sep?: boolean | undefined;
738
- noEmbedCIDFonts?: boolean | undefined;
739
- noEmbedCIDTrueTypeFonts?: boolean | undefined;
740
- noEmbedTrueTypeFonts?: boolean | undefined;
741
- noEmbedType1Fonts?: boolean | undefined;
742
- noCenter?: boolean | undefined;
743
- noCrop?: boolean | undefined;
744
- noShrink?: boolean | undefined;
745
- opi?: boolean | undefined;
746
- optimizecolorspace?: boolean | undefined;
747
- originalPageSizes?: boolean | undefined;
748
- overprint?: boolean | undefined;
749
- ownerPassword?: string | undefined;
750
- paperHeight?: number | undefined;
751
- paperSize?:
752
- | "match"
753
- | "A3"
754
- | "A4"
755
- | "legal"
756
- | "letter"
757
- | undefined;
758
- paperWidth?: number | undefined;
759
- passfonts?: boolean | undefined;
760
- preload?: boolean | undefined;
761
- printVersionInfo?: boolean | undefined;
762
- processColorFormat?: "CMYK8" | "MONO8" | "RGB8" | undefined;
763
- processColorProfile?: string | undefined;
764
- quiet?: boolean | undefined;
765
- rasterize?: "always" | "never" | "whenneeded" | undefined;
766
- resolutionXYAxis?: number | undefined;
767
- userPassword?: string | undefined;
768
- }
769
- | undefined
680
+ outputFile?: string,
681
+ options?: {
682
+ antialias?: "no" | "yes";
683
+ binary?: boolean;
684
+ defaultCmykProfile?: string;
685
+ defaultGrayProfile?: string;
686
+ defaultRgbProfile?: string;
687
+ duplex?: boolean;
688
+ epsFile?: boolean;
689
+ fillPage?: boolean;
690
+ firstPageToConvert?: number;
691
+ form?: number;
692
+ lastPageToConvert?: number;
693
+ level1?: boolean;
694
+ level1Sep?: boolean;
695
+ level2?: boolean;
696
+ level2Sep?: boolean;
697
+ level3?: boolean;
698
+ level3Sep?: boolean;
699
+ noEmbedCIDFonts?: boolean;
700
+ noEmbedCIDTrueTypeFonts?: boolean;
701
+ noEmbedTrueTypeFonts?: boolean;
702
+ noEmbedType1Fonts?: boolean;
703
+ noCenter?: boolean;
704
+ noCrop?: boolean;
705
+ noShrink?: boolean;
706
+ opi?: boolean;
707
+ optimizecolorspace?: boolean;
708
+ originalPageSizes?: boolean;
709
+ overprint?: boolean;
710
+ ownerPassword?: string;
711
+ paperHeight?: number;
712
+ paperSize?: "A3" | "A4" | "legal" | "letter" | "match";
713
+ paperWidth?: number;
714
+ passfonts?: boolean;
715
+ preload?: boolean;
716
+ printVersionInfo?: boolean;
717
+ processColorFormat?: "CMYK8" | "MONO8" | "RGB8";
718
+ processColorProfile?: string;
719
+ quiet?: boolean;
720
+ rasterize?: "always" | "never" | "whenneeded";
721
+ resolutionXYAxis?: number;
722
+ userPassword?: string;
723
+ }
770
724
  ): Promise<string>;
771
725
  /**
772
726
  * @author Frazer Smith
@@ -818,34 +772,32 @@ export class Poppler {
818
772
  */
819
773
  pdfToText(
820
774
  file: Buffer | string,
821
- outputFile?: string | undefined,
822
- options?:
823
- | {
824
- boundingBoxXhtml?: boolean | undefined;
825
- boundingBoxXhtmlLayout?: boolean | undefined;
826
- cropBox?: boolean | undefined;
827
- cropHeight?: number | undefined;
828
- cropWidth?: number | undefined;
829
- cropXAxis?: number | undefined;
830
- cropYAxis?: number | undefined;
831
- eolConvention?: "dos" | "mac" | "unix" | undefined;
832
- firstPageToConvert?: number | undefined;
833
- fixedWidthLayout?: number | undefined;
834
- generateHtmlMetaFile?: boolean | undefined;
835
- generateTsvFile?: boolean | undefined;
836
- lastPageToConvert?: number | undefined;
837
- listEncodingOptions?: boolean | undefined;
838
- maintainLayout?: boolean | undefined;
839
- noDiagonalText?: boolean | undefined;
840
- noPageBreaks?: boolean | undefined;
841
- outputEncoding?: string | undefined;
842
- ownerPassword?: string | undefined;
843
- printVersionInfo?: boolean | undefined;
844
- quiet?: boolean | undefined;
845
- rawLayout?: boolean | undefined;
846
- userPassword?: string | undefined;
847
- }
848
- | undefined
775
+ outputFile?: string,
776
+ options?: {
777
+ boundingBoxXhtml?: boolean;
778
+ boundingBoxXhtmlLayout?: boolean;
779
+ cropBox?: boolean;
780
+ cropHeight?: number;
781
+ cropWidth?: number;
782
+ cropXAxis?: number;
783
+ cropYAxis?: number;
784
+ eolConvention?: "dos" | "mac" | "unix";
785
+ firstPageToConvert?: number;
786
+ fixedWidthLayout?: number;
787
+ generateHtmlMetaFile?: boolean;
788
+ generateTsvFile?: boolean;
789
+ lastPageToConvert?: number;
790
+ listEncodingOptions?: boolean;
791
+ maintainLayout?: boolean;
792
+ noDiagonalText?: boolean;
793
+ noPageBreaks?: boolean;
794
+ outputEncoding?: string;
795
+ ownerPassword?: string;
796
+ printVersionInfo?: boolean;
797
+ quiet?: boolean;
798
+ rawLayout?: boolean;
799
+ userPassword?: string;
800
+ }
849
801
  ): Promise<string>;
850
802
  /**
851
803
  * @author Frazer Smith
@@ -861,10 +813,8 @@ export class Poppler {
861
813
  pdfUnite(
862
814
  files: string[],
863
815
  outputFile: string,
864
- options?:
865
- | {
866
- printVersionInfo?: boolean | undefined;
867
- }
868
- | undefined
816
+ options?: {
817
+ printVersionInfo?: boolean;
818
+ }
869
819
  ): Promise<string>;
870
820
  }