@d0paminedriven/pdfdown-ocr 0.9.6 → 0.9.8

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.
Files changed (3) hide show
  1. package/index.d.ts +34 -17
  2. package/index.js +53 -50
  3. package/package.json +5 -5
package/index.d.ts CHANGED
@@ -2,38 +2,23 @@
2
2
  /* eslint-disable */
3
3
  export declare class PdfDown {
4
4
  constructor(buffer: Buffer)
5
- /** Sync: extract text per page (reuses the already-parsed document) */
6
5
  textPerPage(): Array<PageText>
7
- /** Sync: extract images per page (reuses the already-parsed document) */
8
6
  imagesPerPage(): Array<PageImage>
9
- /** Sync: extract annotations per page (reuses the already-parsed document) */
10
7
  annotationsPerPage(): Array<PageAnnotation>
11
- /** Sync: get PDF metadata (reuses the already-parsed document) */
12
8
  metadata(): PdfMeta
13
- /** Async: extract text per page on the libuv thread pool (shares parsed document via Arc) */
14
9
  textPerPageAsync(): Promise<Array<PageText>>
15
- /** Async: extract images per page on the libuv thread pool (shares parsed document via Arc) */
16
10
  imagesPerPageAsync(): Promise<Array<PageImage>>
17
- /** Async: extract annotations per page on the libuv thread pool (shares parsed document via Arc) */
18
11
  annotationsPerPageAsync(): Promise<Array<PageAnnotation>>
19
- /** Async: get PDF metadata on the libuv thread pool (shares parsed document via Arc) */
20
12
  metadataAsync(): Promise<PdfMeta>
21
- /** Sync: extract everything from the PDF in one call (reuses the already-parsed document) */
22
13
  document(): PdfDocument
23
- /** Async: extract everything from the PDF on the libuv thread pool (shares parsed document via Arc) */
24
14
  documentAsync(): Promise<PdfDocument>
25
- /** Sync: extract structured text with header/footer detection */
26
15
  structuredText(): Array<StructuredPageText>
27
- /** Async: extract structured text with header/footer detection */
28
16
  structuredTextAsync(): Promise<Array<StructuredPageText>>
29
- /** Sync: extract text with OCR fallback for image-only pages */
30
17
  textWithOcrPerPage(opts?: OcrOptions | undefined | null): Array<OcrPageText>
31
- /** Async: extract text with OCR fallback for image-only pages */
32
18
  textWithOcrPerPageAsync(opts?: OcrOptions | undefined | null): Promise<Array<OcrPageText>>
33
- /** Sync: extract everything from the PDF with OCR text fallback */
34
19
  documentOcr(opts?: OcrOptions | undefined | null): PdfDocumentOcr
35
- /** Async: extract everything from the PDF with OCR text fallback */
36
20
  documentOcrAsync(opts?: OcrOptions | undefined | null): Promise<PdfDocumentOcr>
21
+ renderPagesAsync(opts?: RenderOptions | undefined | null): Promise<Array<RenderedPage>>
37
22
  }
38
23
 
