node-poppler 5.1.6 → 6.0.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.
- package/LICENSE +1 -1
- package/README.md +4 -10
- package/package.json +12 -12
- package/src/index.d.ts +0 -12
- package/src/index.js +2 -14
- package/API.md +0 -465
- package/CHANGELOG.md +0 -1032
package/LICENSE
CHANGED
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# node-poppler
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Fdawgs/node-poppler/releases/latest/)
|
|
4
|
-
[](https://
|
|
4
|
+
[](https://npmjs.com/package/node-poppler)
|
|
5
5
|

|
|
6
6
|
[](https://coveralls.io/github/Fdawgs/node-poppler?branch=master)
|
|
7
7
|
[](https://github.com/prettier/prettier)
|
|
@@ -17,20 +17,12 @@ It was created out of a need for a PDF-to-HTML conversion module at [Yeovil Dist
|
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
|
-
Install using
|
|
20
|
+
Install using `npm`:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
23
|
npm i node-poppler
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Or [`yarn`](https://yarnpkg.com/en/package/node-poppler):
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
yarn add node-poppler
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
node-poppler's test scripts use npm commands.
|
|
33
|
-
|
|
34
26
|
### Linux and macOS/Darwin Support
|
|
35
27
|
|
|
36
28
|
Windows binaries are provided with this repository.
|
|
@@ -174,6 +166,8 @@ Please adhere to this project's [Code of Conduct](./CODE_OF_CONDUCT.md) when con
|
|
|
174
166
|
- [**Filipe Fernandes**](https://github.com/ocefpaf/) - [poppler-feedstock](https://github.com/conda-forge/poppler-feedstock) maintainer
|
|
175
167
|
- [**Peter Williams**](https://github.com/pkgw/) - [poppler-feedstock](https://github.com/conda-forge/poppler-feedstock) maintainer
|
|
176
168
|
- [**Owen Schwartz**](https://github.com/oschwartz10612) - [poppler-windows](https://github.com/oschwartz10612/poppler-windows) developer
|
|
169
|
+
- [**Uwe Korn**](https://github.com/xhochy/) - [poppler-feedstock](https://github.com/conda-forge/poppler-feedstock) maintainer
|
|
170
|
+
- [**Xylar Asay-Davis**](https://github.com/xylar/) - [poppler-feedstock](https://github.com/conda-forge/poppler-feedstock) maintainer
|
|
177
171
|
|
|
178
172
|
## License
|
|
179
173
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-poppler",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Asynchronous node.js wrapper for the Poppler PDF rendering library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"async",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"author": "Frazer Smith <frazer.dev@outlook.com>",
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
44
|
+
"node": ">=14.0.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsc",
|
|
@@ -71,24 +71,24 @@
|
|
|
71
71
|
"testTimeout": 60000
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@commitlint/cli": "^17.
|
|
75
|
-
"@commitlint/config-conventional": "^17.0
|
|
76
|
-
"eslint": "^8.
|
|
74
|
+
"@commitlint/cli": "^17.1.2",
|
|
75
|
+
"@commitlint/config-conventional": "^17.1.0",
|
|
76
|
+
"eslint": "^8.24.0",
|
|
77
77
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
78
78
|
"eslint-config-prettier": "^8.5.0",
|
|
79
79
|
"eslint-plugin-import": "^2.26.0",
|
|
80
|
-
"eslint-plugin-jest": "^
|
|
81
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
82
|
-
"eslint-plugin-promise": "^6.0.
|
|
80
|
+
"eslint-plugin-jest": "^27.0.4",
|
|
81
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
82
|
+
"eslint-plugin-promise": "^6.0.1",
|
|
83
83
|
"eslint-plugin-security": "^1.5.0",
|
|
84
84
|
"eslint-plugin-security-node": "^1.1.1",
|
|
85
|
-
"glob": "^8.0.
|
|
85
|
+
"glob": "^8.0.3",
|
|
86
86
|
"husky": "^8.0.1",
|
|
87
|
-
"jest": "^
|
|
87
|
+
"jest": "^29.1.2",
|
|
88
88
|
"jsdoc-to-markdown": "^7.1.1",
|
|
89
89
|
"license-checker": "^25.0.1",
|
|
90
|
-
"prettier": "^2.
|
|
91
|
-
"typescript": "^4.
|
|
90
|
+
"prettier": "^2.7.1",
|
|
91
|
+
"typescript": "^4.8.4"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"camelcase": "^6.3.0",
|
package/src/index.d.ts
CHANGED
|
@@ -24,7 +24,6 @@ export class Poppler {
|
|
|
24
24
|
/**
|
|
25
25
|
* @author Frazer Smith
|
|
26
26
|
* @description Lists or extracts embedded files (attachments) from a PDF file.
|
|
27
|
-
*
|
|
28
27
|
* @param {string} file - Filepath of the PDF file to read.
|
|
29
28
|
* @param {object=} options - Object containing options to pass to binary.
|
|
30
29
|
* @param {boolean=} options.listEmbedded - List all of the embedded files in the PDF file.
|
|
@@ -55,7 +54,6 @@ export class Poppler {
|
|
|
55
54
|
/**
|
|
56
55
|
* @author Frazer Smith
|
|
57
56
|
* @description Lists the fonts used in a PDF file along with various information for each font.
|
|
58
|
-
*
|
|
59
57
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
60
58
|
* @param {object=} options - Object containing options to pass to binary.
|
|
61
59
|
* @param {number=} options.firstPageToExamine - Specifies the first page to examine.
|
|
@@ -74,7 +72,6 @@ export class Poppler {
|
|
|
74
72
|
/**
|
|
75
73
|
* @author Frazer Smith
|
|
76
74
|
* @description Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 files.
|
|
77
|
-
*
|
|
78
75
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
79
76
|
* @param {string=} outputPrefix - Filename prefix of output files.
|
|
80
77
|
* @param {object=} options - Object containing options to pass to binary.
|
|
@@ -104,7 +101,6 @@ export class Poppler {
|
|
|
104
101
|
/**
|
|
105
102
|
* @author Frazer Smith
|
|
106
103
|
* @description Prints the contents of the `Info` dictionary from a PDF file.
|
|
107
|
-
*
|
|
108
104
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
109
105
|
* @param {object=} options - Object containing options to pass to binary.
|
|
110
106
|
* @param {number=} options.firstPageToConvert - First page to print.
|
|
@@ -145,7 +141,6 @@ export class Poppler {
|
|
|
145
141
|
* @description Extract single pages from a PDF file,
|
|
146
142
|
* and writes one PDF file for each page to outputPattern.
|
|
147
143
|
* This will not work if the file is encrypted.
|
|
148
|
-
*
|
|
149
144
|
* @param {string} file - Filepath of the PDF file to read.
|
|
150
145
|
* @param {string} outputPattern - Should contain %d (or any variant respecting printf format),
|
|
151
146
|
* since %d is replaced by the page number.
|
|
@@ -166,7 +161,6 @@ export class Poppler {
|
|
|
166
161
|
/**
|
|
167
162
|
* @author Frazer Smith
|
|
168
163
|
* @description Converts a PDF file to EPS/JPEG/PDF/PNG/PS/SVG/TIFF.
|
|
169
|
-
*
|
|
170
164
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
171
165
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
172
166
|
*
|
|
@@ -277,14 +271,12 @@ export class Poppler {
|
|
|
277
271
|
/**
|
|
278
272
|
* @author Frazer Smith
|
|
279
273
|
* @description Converts a PDF file to HTML.
|
|
280
|
-
*
|
|
281
274
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
282
275
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
283
276
|
* If `undefined` then Poppler will use the directory and name of the original file
|
|
284
277
|
* and create a new file, with `-html` appended to the end of the filename.
|
|
285
278
|
*
|
|
286
279
|
* Required if `file` is a Buffer.
|
|
287
|
-
*
|
|
288
280
|
* @param {object=} options - Object containing options to pass to binary.
|
|
289
281
|
* @param {boolean=} options.complexOutput - Generate complex output.
|
|
290
282
|
* @param {boolean=} options.dataUrls - Use data URLs instead of external images in HTML.
|
|
@@ -326,7 +318,6 @@ export class Poppler {
|
|
|
326
318
|
* @description Converts a PDF file to colour image files in Portable Pixmap (PPM) format,
|
|
327
319
|
* grayscale image files in Portable Graymap (PGM) format, or monochrome image files
|
|
328
320
|
* in Portable Bitmap (PBM) format.
|
|
329
|
-
*
|
|
330
321
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
331
322
|
* @param {string} outputPath - Filepath to output the results to.
|
|
332
323
|
* @param {object=} options - Object containing options to pass to binary.
|
|
@@ -404,7 +395,6 @@ export class Poppler {
|
|
|
404
395
|
/**
|
|
405
396
|
* @author Frazer Smith
|
|
406
397
|
* @description Converts a PDF file to PostScript (PS).
|
|
407
|
-
*
|
|
408
398
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
409
399
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
410
400
|
* If `undefined` then will write output to stdout.
|
|
@@ -519,7 +509,6 @@ export class Poppler {
|
|
|
519
509
|
/**
|
|
520
510
|
* @author Frazer Smith
|
|
521
511
|
* @description Converts a PDF file to TXT.
|
|
522
|
-
*
|
|
523
512
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
524
513
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
525
514
|
* If `undefined` then will write output to stdout.
|
|
@@ -572,7 +561,6 @@ export class Poppler {
|
|
|
572
561
|
* @author Frazer Smith
|
|
573
562
|
* @description Merges several PDF files in order of their occurrence in the files array to
|
|
574
563
|
* one PDF result file.
|
|
575
|
-
*
|
|
576
564
|
* @param {Array} files - Filepaths of the PDF files to merge.
|
|
577
565
|
* An entire directory of PDF files can be merged like so: `path/to/directory/*.pdf`.
|
|
578
566
|
* @param {string} outputFile - Filepath of the file to output the resulting merged PDF to.
|
package/src/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
const camelCase = require("camelcase");
|
|
3
3
|
const path = require("upath");
|
|
4
4
|
const { execFile, spawn } = require("child_process");
|
|
5
|
-
const
|
|
5
|
+
const { promisify } = require("util");
|
|
6
6
|
|
|
7
|
-
const execFileAsync =
|
|
7
|
+
const execFileAsync = promisify(execFile);
|
|
8
8
|
|
|
9
9
|
const errorMessages = {
|
|
10
10
|
0: "No Error",
|
|
@@ -128,7 +128,6 @@ class Poppler {
|
|
|
128
128
|
/**
|
|
129
129
|
* @author Frazer Smith
|
|
130
130
|
* @description Lists or extracts embedded files (attachments) from a PDF file.
|
|
131
|
-
*
|
|
132
131
|
* @param {string} file - Filepath of the PDF file to read.
|
|
133
132
|
* @param {object=} options - Object containing options to pass to binary.
|
|
134
133
|
* @param {boolean=} options.listEmbedded - List all of the embedded files in the PDF file.
|
|
@@ -186,7 +185,6 @@ class Poppler {
|
|
|
186
185
|
/**
|
|
187
186
|
* @author Frazer Smith
|
|
188
187
|
* @description Lists the fonts used in a PDF file along with various information for each font.
|
|
189
|
-
*
|
|
190
188
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
191
189
|
* @param {object=} options - Object containing options to pass to binary.
|
|
192
190
|
* @param {number=} options.firstPageToExamine - Specifies the first page to examine.
|
|
@@ -266,7 +264,6 @@ class Poppler {
|
|
|
266
264
|
/**
|
|
267
265
|
* @author Frazer Smith
|
|
268
266
|
* @description Saves images from a PDF file as PPM, PBM, PNG, TIFF, JPEG, JPEG2000, or JBIG2 files.
|
|
269
|
-
*
|
|
270
267
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
271
268
|
* @param {string=} outputPrefix - Filename prefix of output files.
|
|
272
269
|
* @param {object=} options - Object containing options to pass to binary.
|
|
@@ -372,7 +369,6 @@ class Poppler {
|
|
|
372
369
|
/**
|
|
373
370
|
* @author Frazer Smith
|
|
374
371
|
* @description Prints the contents of the `Info` dictionary from a PDF file.
|
|
375
|
-
*
|
|
376
372
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
377
373
|
* @param {object=} options - Object containing options to pass to binary.
|
|
378
374
|
* @param {number=} options.firstPageToConvert - First page to print.
|
|
@@ -514,7 +510,6 @@ class Poppler {
|
|
|
514
510
|
* @description Extract single pages from a PDF file,
|
|
515
511
|
* and writes one PDF file for each page to outputPattern.
|
|
516
512
|
* This will not work if the file is encrypted.
|
|
517
|
-
*
|
|
518
513
|
* @param {string} file - Filepath of the PDF file to read.
|
|
519
514
|
* @param {string} outputPattern - Should contain %d (or any variant respecting printf format),
|
|
520
515
|
* since %d is replaced by the page number.
|
|
@@ -563,7 +558,6 @@ class Poppler {
|
|
|
563
558
|
/**
|
|
564
559
|
* @author Frazer Smith
|
|
565
560
|
* @description Converts a PDF file to EPS/JPEG/PDF/PNG/PS/SVG/TIFF.
|
|
566
|
-
*
|
|
567
561
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
568
562
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
569
563
|
*
|
|
@@ -792,14 +786,12 @@ class Poppler {
|
|
|
792
786
|
/**
|
|
793
787
|
* @author Frazer Smith
|
|
794
788
|
* @description Converts a PDF file to HTML.
|
|
795
|
-
*
|
|
796
789
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
797
790
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
798
791
|
* If `undefined` then Poppler will use the directory and name of the original file
|
|
799
792
|
* and create a new file, with `-html` appended to the end of the filename.
|
|
800
793
|
*
|
|
801
794
|
* Required if `file` is a Buffer.
|
|
802
|
-
*
|
|
803
795
|
* @param {object=} options - Object containing options to pass to binary.
|
|
804
796
|
* @param {boolean=} options.complexOutput - Generate complex output.
|
|
805
797
|
* @param {boolean=} options.dataUrls - Use data URLs instead of external images in HTML.
|
|
@@ -931,7 +923,6 @@ class Poppler {
|
|
|
931
923
|
* @description Converts a PDF file to colour image files in Portable Pixmap (PPM) format,
|
|
932
924
|
* grayscale image files in Portable Graymap (PGM) format, or monochrome image files
|
|
933
925
|
* in Portable Bitmap (PBM) format.
|
|
934
|
-
*
|
|
935
926
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
936
927
|
* @param {string} outputPath - Filepath to output the results to.
|
|
937
928
|
* @param {object=} options - Object containing options to pass to binary.
|
|
@@ -1130,7 +1121,6 @@ class Poppler {
|
|
|
1130
1121
|
/**
|
|
1131
1122
|
* @author Frazer Smith
|
|
1132
1123
|
* @description Converts a PDF file to PostScript (PS).
|
|
1133
|
-
*
|
|
1134
1124
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1135
1125
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
1136
1126
|
* If `undefined` then will write output to stdout.
|
|
@@ -1376,7 +1366,6 @@ class Poppler {
|
|
|
1376
1366
|
/**
|
|
1377
1367
|
* @author Frazer Smith
|
|
1378
1368
|
* @description Converts a PDF file to TXT.
|
|
1379
|
-
*
|
|
1380
1369
|
* @param {Buffer| string} file - PDF file as Buffer, or filepath of the PDF file to read.
|
|
1381
1370
|
* @param {string=} outputFile - Filepath of the file to output the results to.
|
|
1382
1371
|
* If `undefined` then will write output to stdout.
|
|
@@ -1528,7 +1517,6 @@ class Poppler {
|
|
|
1528
1517
|
* @author Frazer Smith
|
|
1529
1518
|
* @description Merges several PDF files in order of their occurrence in the files array to
|
|
1530
1519
|
* one PDF result file.
|
|
1531
|
-
*
|
|
1532
1520
|
* @param {Array} files - Filepaths of the PDF files to merge.
|
|
1533
1521
|
* An entire directory of PDF files can be merged like so: `path/to/directory/*.pdf`.
|
|
1534
1522
|
* @param {string} outputFile - Filepath of the file to output the resulting merged PDF to.
|