@d0paminedriven/pdfdown 0.4.0 → 0.5.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 +116 -23
- package/index.d.ts +20 -3
- package/index.js +52 -50
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
Rust-powered PDF extraction for Node.js via [napi-rs](https://napi.rs). Extracts per-page text, images (as PNG), and metadata from PDF buffers.
|
|
5
|
+
Rust-powered PDF extraction for Node.js via [napi-rs](https://napi.rs). Extracts per-page text, images (as PNG), annotations (links, destinations), and metadata from PDF buffers.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -16,24 +16,46 @@ pnpm add @d0paminedriven/pdfdown
|
|
|
16
16
|
|
|
17
17
|
## API
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### Standalone functions
|
|
20
|
+
|
|
21
|
+
#### Synchronous
|
|
20
22
|
|
|
21
23
|
```typescript
|
|
22
24
|
export declare function extractTextPerPage(buffer: Buffer): Array<PageText>
|
|
23
25
|
export declare function extractImagesPerPage(buffer: Buffer): Array<PageImage>
|
|
26
|
+
export declare function extractAnnotationsPerPage(buffer: Buffer): Array<PageAnnotation>
|
|
24
27
|
export declare function pdfMetadata(buffer: Buffer): PdfMeta
|
|
25
28
|
```
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
#### Async (libuv thread pool)
|
|
28
31
|
|
|
29
32
|
Each sync function has an async counterpart that runs on the libuv thread pool, keeping the main thread free.
|
|
30
33
|
|
|
31
34
|
```typescript
|
|
32
35
|
export declare function extractTextPerPageAsync(buffer: Buffer): Promise<Array<PageText>>
|
|
33
36
|
export declare function extractImagesPerPageAsync(buffer: Buffer): Promise<Array<PageImage>>
|
|
37
|
+
export declare function extractAnnotationsPerPageAsync(buffer: Buffer): Promise<Array<PageAnnotation>>
|
|
34
38
|
export declare function pdfMetadataAsync(buffer: Buffer): Promise<PdfMeta>
|
|
35
39
|
```
|
|
36
40
|
|
|
41
|
+
### `PdfDown` class
|
|
42
|
+
|
|
43
|
+
Parse once, call many. The constructor parses the PDF document once and reuses it across all sync method calls. Async methods share the parsed document across worker threads via `Arc` (atomic reference counting) with zero re-parsing overhead.
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
export declare class PdfDown {
|
|
47
|
+
constructor(buffer: Buffer)
|
|
48
|
+
textPerPage(): Array<PageText>
|
|
49
|
+
imagesPerPage(): Array<PageImage>
|
|
50
|
+
annotationsPerPage(): Array<PageAnnotation>
|
|
51
|
+
metadata(): PdfMeta
|
|
52
|
+
textPerPageAsync(): Promise<Array<PageText>>
|
|
53
|
+
imagesPerPageAsync(): Promise<Array<PageImage>>
|
|
54
|
+
annotationsPerPageAsync(): Promise<Array<PageAnnotation>>
|
|
55
|
+
metadataAsync(): Promise<PdfMeta>
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
37
59
|
### Types
|
|
38
60
|
|
|
39
61
|
```typescript
|
|
@@ -55,6 +77,15 @@ export interface PageImage {
|
|
|
55
77
|
objectId: string
|
|
56
78
|
}
|
|
57
79
|
|
|
80
|
+
export interface PageAnnotation {
|
|
81
|
+
page: number
|
|
82
|
+
subtype: string // "Link", "Text", "Highlight", etc.
|
|
83
|
+
rect: Array<number> // [x1, y1, x2, y2] bounding box
|
|
84
|
+
uri?: string // external link URL
|
|
85
|
+
dest?: string // internal named destination
|
|
86
|
+
content?: string // tooltip / alt text
|
|
87
|
+
}
|
|
88
|
+
|
|
58
89
|
export interface PdfMeta {
|
|
59
90
|
pageCount: number
|
|
60
91
|
version: string
|
|
@@ -64,7 +95,9 @@ export interface PdfMeta {
|
|
|
64
95
|
|
|
65
96
|
## Usage
|
|
66
97
|
|
|
67
|
-
###
|
|
98
|
+
### Standalone functions
|
|
99
|
+
|
|
100
|
+
#### Extract text per page
|
|
68
101
|
|
|
69
102
|
```typescript
|
|
70
103
|
import { readFileSync } from 'fs'
|
|
@@ -78,7 +111,7 @@ for (const { page, text } of pages) {
|
|
|
78
111
|
}
|
|
79
112
|
```
|
|
80
113
|
|
|
81
|
-
|
|
114
|
+
#### Extract text per page (async)
|
|
82
115
|
|
|
83
116
|
```typescript
|
|
84
117
|
import { readFile } from 'fs/promises'
|
|
@@ -92,7 +125,7 @@ for (const { page, text } of pages) {
|
|
|
92
125
|
}
|
|
93
126
|
```
|
|
94
127
|
|
|
95
|
-
|
|
128
|
+
#### Extract images as PNG
|
|
96
129
|
|
|
97
130
|
```typescript
|
|
98
131
|
import { readFileSync } from 'fs'
|
|
@@ -107,7 +140,7 @@ for (const img of images) {
|
|
|
107
140
|
}
|
|
108
141
|
```
|
|
109
142
|
|
|
110
|
-
|
|
143
|
+
#### Extract images as PNG (async)
|
|
111
144
|
|
|
112
145
|
```typescript
|
|
113
146
|
import { readFile } from 'fs/promises'
|
|
@@ -122,7 +155,39 @@ for (const img of images) {
|
|
|
122
155
|
}
|
|
123
156
|
```
|
|
124
157
|
|
|
125
|
-
|
|
158
|
+
#### Extract annotations
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { readFileSync } from 'fs'
|
|
162
|
+
import { extractAnnotationsPerPage } from '@d0paminedriven/pdfdown'
|
|
163
|
+
|
|
164
|
+
const pdf = readFileSync('document.pdf')
|
|
165
|
+
const annots = extractAnnotationsPerPage(pdf)
|
|
166
|
+
|
|
167
|
+
for (const annot of annots) {
|
|
168
|
+
if (annot.uri) {
|
|
169
|
+
console.log(`Page ${annot.page}: ${annot.uri}`)
|
|
170
|
+
}
|
|
171
|
+
if (annot.dest) {
|
|
172
|
+
console.log(`Page ${annot.page}: internal link to ${annot.dest}`)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Extract annotations (async)
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { readFile } from 'fs/promises'
|
|
181
|
+
import { extractAnnotationsPerPageAsync } from '@d0paminedriven/pdfdown'
|
|
182
|
+
|
|
183
|
+
const pdf = await readFile('document.pdf')
|
|
184
|
+
const annots = await extractAnnotationsPerPageAsync(pdf)
|
|
185
|
+
|
|
186
|
+
const links = annots.filter((a) => a.uri)
|
|
187
|
+
console.log(`Found ${links.length} external links across ${new Set(links.map((a) => a.page)).size} pages`)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Get PDF metadata
|
|
126
191
|
|
|
127
192
|
```typescript
|
|
128
193
|
import { readFileSync } from 'fs'
|
|
@@ -134,7 +199,7 @@ const meta = pdfMetadata(pdf)
|
|
|
134
199
|
console.log(`v${meta.version}, ${meta.pageCount} pages, linearized: ${meta.isLinearized}`)
|
|
135
200
|
```
|
|
136
201
|
|
|
137
|
-
|
|
202
|
+
#### Get PDF metadata (async)
|
|
138
203
|
|
|
139
204
|
```typescript
|
|
140
205
|
import { readFile } from 'fs/promises'
|
|
@@ -146,35 +211,62 @@ const meta = await pdfMetadataAsync(pdf)
|
|
|
146
211
|
console.log(`v${meta.version}, ${meta.pageCount} pages, linearized: ${meta.isLinearized}`)
|
|
147
212
|
```
|
|
148
213
|
|
|
149
|
-
###
|
|
214
|
+
### `PdfDown` class
|
|
215
|
+
|
|
216
|
+
The class-based API parses the PDF once in the constructor. Sync methods reuse the parsed document directly (zero re-parsing). Async methods share the parsed document across libuv worker threads via `Arc` — no data copying, no re-parsing.
|
|
150
217
|
|
|
151
218
|
```typescript
|
|
152
219
|
import { readFile } from 'fs/promises'
|
|
153
|
-
import {
|
|
220
|
+
import { PdfDown } from '@d0paminedriven/pdfdown'
|
|
221
|
+
|
|
222
|
+
const pdf = new PdfDown(await readFile('document.pdf'))
|
|
223
|
+
|
|
224
|
+
// Sync — reuses the already-parsed document
|
|
225
|
+
const text = pdf.textPerPage()
|
|
226
|
+
const images = pdf.imagesPerPage()
|
|
227
|
+
const annots = pdf.annotationsPerPage()
|
|
228
|
+
const meta = pdf.metadata()
|
|
229
|
+
|
|
230
|
+
// Async — shares parsed document via Arc across worker threads
|
|
231
|
+
const [asyncText, asyncImages, asyncAnnots] = await Promise.all([
|
|
232
|
+
pdf.textPerPageAsync(),
|
|
233
|
+
pdf.imagesPerPageAsync(),
|
|
234
|
+
pdf.annotationsPerPageAsync(),
|
|
235
|
+
])
|
|
236
|
+
```
|
|
154
237
|
|
|
155
|
-
|
|
238
|
+
### Combined: text + images + links for multimodal embeddings
|
|
156
239
|
|
|
157
|
-
|
|
240
|
+
```typescript
|
|
241
|
+
import { readFile } from 'fs/promises'
|
|
242
|
+
import { PdfDown } from '@d0paminedriven/pdfdown'
|
|
158
243
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
244
|
+
const pdf = new PdfDown(await readFile('document.pdf'))
|
|
245
|
+
|
|
246
|
+
const [text, images, annots] = await Promise.all([
|
|
247
|
+
pdf.textPerPageAsync(),
|
|
248
|
+
pdf.imagesPerPageAsync(),
|
|
249
|
+
pdf.annotationsPerPageAsync(),
|
|
250
|
+
])
|
|
251
|
+
|
|
252
|
+
// Group images and links by page
|
|
253
|
+
const imagesByPage = Map.groupBy(images, (img) => img.page)
|
|
254
|
+
const linksByPage = Map.groupBy(
|
|
255
|
+
annots.filter((a) => a.uri),
|
|
256
|
+
(a) => a.page,
|
|
257
|
+
)
|
|
166
258
|
|
|
167
259
|
// Build per-page payloads for multimodal embeddings
|
|
168
260
|
for (const { page, text: pageText } of text) {
|
|
169
|
-
const pageImages = imagesByPage.get(page) ?? []
|
|
170
261
|
const payload = {
|
|
171
262
|
page,
|
|
172
263
|
text: pageText,
|
|
173
|
-
images:
|
|
264
|
+
images: (imagesByPage.get(page) ?? []).map((img) => ({
|
|
174
265
|
dataUrl: `data:image/png;base64,${img.data.toString('base64')}`,
|
|
175
266
|
width: img.width,
|
|
176
267
|
height: img.height,
|
|
177
268
|
})),
|
|
269
|
+
links: (linksByPage.get(page) ?? []).map((a) => a.uri),
|
|
178
270
|
}
|
|
179
271
|
// Send payload to Voyage AI, pgvector, etc.
|
|
180
272
|
}
|
|
@@ -185,6 +277,7 @@ for (const { page, text: pageText } of text) {
|
|
|
185
277
|
| Filter | Description | Handling |
|
|
186
278
|
| ----------- | -------------------------- | ---------------------------------- |
|
|
187
279
|
| DCTDecode | JPEG-compressed images | Decoded and re-encoded as PNG |
|
|
280
|
+
| JPXDecode | JPEG 2000 images | Decoded and re-encoded as PNG |
|
|
188
281
|
| FlateDecode | Zlib-compressed raw pixels | Decompressed, reconstructed as PNG |
|
|
189
282
|
| None | Uncompressed raw pixels | Reconstructed as PNG |
|
|
190
283
|
|
|
@@ -199,7 +292,7 @@ for (const { page, text: pageText } of text) {
|
|
|
199
292
|
|
|
200
293
|
## How it works
|
|
201
294
|
|
|
202
|
-
Built with [lopdf](https://github.com/J-F-Liu/lopdf) (pure Rust PDF parser)
|
|
295
|
+
Built with [lopdf](https://github.com/J-F-Liu/lopdf) (pure Rust PDF parser), [image](https://github.com/image-rs/image) (PNG/JPEG encoding), and [hayro-jpeg2000](https://crates.io/crates/hayro-jpeg2000) (JPEG 2000 decoding). Compiled to a native Node.js addon via [napi-rs](https://napi.rs) with prebuilt binaries for:
|
|
203
296
|
|
|
204
297
|
- macOS (x64, ARM64)
|
|
205
298
|
- Windows (x64, ia32, ARM64)
|
package/index.d.ts
CHANGED
|
@@ -6,16 +6,24 @@ export declare class PdfDown {
|
|
|
6
6
|
textPerPage(): Array<PageText>
|
|
7
7
|
/** Sync: extract images per page (reuses the already-parsed document) */
|
|
8
8
|
imagesPerPage(): Array<PageImage>
|
|
9
|
+
/** Sync: extract annotations per page (reuses the already-parsed document) */
|
|
10
|
+
annotationsPerPage(): Array<PageAnnotation>
|
|
9
11
|
/** Sync: get PDF metadata (reuses the already-parsed document) */
|
|
10
12
|
metadata(): PdfMeta
|
|
11
|
-
/** Async: extract text per page on the libuv thread pool */
|
|
13
|
+
/** Async: extract text per page on the libuv thread pool (shares parsed document via Arc) */
|
|
12
14
|
textPerPageAsync(): Promise<Array<PageText>>
|
|
13
|
-
/** Async: extract images per page on the libuv thread pool */
|
|
15
|
+
/** Async: extract images per page on the libuv thread pool (shares parsed document via Arc) */
|
|
14
16
|
imagesPerPageAsync(): Promise<Array<PageImage>>
|
|
15
|
-
/** Async:
|
|
17
|
+
/** Async: extract annotations per page on the libuv thread pool (shares parsed document via Arc) */
|
|
18
|
+
annotationsPerPageAsync(): Promise<Array<PageAnnotation>>
|
|
19
|
+
/** Async: get PDF metadata on the libuv thread pool (shares parsed document via Arc) */
|
|
16
20
|
metadataAsync(): Promise<PdfMeta>
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
export declare function extractAnnotationsPerPage(buffer: Buffer): Array<PageAnnotation>
|
|
24
|
+
|
|
25
|
+
export declare function extractAnnotationsPerPageAsync(buffer: Buffer): Promise<Array<PageAnnotation>>
|
|
26
|
+
|
|
19
27
|
export declare function extractImagesPerPage(buffer: Buffer): Array<PageImage>
|
|
20
28
|
|
|
21
29
|
export declare function extractImagesPerPageAsync(buffer: Buffer): Promise<Array<PageImage>>
|
|
@@ -24,6 +32,15 @@ export declare function extractTextPerPage(buffer: Buffer): Array<PageText>
|
|
|
24
32
|
|
|
25
33
|
export declare function extractTextPerPageAsync(buffer: Buffer): Promise<Array<PageText>>
|
|
26
34
|
|
|
35
|
+
export interface PageAnnotation {
|
|
36
|
+
page: number
|
|
37
|
+
subtype: string
|
|
38
|
+
rect: Array<number>
|
|
39
|
+
uri?: string
|
|
40
|
+
dest?: string
|
|
41
|
+
content?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
27
44
|
export interface PageImage {
|
|
28
45
|
page: number
|
|
29
46
|
imageIndex: number
|
package/index.js
CHANGED
|
@@ -80,8 +80,8 @@ function requireNative() {
|
|
|
80
80
|
try {
|
|
81
81
|
const binding = require('@d0paminedriven/pdfdown-android-arm64')
|
|
82
82
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '0.
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
83
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
85
|
}
|
|
86
86
|
return binding
|
|
87
87
|
} catch (e) {
|
|
@@ -96,8 +96,8 @@ function requireNative() {
|
|
|
96
96
|
try {
|
|
97
97
|
const binding = require('@d0paminedriven/pdfdown-android-arm-eabi')
|
|
98
98
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '0.
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
99
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
101
|
}
|
|
102
102
|
return binding
|
|
103
103
|
} catch (e) {
|
|
@@ -116,8 +116,8 @@ function requireNative() {
|
|
|
116
116
|
try {
|
|
117
117
|
const binding = require('@d0paminedriven/pdfdown-win32-x64-msvc')
|
|
118
118
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-win32-x64-msvc/package.json').version
|
|
119
|
-
if (bindingPackageVersion !== '0.
|
|
120
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
119
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
120
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
121
121
|
}
|
|
122
122
|
return binding
|
|
123
123
|
} catch (e) {
|
|
@@ -132,8 +132,8 @@ function requireNative() {
|
|
|
132
132
|
try {
|
|
133
133
|
const binding = require('@d0paminedriven/pdfdown-win32-ia32-msvc')
|
|
134
134
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-win32-ia32-msvc/package.json').version
|
|
135
|
-
if (bindingPackageVersion !== '0.
|
|
136
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
135
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
136
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
137
137
|
}
|
|
138
138
|
return binding
|
|
139
139
|
} catch (e) {
|
|
@@ -148,8 +148,8 @@ function requireNative() {
|
|
|
148
148
|
try {
|
|
149
149
|
const binding = require('@d0paminedriven/pdfdown-win32-arm64-msvc')
|
|
150
150
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-win32-arm64-msvc/package.json').version
|
|
151
|
-
if (bindingPackageVersion !== '0.
|
|
152
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
151
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
152
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
153
153
|
}
|
|
154
154
|
return binding
|
|
155
155
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@d0paminedriven/pdfdown-darwin-universal')
|
|
169
169
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-darwin-universal/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '0.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
170
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -183,8 +183,8 @@ function requireNative() {
|
|
|
183
183
|
try {
|
|
184
184
|
const binding = require('@d0paminedriven/pdfdown-darwin-x64')
|
|
185
185
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-darwin-x64/package.json').version
|
|
186
|
-
if (bindingPackageVersion !== '0.
|
|
187
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
186
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
187
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
188
188
|
}
|
|
189
189
|
return binding
|
|
190
190
|
} catch (e) {
|
|
@@ -199,8 +199,8 @@ function requireNative() {
|
|
|
199
199
|
try {
|
|
200
200
|
const binding = require('@d0paminedriven/pdfdown-darwin-arm64')
|
|
201
201
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-darwin-arm64/package.json').version
|
|
202
|
-
if (bindingPackageVersion !== '0.
|
|
203
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
202
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
204
204
|
}
|
|
205
205
|
return binding
|
|
206
206
|
} catch (e) {
|
|
@@ -219,8 +219,8 @@ function requireNative() {
|
|
|
219
219
|
try {
|
|
220
220
|
const binding = require('@d0paminedriven/pdfdown-freebsd-x64')
|
|
221
221
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-freebsd-x64/package.json').version
|
|
222
|
-
if (bindingPackageVersion !== '0.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
222
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
223
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
224
224
|
}
|
|
225
225
|
return binding
|
|
226
226
|
} catch (e) {
|
|
@@ -235,8 +235,8 @@ function requireNative() {
|
|
|
235
235
|
try {
|
|
236
236
|
const binding = require('@d0paminedriven/pdfdown-freebsd-arm64')
|
|
237
237
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-freebsd-arm64/package.json').version
|
|
238
|
-
if (bindingPackageVersion !== '0.
|
|
239
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
238
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
239
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
240
240
|
}
|
|
241
241
|
return binding
|
|
242
242
|
} catch (e) {
|
|
@@ -256,8 +256,8 @@ function requireNative() {
|
|
|
256
256
|
try {
|
|
257
257
|
const binding = require('@d0paminedriven/pdfdown-linux-x64-musl')
|
|
258
258
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-x64-musl/package.json').version
|
|
259
|
-
if (bindingPackageVersion !== '0.
|
|
260
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
259
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
260
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
261
261
|
}
|
|
262
262
|
return binding
|
|
263
263
|
} catch (e) {
|
|
@@ -272,8 +272,8 @@ function requireNative() {
|
|
|
272
272
|
try {
|
|
273
273
|
const binding = require('@d0paminedriven/pdfdown-linux-x64-gnu')
|
|
274
274
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-x64-gnu/package.json').version
|
|
275
|
-
if (bindingPackageVersion !== '0.
|
|
276
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
275
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
276
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
277
277
|
}
|
|
278
278
|
return binding
|
|
279
279
|
} catch (e) {
|
|
@@ -290,8 +290,8 @@ function requireNative() {
|
|
|
290
290
|
try {
|
|
291
291
|
const binding = require('@d0paminedriven/pdfdown-linux-arm64-musl')
|
|
292
292
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-arm64-musl/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '0.
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
293
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
295
|
}
|
|
296
296
|
return binding
|
|
297
297
|
} catch (e) {
|
|
@@ -306,8 +306,8 @@ function requireNative() {
|
|
|
306
306
|
try {
|
|
307
307
|
const binding = require('@d0paminedriven/pdfdown-linux-arm64-gnu')
|
|
308
308
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-arm64-gnu/package.json').version
|
|
309
|
-
if (bindingPackageVersion !== '0.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
309
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
310
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
311
311
|
}
|
|
312
312
|
return binding
|
|
313
313
|
} catch (e) {
|
|
@@ -324,8 +324,8 @@ function requireNative() {
|
|
|
324
324
|
try {
|
|
325
325
|
const binding = require('@d0paminedriven/pdfdown-linux-arm-musleabihf')
|
|
326
326
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-arm-musleabihf/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '0.
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
327
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
329
|
}
|
|
330
330
|
return binding
|
|
331
331
|
} catch (e) {
|
|
@@ -340,8 +340,8 @@ function requireNative() {
|
|
|
340
340
|
try {
|
|
341
341
|
const binding = require('@d0paminedriven/pdfdown-linux-arm-gnueabihf')
|
|
342
342
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-arm-gnueabihf/package.json').version
|
|
343
|
-
if (bindingPackageVersion !== '0.
|
|
344
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
343
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
344
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
345
345
|
}
|
|
346
346
|
return binding
|
|
347
347
|
} catch (e) {
|
|
@@ -358,8 +358,8 @@ function requireNative() {
|
|
|
358
358
|
try {
|
|
359
359
|
const binding = require('@d0paminedriven/pdfdown-linux-loong64-musl')
|
|
360
360
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-loong64-musl/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '0.
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
361
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
363
|
}
|
|
364
364
|
return binding
|
|
365
365
|
} catch (e) {
|
|
@@ -374,8 +374,8 @@ function requireNative() {
|
|
|
374
374
|
try {
|
|
375
375
|
const binding = require('@d0paminedriven/pdfdown-linux-loong64-gnu')
|
|
376
376
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-loong64-gnu/package.json').version
|
|
377
|
-
if (bindingPackageVersion !== '0.
|
|
378
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
377
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
378
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
379
379
|
}
|
|
380
380
|
return binding
|
|
381
381
|
} catch (e) {
|
|
@@ -392,8 +392,8 @@ function requireNative() {
|
|
|
392
392
|
try {
|
|
393
393
|
const binding = require('@d0paminedriven/pdfdown-linux-riscv64-musl')
|
|
394
394
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-riscv64-musl/package.json').version
|
|
395
|
-
if (bindingPackageVersion !== '0.
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
395
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
397
|
}
|
|
398
398
|
return binding
|
|
399
399
|
} catch (e) {
|
|
@@ -408,8 +408,8 @@ function requireNative() {
|
|
|
408
408
|
try {
|
|
409
409
|
const binding = require('@d0paminedriven/pdfdown-linux-riscv64-gnu')
|
|
410
410
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-riscv64-gnu/package.json').version
|
|
411
|
-
if (bindingPackageVersion !== '0.
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
411
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
412
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
413
413
|
}
|
|
414
414
|
return binding
|
|
415
415
|
} catch (e) {
|
|
@@ -425,8 +425,8 @@ function requireNative() {
|
|
|
425
425
|
try {
|
|
426
426
|
const binding = require('@d0paminedriven/pdfdown-linux-ppc64-gnu')
|
|
427
427
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-ppc64-gnu/package.json').version
|
|
428
|
-
if (bindingPackageVersion !== '0.
|
|
429
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
428
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
429
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
430
430
|
}
|
|
431
431
|
return binding
|
|
432
432
|
} catch (e) {
|
|
@@ -441,8 +441,8 @@ function requireNative() {
|
|
|
441
441
|
try {
|
|
442
442
|
const binding = require('@d0paminedriven/pdfdown-linux-s390x-gnu')
|
|
443
443
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-linux-s390x-gnu/package.json').version
|
|
444
|
-
if (bindingPackageVersion !== '0.
|
|
445
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
444
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
445
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
446
446
|
}
|
|
447
447
|
return binding
|
|
448
448
|
} catch (e) {
|
|
@@ -461,8 +461,8 @@ function requireNative() {
|
|
|
461
461
|
try {
|
|
462
462
|
const binding = require('@d0paminedriven/pdfdown-openharmony-arm64')
|
|
463
463
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-openharmony-arm64/package.json').version
|
|
464
|
-
if (bindingPackageVersion !== '0.
|
|
465
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
464
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
465
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
466
466
|
}
|
|
467
467
|
return binding
|
|
468
468
|
} catch (e) {
|
|
@@ -477,8 +477,8 @@ function requireNative() {
|
|
|
477
477
|
try {
|
|
478
478
|
const binding = require('@d0paminedriven/pdfdown-openharmony-x64')
|
|
479
479
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-openharmony-x64/package.json').version
|
|
480
|
-
if (bindingPackageVersion !== '0.
|
|
481
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
480
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
481
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
482
482
|
}
|
|
483
483
|
return binding
|
|
484
484
|
} catch (e) {
|
|
@@ -493,8 +493,8 @@ function requireNative() {
|
|
|
493
493
|
try {
|
|
494
494
|
const binding = require('@d0paminedriven/pdfdown-openharmony-arm')
|
|
495
495
|
const bindingPackageVersion = require('@d0paminedriven/pdfdown-openharmony-arm/package.json').version
|
|
496
|
-
if (bindingPackageVersion !== '0.
|
|
497
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
496
|
+
if (bindingPackageVersion !== '0.5.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
497
|
+
throw new Error(`Native binding package version mismatch, expected 0.5.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
498
498
|
}
|
|
499
499
|
return binding
|
|
500
500
|
} catch (e) {
|
|
@@ -558,6 +558,8 @@ if (!nativeBinding) {
|
|
|
558
558
|
|
|
559
559
|
module.exports = nativeBinding
|
|
560
560
|
module.exports.PdfDown = nativeBinding.PdfDown
|
|
561
|
+
module.exports.extractAnnotationsPerPage = nativeBinding.extractAnnotationsPerPage
|
|
562
|
+
module.exports.extractAnnotationsPerPageAsync = nativeBinding.extractAnnotationsPerPageAsync
|
|
561
563
|
module.exports.extractImagesPerPage = nativeBinding.extractImagesPerPage
|
|
562
564
|
module.exports.extractImagesPerPageAsync = nativeBinding.extractImagesPerPageAsync
|
|
563
565
|
module.exports.extractTextPerPage = nativeBinding.extractTextPerPage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d0paminedriven/pdfdown",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Rust powered PDF extraction for Node",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -116,19 +116,19 @@
|
|
|
116
116
|
},
|
|
117
117
|
"packageManager": "yarn@4.12.0",
|
|
118
118
|
"optionalDependencies": {
|
|
119
|
-
"@d0paminedriven/pdfdown-win32-x64-msvc": "0.
|
|
120
|
-
"@d0paminedriven/pdfdown-darwin-x64": "0.
|
|
121
|
-
"@d0paminedriven/pdfdown-linux-x64-gnu": "0.
|
|
122
|
-
"@d0paminedriven/pdfdown-linux-x64-musl": "0.
|
|
123
|
-
"@d0paminedriven/pdfdown-linux-arm64-gnu": "0.
|
|
124
|
-
"@d0paminedriven/pdfdown-win32-ia32-msvc": "0.
|
|
125
|
-
"@d0paminedriven/pdfdown-linux-arm-gnueabihf": "0.
|
|
126
|
-
"@d0paminedriven/pdfdown-darwin-arm64": "0.
|
|
127
|
-
"@d0paminedriven/pdfdown-android-arm64": "0.
|
|
128
|
-
"@d0paminedriven/pdfdown-freebsd-x64": "0.
|
|
129
|
-
"@d0paminedriven/pdfdown-linux-arm64-musl": "0.
|
|
130
|
-
"@d0paminedriven/pdfdown-win32-arm64-msvc": "0.
|
|
131
|
-
"@d0paminedriven/pdfdown-android-arm-eabi": "0.
|
|
132
|
-
"@d0paminedriven/pdfdown-wasm32-wasi": "0.
|
|
119
|
+
"@d0paminedriven/pdfdown-win32-x64-msvc": "0.5.0",
|
|
120
|
+
"@d0paminedriven/pdfdown-darwin-x64": "0.5.0",
|
|
121
|
+
"@d0paminedriven/pdfdown-linux-x64-gnu": "0.5.0",
|
|
122
|
+
"@d0paminedriven/pdfdown-linux-x64-musl": "0.5.0",
|
|
123
|
+
"@d0paminedriven/pdfdown-linux-arm64-gnu": "0.5.0",
|
|
124
|
+
"@d0paminedriven/pdfdown-win32-ia32-msvc": "0.5.0",
|
|
125
|
+
"@d0paminedriven/pdfdown-linux-arm-gnueabihf": "0.5.0",
|
|
126
|
+
"@d0paminedriven/pdfdown-darwin-arm64": "0.5.0",
|
|
127
|
+
"@d0paminedriven/pdfdown-android-arm64": "0.5.0",
|
|
128
|
+
"@d0paminedriven/pdfdown-freebsd-x64": "0.5.0",
|
|
129
|
+
"@d0paminedriven/pdfdown-linux-arm64-musl": "0.5.0",
|
|
130
|
+
"@d0paminedriven/pdfdown-win32-arm64-msvc": "0.5.0",
|
|
131
|
+
"@d0paminedriven/pdfdown-android-arm-eabi": "0.5.0",
|
|
132
|
+
"@d0paminedriven/pdfdown-wasm32-wasi": "0.5.0"
|
|
133
133
|
}
|
|
134
134
|
}
|