39
24
  export declare const enum BoxType {
@@ -42,6 +27,13 @@ export declare const enum BoxType {
42
27
  Unknown = 'Unknown'
43
28
  }
44
29
 
30
+ export declare function capabilities(): Capabilities
31
+
32
+ export interface Capabilities {
33
+ ocr: boolean
34
+ render: boolean
35
+ }
36
+
45
37
  export declare function extractAnnotationsPerPage(buffer: Buffer): Array<PageAnnotation>
46
38
 
47
39
  export declare function extractAnnotationsPerPageAsync(buffer: Buffer): Promise<Array<PageAnnotation>>
@@ -66,6 +58,9 @@ export interface OcrOptions {
66
58
  lang?: string
67
59
  minTextLength?: number
68
60
  maxThreads?: number
61
+ render?: RenderMode
62
+ renderDpi?: number
63
+ pdfiumPath?: string
69
64
  }
70
65
 
71
66
  export interface OcrPageText {
@@ -188,6 +183,27 @@ export declare function pdfMetadata(buffer: Buffer): PdfMeta
188
183
 
189
184
  export declare function pdfMetadataAsync(buffer: Buffer): Promise<PdfMeta>
190
185
 
186
+ export interface RenderedPage {
187
+ page: number
188
+ width: number
189
+ height: number
190
+ dpi: number
191
+ data: Buffer
192
+ }
193
+
194
+ export declare const enum RenderMode {
195
+ Auto = 'Auto',
196
+ Never = 'Never',
197
+ Always = 'Always'
198
+ }
199
+
200
+ export interface RenderOptions {
201
+ dpi?: number
202
+ mode?: RenderMode
203
+ }
204
+
205
+ export declare function renderPagesAsync(buffer: Buffer, opts?: RenderOptions | undefined | null): Promise<Array<RenderedPage>>
206
+
191
207
  export interface StructuredPageText {
192
208
  page: number
193
209
  header: string
@@ -197,5 +213,6 @@ export interface StructuredPageText {
197
213
 
198
214
  export declare const enum TextSource {
199
215
  Native = 'Native',
200
- Ocr = 'Ocr'
216
+ Ocr = 'Ocr',
217
+ Rendered = 'Rendered'
201
218
  }
package/index.js CHANGED
@@ -80,8 +80,8 @@ function requireNative() {
80
80
  try {
81
81
  const binding = require('@d0paminedriven/pdfdown-ocr-android-arm64')
82
82
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
83
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-android-arm-eabi')
98
98
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
99
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-win32-x64-msvc')
118
118
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-win32-ia32-msvc')
134
134
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-win32-arm64-msvc')
150
150
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
151
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-darwin-universal')
169
169
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
170
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-darwin-x64')
185
185
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
186
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-darwin-arm64')
201
201
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-freebsd-x64')
221
221
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
222
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-freebsd-arm64')
237
237
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
238
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-x64-musl')
258
258
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-x64-gnu')
274
274
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
275
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-arm64-musl')
292
292
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
293
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-arm64-gnu')
308
308
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
309
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-arm-musleabihf')
326
326
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
327
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-arm-gnueabihf')
342
342
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
343
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-loong64-musl')
360
360
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-loong64-musl/package.json').version
361
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
361
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-loong64-gnu')
376
376
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-loong64-gnu/package.json').version
377
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
377
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-riscv64-musl')
394
394
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-riscv64-musl/package.json').version
395
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
395
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-riscv64-gnu')
410
410
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-riscv64-gnu/package.json').version
411
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-ppc64-gnu')
427
427
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-ppc64-gnu/package.json').version
428
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-linux-s390x-gnu')
443
443
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-linux-s390x-gnu/package.json').version
444
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
444
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-openharmony-arm64')
463
463
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-openharmony-arm64/package.json').version
464
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-openharmony-x64')
479
479
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-openharmony-x64/package.json').version
480
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
480
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 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-ocr-openharmony-arm')
495
495
  const bindingPackageVersion = require('@d0paminedriven/pdfdown-ocr-openharmony-arm/package.json').version
496
- if (bindingPackageVersion !== '0.9.6' && 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.9.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
496
+ if (bindingPackageVersion !== '0.9.8' && 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.9.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
498
498
  }
499
499
  return binding
500
500
  } catch (e) {
@@ -559,6 +559,7 @@ if (!nativeBinding) {
559
559
  module.exports = nativeBinding
560
560
  module.exports.PdfDown = nativeBinding.PdfDown
561
561
  module.exports.BoxType = nativeBinding.BoxType
562
+ module.exports.capabilities = nativeBinding.capabilities
562
563
  module.exports.extractAnnotationsPerPage = nativeBinding.extractAnnotationsPerPage
563
564
  module.exports.extractAnnotationsPerPageAsync = nativeBinding.extractAnnotationsPerPageAsync
564
565
  module.exports.extractImagesPerPage = nativeBinding.extractImagesPerPage
@@ -575,4 +576,6 @@ module.exports.pdfDocumentOcr = nativeBinding.pdfDocumentOcr
575
576
  module.exports.pdfDocumentOcrAsync = nativeBinding.pdfDocumentOcrAsync
576
577
  module.exports.pdfMetadata = nativeBinding.pdfMetadata
577
578
  module.exports.pdfMetadataAsync = nativeBinding.pdfMetadataAsync
579
+ module.exports.RenderMode = nativeBinding.RenderMode
580
+ module.exports.renderPagesAsync = nativeBinding.renderPagesAsync
578
581
  module.exports.TextSource = nativeBinding.TextSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d0paminedriven/pdfdown-ocr",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "Rust powered PDF extraction for Node with OCR fallback (requires system tesseract).",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -34,9 +34,9 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@d0paminedriven/pdfdown-ocr-darwin-x64": "0.9.6",
38
- "@d0paminedriven/pdfdown-ocr-darwin-arm64": "0.9.6",
39
- "@d0paminedriven/pdfdown-ocr-linux-x64-gnu": "0.9.6",
40
- "@d0paminedriven/pdfdown-ocr-linux-arm64-gnu": "0.9.6"
37
+ "@d0paminedriven/pdfdown-ocr-darwin-x64": "0.9.8",
38
+ "@d0paminedriven/pdfdown-ocr-darwin-arm64": "0.9.8",
39
+ "@d0paminedriven/pdfdown-ocr-linux-x64-gnu": "0.9.8",
40
+ "@d0paminedriven/pdfdown-ocr-linux-arm64-gnu": "0.9.8"
41
41
  }
42
42
  }