node-poppler 9.1.1 → 10.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-present Frazer Smith
3
+ Copyright (c) 2019-present Frazer Smith <frazer.dev@icloud.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,41 +1,42 @@
1
1
  # node-poppler
2
2
 
3
- [![GitHub release](https://img.shields.io/github/release/Fdawgs/node-poppler.svg)](https://github.com/Fdawgs/node-poppler/releases/latest/)
4
- [![npm version](https://img.shields.io/npm/v/node-poppler)](https://npmjs.com/package/node-poppler)
3
+ [![GitHub release](https://img.shields.io/github/v/release/Fdawgs/node-poppler)](https://github.com/Fdawgs/node-poppler/releases/latest)
4
+ [![npm version](https://img.shields.io/npm/v/node-poppler)](https://www.npmjs.com/package/node-poppler)
5
5
  [![CI](https://github.com/Fdawgs/node-poppler/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Fdawgs/node-poppler/actions/workflows/ci.yml)
6
6
  [![Coverage status](https://coveralls.io/repos/github/Fdawgs/node-poppler/badge.svg?branch=main)](https://coveralls.io/github/Fdawgs/node-poppler?branch=main)
7
- [![code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat)](https://github.com/prettier/prettier)
7
+ [![code style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4?style=flat)](https://github.com/prettier/prettier)
8
+ [![OSSF Scorecard](https://api.scorecard.dev/projects/github.com/Fdawgs/node-poppler/badge)](https://scorecard.dev/viewer/?uri=github.com/Fdawgs/node-poppler)
8
9
 
9
- > Asynchronous Node.js wrapper for the Poppler PDF rendering library
10
+ > Asynchronous Node.js wrapper for the Poppler PDF rendering utilities
10
11
 
11
12
  ## Overview
12
13
 
13
- [Poppler](https://poppler.freedesktop.org/) is a PDF rendering library that also includes a collection of utility binaries, which allows for the manipulation and extraction of data from PDF documents such as converting PDF files to HTML, TXT, or PostScript.
14
+ [Poppler](https://poppler.freedesktop.org) is a PDF rendering library that also includes a collection of utilities, which provide functionality for manipulating PDF documents and extracting data from them, including converting PDF files to HTML, TXT, or PostScript.
14
15
 
15
- The `node-poppler` module provides an asynchronous Node.js wrapper around said utility binaries for easier use.
16
+ The `node-poppler` module provides an asynchronous Node.js wrapper around these utilities for easier use.
16
17
 
17
18
  ## Installation
18
19
 
19
20
  Install using `npm`:
20
21
 
21
- ```bash
22
+ ```sh
22
23
  npm i node-poppler
23
24
  ```
24
25
 
25
26
  ### Linux and macOS/Darwin support
26
27
 
27
28
  64-bit Windows binaries are provided via an optional dependency on the [`node-poppler-win32`](https://www.npmjs.com/package/node-poppler-win32) package.
28
- For Linux and Mac users, the `poppler-data` and `poppler-utils` binaries binary will need to be installed separately.
29
+ For Linux and macOS users, the `poppler-data` package and `poppler-utils` binaries will need to be installed separately.
29
30
 
30
31
  An example of downloading the binaries on a Debian system:
31
32
 
32
- ```
33
+ ```sh
33
34
  sudo apt-get install poppler-data poppler-utils
34
35
  ```
35
36
 
36
- For macOS users, the binaries can be installed with [Homebrew](https://brew.sh/):
37
+ For macOS users, the binaries can be installed with [Homebrew](https://brew.sh):
37
38
 
38
- ```
39
+ ```sh
39
40
  brew install poppler
40
41
  ```
41
42
 
@@ -45,10 +46,10 @@ Please refer to the [JSDoc comments in the source code](./src/index.js) or the [
45
46
 
46
47
  ### poppler.pdfToCairo
47
48
 
48
- Example of an `async` `await` call to `poppler.pdfToCairo()`, to convert only the first and second page of a PDF file to PNG:
49
+ Example of an `async`/`await` call to `poppler.pdfToCairo()` to convert the first two pages of a PDF file to PNG using ESM syntax:
49
50
 
50
51
  ```js
51
- const { Poppler } = require("node-poppler");
52
+ import { Poppler } from "node-poppler";
52
53
 
53
54
  const file = "test_document.pdf";
54
55
  const poppler = new Poppler();
@@ -57,18 +58,17 @@ const options = {
57
58
  lastPageToConvert: 2,
58
59
  pngFile: true,
59
60
  };
60
- const outputFile = `test_document.png`;
61
+ const outputFile = "test_document";
61
62
 
62
63
  const res = await poppler.pdfToCairo(file, outputFile, options);
63
64
  console.log(res);
64
65
  ```
65
66
 
66
- Example of an `async` `await` call to `poppler.pdfToCairo()`, to convert only the first page of a PDF file to a new
67
- PDF file using stdout:
67
+ Example of an `async`/`await` call to `poppler.pdfToCairo()` to convert the first page of a PDF file to a new PDF file via stdout using ESM syntax:
68
68
 
69
69
  ```js
70
- const { writeFile } = require("node:fs/promises");
71
- const { Poppler } = require("node-poppler");
70
+ import { writeFile } from "node:fs/promises";
71
+ import { Poppler } from "node-poppler";
72
72
 
73
73
  const file = "test_document.pdf";
74
74
  const poppler = new Poppler();
@@ -84,9 +84,11 @@ await writeFile("new_file.pdf", res, { encoding: "binary", flush: true });
84
84
 
85
85
  ### poppler.pdfToHtml
86
86
 
87
- Example of calling `poppler.pdfToHtml()` with a promise chain:
87
+ Example of calling `poppler.pdfToHtml()` with a promise chain using CJS syntax:
88
88
 
89
89
  ```js
90
+ "use strict";
91
+
90
92
  const { Poppler } = require("node-poppler");
91
93
 
92
94
  const file = "test_document.pdf";
@@ -107,9 +109,11 @@ poppler
107
109
  });
108
110
  ```
109
111
 
110
- Example of calling `poppler.pdfToHtml()` with a promise chain, providing a Buffer as an input:
112
+ Example of calling `poppler.pdfToHtml()` with a promise chain using CJS syntax and a `Buffer` as input:
111
113
 
112
114
  ```js
115
+ "use strict";
116
+
113
117
  const { readFileSync } = require("node:fs");
114
118
  const { Poppler } = require("node-poppler");
115
119
 
@@ -133,9 +137,11 @@ poppler
133
137
 
134
138
  ### poppler.pdfToText
135
139
 
136
- Example of calling `poppler.pdfToText()` with a promise chain:
140
+ Example of calling `poppler.pdfToText()` with a promise chain using CJS syntax:
137
141
 
138
142
  ```js
143
+ "use strict";
144
+
139
145
  const { Poppler } = require("node-poppler");
140
146
 
141
147
  const file = "test_document.pdf";
@@ -166,7 +172,7 @@ Please adhere to this project's [Code of Conduct](https://github.com/Fdawgs/.git
166
172
 
167
173
  ## Acknowledgements
168
174
 
169
- - [**Albert Astals Cid**](https://github.com/albert-astals-cid-kdab) - [Poppler](https://poppler.freedesktop.org/) developer
175
+ - [**Albert Astals Cid**](https://github.com/albert-astals-cid-kdab) - [Poppler](https://poppler.freedesktop.org) developer
170
176
 
171
177
  ## License
172
178
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-poppler",
3
- "version": "9.1.1",
4
- "description": "Asynchronous Node.js wrapper for the Poppler PDF rendering library",
3
+ "version": "10.0.0",
4
+ "description": "Asynchronous Node.js wrapper for the Poppler PDF rendering utilities",
5
5
  "keywords": [
6
6
  "async",
7
7
  "attach",