node-poppler 6.1.2 → 6.2.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/package.json +2 -1
- package/src/index.js +14 -13
- package/{src → types}/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-poppler",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.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
|
+
"types": "types/index.d.ts",
|
|
36
37
|
"repository": "git+https://github.com/Fdawgs/node-poppler.git",
|
|
37
38
|
"homepage": "https://github.com/Fdawgs/node-poppler",
|
|
38
39
|
"bugs": {
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const errorMessages = {
|
|
|
11
11
|
1: "Error opening a PDF file",
|
|
12
12
|
2: "Error opening an output file",
|
|
13
13
|
3: "Error related to PDF permissions",
|
|
14
|
+
4: "Error related to ICC profile",
|
|
14
15
|
99: "Other error",
|
|
15
16
|
3221226505: "Internal process error",
|
|
16
17
|
};
|
|
@@ -19,10 +20,12 @@ const errorMessages = {
|
|
|
19
20
|
* @author Frazer Smith
|
|
20
21
|
* @description Check each option provided is valid, of the correct type, and can be used by specified
|
|
21
22
|
* version of binary.
|
|
23
|
+
* @ignore
|
|
22
24
|
* @param {object} acceptedOptions - Object containing options that a binary accepts.
|
|
23
25
|
* @param {object} options - Object containing options to pass to binary.
|
|
24
26
|
* @param {string=} version - Version of binary.
|
|
25
|
-
* @returns {Array
|
|
27
|
+
* @returns {Array<string>} Array of CLI arguments.
|
|
28
|
+
* @throws If invalid arguments provided.
|
|
26
29
|
*/
|
|
27
30
|
function parseOptions(acceptedOptions, options, version) {
|
|
28
31
|
const args = [];
|
|
@@ -245,7 +248,7 @@ class Poppler {
|
|
|
245
248
|
if (stdOut !== "") {
|
|
246
249
|
resolve(stdOut.trim());
|
|
247
250
|
} else {
|
|
248
|
-
reject(new Error(stdErr.trim()));
|
|
251
|
+
reject(new Error(stdErr ? stdErr.trim() : undefined));
|
|
249
252
|
}
|
|
250
253
|
});
|
|
251
254
|
});
|
|
@@ -481,7 +484,7 @@ class Poppler {
|
|
|
481
484
|
resolve(stdOut.trim());
|
|
482
485
|
}
|
|
483
486
|
} else {
|
|
484
|
-
reject(new Error(stdErr.trim()));
|
|
487
|
+
reject(new Error(stdErr ? stdErr.trim() : undefined));
|
|
485
488
|
}
|
|
486
489
|
});
|
|
487
490
|
});
|
|
@@ -873,16 +876,15 @@ class Poppler {
|
|
|
873
876
|
stdErr += data;
|
|
874
877
|
});
|
|
875
878
|
|
|
876
|
-
|
|
879
|
+
/**
|
|
880
|
+
* pdfToHtml does not return an exit code so check output to see if it was successful.
|
|
881
|
+
* See https://gitlab.freedesktop.org/poppler/poppler/-/blob/master/utils/pdftohtml.1
|
|
882
|
+
*/
|
|
883
|
+
child.on("close", async () => {
|
|
877
884
|
if (stdOut !== "") {
|
|
878
885
|
resolve(stdOut.trim());
|
|
879
|
-
} else if (code === 0) {
|
|
880
|
-
resolve(errorMessages[code]);
|
|
881
|
-
} else if (stdErr !== "") {
|
|
882
|
-
reject(new Error(stdErr.trim()));
|
|
883
886
|
} else {
|
|
884
|
-
|
|
885
|
-
reject(new Error(errorMessages[code]));
|
|
887
|
+
reject(new Error(stdErr ? stdErr.trim() : undefined));
|
|
886
888
|
}
|
|
887
889
|
});
|
|
888
890
|
});
|
|
@@ -1518,6 +1520,5 @@ class Poppler {
|
|
|
1518
1520
|
}
|
|
1519
1521
|
}
|
|
1520
1522
|
|
|
1521
|
-
module.exports =
|
|
1522
|
-
|
|
1523
|
-
};
|
|
1523
|
+
module.exports.Poppler = Poppler;
|
|
1524
|
+
module.exports.default = Poppler;
|
package/{src → types}/index.d.ts
RENAMED