@firecrawl/pdf-inspector 1.16.0 → 1.18.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.
Files changed (4) hide show
  1. package/README.md +24 -2
  2. package/index.d.ts +109 -8
  3. package/index.js +53 -52
  4. package/package.json +7 -7
package/README.md CHANGED
@@ -90,6 +90,28 @@ console.log(result.pagesNeedingOcr) // [5, 12, 15] (0-indexed)
90
90
  console.log(result.confidence) // 0.875
91
91
  ```
92
92
 
93
+ ### `extractTextWithPositions(buffer: Buffer, pages?: number[]): TextItem[]`
94
+
95
+ Every text item (plus image placeholders, links and form fields) with its font
96
+ and position. `x`/`y` are PDF points relative to the page's **visible page
97
+ box** (`CropBox ∩ MediaBox`, else the MediaBox), origin at the box's lower-left
98
+ corner with `y` growing upward. `extractTextInRegions` reads its regions
99
+ relative to the same box but from its top-left corner with `y` growing
100
+ downward, so flip with the box height: `boxHeight - y`. For text items `y` is
101
+ the baseline and `height` the font size, so
102
+ `[x, boxHeight - y - height, x + width, boxHeight - y]` covers the glyph band
103
+ above the baseline (descenders fall below it); for image, link and form-field
104
+ items `y` is the rect bottom and that box is exact. Pages whose CropBox equals
105
+ the MediaBox at `(0, 0)` are unaffected.
106
+
107
+ ```typescript
108
+ import { extractTextWithPositions } from '@firecrawl/pdf-inspector'
109
+
110
+ for (const item of extractTextWithPositions(pdf, [1])) { // pages are 1-indexed
111
+ console.log(item.page, item.text, item.x, item.y, item.fontSize)
112
+ }
113
+ ```
114
+
93
115
  ### `extractTextInRegions(buffer: Buffer, pageRegions: PageRegions[]): PageRegionTexts[]`
94
116
 
95
117
  Extract text within bounding-box regions from a PDF. Designed for hybrid OCR pipelines where a layout model detects regions in rendered page images, and this function extracts text from the PDF structure for text-based pages — skipping GPU OCR.
@@ -103,7 +125,7 @@ const result = extractTextInRegions(pdf, [
103
125
  {
104
126
  page: 0, // 0-indexed
105
127
  regions: [
106
- [0, 0, 300, 400], // [x1, y1, x2, y2] in PDF points, top-left origin
128
+ [0, 0, 300, 400], // [x1, y1, x2, y2] in PDF points, top-left origin of the visible page box (CropBox)
107
129
  [300, 0, 612, 400],
108
130
  ]
109
131
  }
@@ -146,7 +168,7 @@ interface PdfClassification {
146
168
 
147
169
  interface PageRegions {
148
170
  page: number // 0-indexed
149
- regions: number[][] // [[x1, y1, x2, y2], ...] in PDF points, top-left origin
171
+ regions: number[][] // [[x1, y1, x2, y2], ...] in PDF points, top-left origin of the visible page box
150
172
  }
151
173
 
152
174
  interface PageRegionTexts {
package/index.d.ts CHANGED
@@ -25,7 +25,8 @@ export declare function detectPdf(buffer: Buffer): PdfResult
25
25
  * `null` when the region does not contain a valid vector grid.
26
26
  *
27
27
  * `pageIdx` is 0-indexed. `regionPdfPtBbox` is `[x1,y1,x2,y2]` in PDF
28
- * points with top-left origin. `renderDpi` is the DPI of the crop image that
28
+ * points with top-left origin, relative to the visible page box (see
29
+ * `extractTextInRegions`). `renderDpi` is the DPI of the crop image that
29
30
  * will consume the returned cell bboxes.
30
31
  */
31
32
  export declare function detectVectorGridInRegion(buffer: Buffer, pageIdx: number, regionPdfPtBbox: Array<number>, renderDpi: number): VectorGridDetectionJs | null
@@ -80,7 +81,8 @@ export declare function extractStructureElements(buffer: Buffer, pages?: Array<n
80
81
  * `needsOcr` is `false`. When no table is found, `text` is empty and
81
82
  * `needsOcr` is `true` so the caller can fall back to GPU OCR.
82
83
  *
83
- * Coordinates are PDF points with top-left origin.
84
+ * Coordinates are PDF points with top-left origin, relative to the visible
85
+ * page box (see `extractTextInRegions`).
84
86
  */
85
87
  export declare function extractTablesInRegions(buffer: Buffer, pageRegions: Array<PageRegions>): Array<PageRegionTexts>
86
88
 
@@ -136,13 +138,35 @@ export declare function extractText(buffer: Buffer): string
136
138
  * Each region result includes `needsOcr` — set when the extracted text
137
139
  * is unreliable (empty, GID-encoded fonts, garbage, encoding issues).
138
140
  *
139
- * Coordinates are PDF points with top-left origin.
141
+ * Coordinates are PDF points with top-left origin, relative to the visible
142
+ * page box (`CropBox ∩ MediaBox`, else the MediaBox) — the same box
143
+ * [`extractTextWithPositions`] reports items in, flipped to a top-left
144
+ * origin: a positioned `y` becomes `boxHeight - y`. For text items `y` is
145
+ * the baseline, so `[x, boxHeight - y - height, x + width, boxHeight - y]`
146
+ * covers the glyph band above the baseline; for image, link and form-field
147
+ * items `y` is the rect bottom and that box is exact.
140
148
  */
141
149
  export declare function extractTextInRegions(buffer: Buffer, pageRegions: Array<PageRegions>): Array<PageRegionTexts>
142
150
 
143
- /** Extract text with position information from a PDF Buffer. */
151
+ /**
152
+ * Extract text with position information from a PDF Buffer.
153
+ *
154
+ * Items are reported in PDF points relative to the page's visible page box
155
+ * (`CropBox ∩ MediaBox`, else the MediaBox) with the box's lower-left
156
+ * corner as origin — see [`TextItem`]. `pages` is 1-indexed (matching
157
+ * `TextItem.page`); omit it for the whole document.
158
+ */
144
159
  export declare function extractTextWithPositions(buffer: Buffer, pages?: Array<number> | undefined | null): Array<TextItem>
145
160
 
161
+ /**
162
+ * Extract text with positions from a PDF Buffer, together with the
163
+ * coordinate frame of every page whose text was predominantly rotated.
164
+ * Items on such a page are expressed in the turned frame (their dominant
165
+ * runs read left-to-right there); pages absent from `pageRotations` are
166
+ * upright.
167
+ */
168
+ export declare function extractTextWithPositionsAndRotations(buffer: Buffer): PositionedText
169
+
146
170
  /** Type of a positioned text item. */
147
171
  export declare const enum ItemType {
148
172
  Text = 'Text',
@@ -260,7 +284,11 @@ export interface PageOcrReasons {
260
284
  /** A page's regions for text extraction: (page_index_0based, bboxes). */
261
285
  export interface PageRegions {
262
286
  page: number
263
- /** Each bbox is [x1, y1, x2, y2] in PDF points, top-left origin. */
287
+ /**
288
+ * Each bbox is [x1, y1, x2, y2] in PDF points, top-left origin of the
289
+ * visible page box (`CropBox ∩ MediaBox`, else the MediaBox) — the
290
+ * frame of a rendered page image.
291
+ */
264
292
  regions: Array<Array<number>>
265
293
  }
266
294
 
@@ -270,6 +298,18 @@ export interface PageRegionTexts {
270
298
  regions: Array<RegionText>
271
299
  }
272
300
 
301
+ /** The coordinate frame of a page whose text was predominantly rotated. */
302
+ export interface PageRotation {
303
+ /** 1-indexed page number, matching `TextItem.page`. */
304
+ page: number
305
+ /**
306
+ * `"ccw"` when the page's runs read bottom-to-top and the frame was
307
+ * turned so they read left-to-right, `"cw"` for runs reading
308
+ * top-to-bottom.
309
+ */
310
+ rotation: string
311
+ }
312
+
273
313
  /** Combined per-page markdown extraction and layout classification result. */
274
314
  export interface PagesExtractionResult {
275
315
  /** Per-page markdown results. */
@@ -321,6 +361,16 @@ export declare const enum PdfType {
321
361
  Mixed = 'Mixed'
322
362
  }
323
363
 
364
+ /** Positioned text plus the frame of every page whose text was turned. */
365
+ export interface PositionedText {
366
+ items: Array<TextItem>
367
+ /**
368
+ * One entry per re-based page; pages absent here are upright and their
369
+ * items are in plain page coordinates.
370
+ */
371
+ pageRotations: Array<PageRotation>
372
+ }
373
+
324
374
  /** Process a PDF from a Buffer: detect type, extract text, and convert to Markdown. */
325
375
  export declare function processPdf(buffer: Buffer, pages?: Array<number> | undefined | null): PdfResult
326
376
 
@@ -366,7 +416,8 @@ export interface StructuredCellJs {
366
416
  text: string
367
417
  /**
368
418
  * Axis-aligned bbox `[x1, y1, x2, y2]` in page PDF-points, top-left
369
- * origin. Useful for debug overlays or per-cell post-processing.
419
+ * origin, relative to the visible page box (the crop's own frame).
420
+ * Useful for debug overlays or per-cell post-processing.
370
421
  */
371
422
  pagePtBbox: Array<number>
372
423
  }
@@ -405,14 +456,54 @@ export interface TableExtractionResultJs {
405
456
  fallbackReason?: string
406
457
  }
407
458
 
408
- /** A positioned text item extracted from a PDF. */
459
+ /**
460
+ * A positioned text item extracted from a PDF.
461
+ *
462
+ * `x`/`y` are PDF points relative to the page's **visible page box**
463
+ * (`CropBox ∩ MediaBox`, else the MediaBox; a CropBox that does not overlap
464
+ * the MediaBox is ignored, and a page without a MediaBox is measured against
465
+ * US Letter), origin at the box's lower-left corner with `y` growing upward.
466
+ * [`extractTextInRegions`] reads its regions relative to the same box but
467
+ * from its top-left corner with `y` growing downward; flip with the box
468
+ * height. `/Rotate` is not applied.
469
+ *
470
+ * On a page whose text is predominantly rotated the extractor turns the
471
+ * coordinate frame so that text reads left-to-right, and the shift into the
472
+ * visible page box is turned the same way; items on such a page are
473
+ * expressed in that turned frame. Use
474
+ * [`extract_text_with_positions_and_rotations`] (`extractTextWithPositionsAndRotations`
475
+ * in JavaScript) to learn which pages were turned and which way.
476
+ */
409
477
  export interface TextItem {
410
478
  text: string
479
+ /** Left edge, in PDF points from the visible page box's left edge. */
411
480
  x: number
481
+ /**
482
+ * Baseline for text (rect bottom edge for image, link and form-field
483
+ * items), in PDF points from the visible page box's bottom edge.
484
+ */
412
485
  y: number
413
486
  width: number
414
487
  height: number
488
+ /**
489
+ * Rotation of the run's baseline in degrees counter-clockwise from the
490
+ * page's x axis, in `[0, 360)`: `0` for ordinary horizontal text, `90`
491
+ * for text reading bottom-to-top (a rotated margin stamp), `270` for
492
+ * top-to-bottom, `180` for upside-down. `x`/`y`/`width`/`height` is the
493
+ * run's axis-aligned box, so a vertical run is tall and thin (height
494
+ * ≫ width) instead of zero-width.
495
+ */
496
+ rotation: number
497
+ /**
498
+ * Whether the run's advance came from font metrics. `false` when the
499
+ * font carries no width information (or an ActualText span's advance
500
+ * could not be recovered): the box's extent along the baseline is then
501
+ * an estimate of half an em per painted glyph (an ActualText span counts
502
+ * the glyphs it covers, not its replacement text), not a measurement.
503
+ */
504
+ advanceKnown: boolean
415
505
  font: string
506
+ fontTag: string
416
507
  fontSize: number
417
508
  page: number
418
509
  isBold: boolean
@@ -427,6 +518,15 @@ export interface TextItem {
427
518
  * x-height).
428
519
  */
429
520
  isStrikeout: boolean
521
+ /**
522
+ * Signed baseline offset (PDF points, y-up) of a super/subscript glyph
523
+ * run from the body baseline it is attached to; `0` for normal text.
524
+ * Positive = raised (superscript: footnote/affiliation markers,
525
+ * exponents), negative = lowered (subscript). Emit `<sup>`/`<sub>` from
526
+ * the sign. Digit-only markers beside a word are already fused into it
527
+ * as Unicode super/subscript characters ("word²") and carry `0`.
528
+ */
529
+ baselineShift: number
430
530
  itemType: ItemType
431
531
  /** URL for link items, `None` for other types. */
432
532
  linkUrl?: string
@@ -453,7 +553,8 @@ export interface TsrTableInputJs {
453
553
  page: number
454
554
  /**
455
555
  * Crop bbox on the page, `[x1, y1, x2, y2]` in PDF points with
456
- * top-left origin.
556
+ * top-left origin, relative to the visible page box (see
557
+ * `extractTextInRegions`).
457
558
  */
458
559
  cropPdfPtBbox: Array<number>
459
560
  /** DPI the crop image was rendered at (e.g. `200.0`). */
package/index.js CHANGED
@@ -77,8 +77,8 @@ function requireNative() {
77
77
  try {
78
78
  const binding = require('@firecrawl/pdf-inspector-android-arm64')
79
79
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
82
  }
83
83
  return binding
84
84
  } catch (e) {
@@ -93,8 +93,8 @@ function requireNative() {
93
93
  try {
94
94
  const binding = require('@firecrawl/pdf-inspector-android-arm-eabi')
95
95
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
98
  }
99
99
  return binding
100
100
  } catch (e) {
@@ -114,8 +114,8 @@ function requireNative() {
114
114
  try {
115
115
  const binding = require('@firecrawl/pdf-inspector-win32-x64-gnu')
116
116
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
119
  }
120
120
  return binding
121
121
  } catch (e) {
@@ -130,8 +130,8 @@ function requireNative() {
130
130
  try {
131
131
  const binding = require('@firecrawl/pdf-inspector-win32-x64-msvc')
132
132
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
135
135
  }
136
136
  return binding
137
137
  } catch (e) {
@@ -147,8 +147,8 @@ function requireNative() {
147
147
  try {
148
148
  const binding = require('@firecrawl/pdf-inspector-win32-ia32-msvc')
149
149
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
152
  }
153
153
  return binding
154
154
  } catch (e) {
@@ -163,8 +163,8 @@ function requireNative() {
163
163
  try {
164
164
  const binding = require('@firecrawl/pdf-inspector-win32-arm64-msvc')
165
165
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
168
  }
169
169
  return binding
170
170
  } catch (e) {
@@ -182,8 +182,8 @@ function requireNative() {
182
182
  try {
183
183
  const binding = require('@firecrawl/pdf-inspector-darwin-universal')
184
184
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
187
  }
188
188
  return binding
189
189
  } catch (e) {
@@ -198,8 +198,8 @@ function requireNative() {
198
198
  try {
199
199
  const binding = require('@firecrawl/pdf-inspector-darwin-x64')
200
200
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
203
  }
204
204
  return binding
205
205
  } catch (e) {
@@ -214,8 +214,8 @@ function requireNative() {
214
214
  try {
215
215
  const binding = require('@firecrawl/pdf-inspector-darwin-arm64')
216
216
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
219
  }
220
220
  return binding
221
221
  } catch (e) {
@@ -234,8 +234,8 @@ function requireNative() {
234
234
  try {
235
235
  const binding = require('@firecrawl/pdf-inspector-freebsd-x64')
236
236
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
239
  }
240
240
  return binding
241
241
  } catch (e) {
@@ -250,8 +250,8 @@ function requireNative() {
250
250
  try {
251
251
  const binding = require('@firecrawl/pdf-inspector-freebsd-arm64')
252
252
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
255
  }
256
256
  return binding
257
257
  } catch (e) {
@@ -271,8 +271,8 @@ function requireNative() {
271
271
  try {
272
272
  const binding = require('@firecrawl/pdf-inspector-linux-x64-musl')
273
273
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
276
  }
277
277
  return binding
278
278
  } catch (e) {
@@ -287,8 +287,8 @@ function requireNative() {
287
287
  try {
288
288
  const binding = require('@firecrawl/pdf-inspector-linux-x64-gnu')
289
289
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
292
  }
293
293
  return binding
294
294
  } catch (e) {
@@ -305,8 +305,8 @@ function requireNative() {
305
305
  try {
306
306
  const binding = require('@firecrawl/pdf-inspector-linux-arm64-musl')
307
307
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
310
  }
311
311
  return binding
312
312
  } catch (e) {
@@ -321,8 +321,8 @@ function requireNative() {
321
321
  try {
322
322
  const binding = require('@firecrawl/pdf-inspector-linux-arm64-gnu')
323
323
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
326
  }
327
327
  return binding
328
328
  } catch (e) {
@@ -339,8 +339,8 @@ function requireNative() {
339
339
  try {
340
340
  const binding = require('@firecrawl/pdf-inspector-linux-arm-musleabihf')
341
341
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
344
  }
345
345
  return binding
346
346
  } catch (e) {
@@ -355,8 +355,8 @@ function requireNative() {
355
355
  try {
356
356
  const binding = require('@firecrawl/pdf-inspector-linux-arm-gnueabihf')
357
357
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
360
  }
361
361
  return binding
362
362
  } catch (e) {
@@ -373,8 +373,8 @@ function requireNative() {
373
373
  try {
374
374
  const binding = require('@firecrawl/pdf-inspector-linux-loong64-musl')
375
375
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
378
  }
379
379
  return binding
380
380
  } catch (e) {
@@ -389,8 +389,8 @@ function requireNative() {
389
389
  try {
390
390
  const binding = require('@firecrawl/pdf-inspector-linux-loong64-gnu')
391
391
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
394
  }
395
395
  return binding
396
396
  } catch (e) {
@@ -407,8 +407,8 @@ function requireNative() {
407
407
  try {
408
408
  const binding = require('@firecrawl/pdf-inspector-linux-riscv64-musl')
409
409
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
412
  }
413
413
  return binding
414
414
  } catch (e) {
@@ -423,8 +423,8 @@ function requireNative() {
423
423
  try {
424
424
  const binding = require('@firecrawl/pdf-inspector-linux-riscv64-gnu')
425
425
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
428
  }
429
429
  return binding
430
430
  } catch (e) {
@@ -440,8 +440,8 @@ function requireNative() {
440
440
  try {
441
441
  const binding = require('@firecrawl/pdf-inspector-linux-ppc64-gnu')
442
442
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
445
  }
446
446
  return binding
447
447
  } catch (e) {
@@ -456,8 +456,8 @@ function requireNative() {
456
456
  try {
457
457
  const binding = require('@firecrawl/pdf-inspector-linux-s390x-gnu')
458
458
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
461
  }
462
462
  return binding
463
463
  } catch (e) {
@@ -476,8 +476,8 @@ function requireNative() {
476
476
  try {
477
477
  const binding = require('@firecrawl/pdf-inspector-openharmony-arm64')
478
478
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
481
  }
482
482
  return binding
483
483
  } catch (e) {
@@ -492,8 +492,8 @@ function requireNative() {
492
492
  try {
493
493
  const binding = require('@firecrawl/pdf-inspector-openharmony-x64')
494
494
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
497
  }
498
498
  return binding
499
499
  } catch (e) {
@@ -508,8 +508,8 @@ function requireNative() {
508
508
  try {
509
509
  const binding = require('@firecrawl/pdf-inspector-openharmony-arm')
510
510
  const bindingPackageVersion = require('@firecrawl/pdf-inspector-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '1.16.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 1.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '1.18.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 1.18.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
513
  }
514
514
  return binding
515
515
  } catch (e) {
@@ -590,6 +590,7 @@ module.exports.extractTablesWithStructureCells = nativeBinding.extractTablesWith
590
590
  module.exports.extractText = nativeBinding.extractText
591
591
  module.exports.extractTextInRegions = nativeBinding.extractTextInRegions
592
592
  module.exports.extractTextWithPositions = nativeBinding.extractTextWithPositions
593
+ module.exports.extractTextWithPositionsAndRotations = nativeBinding.extractTextWithPositionsAndRotations
593
594
  module.exports.ItemType = nativeBinding.ItemType
594
595
  module.exports.OcrMode = nativeBinding.OcrMode
595
596
  module.exports.PageContentSource = nativeBinding.PageContentSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecrawl/pdf-inspector",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Fast PDF classification and text extraction. Detect text-based vs scanned PDFs, extract text by region with quality checks. Native Rust performance via napi-rs.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -52,11 +52,11 @@
52
52
  "@napi-rs/cli": "^3.4.1"
53
53
  },
54
54
  "optionalDependencies": {
55
- "@firecrawl/pdf-inspector-linux-x64-gnu": "1.16.0",
56
- "@firecrawl/pdf-inspector-linux-x64-musl": "1.16.0",
57
- "@firecrawl/pdf-inspector-linux-arm64-gnu": "1.16.0",
58
- "@firecrawl/pdf-inspector-linux-arm64-musl": "1.16.0",
59
- "@firecrawl/pdf-inspector-darwin-arm64": "1.16.0",
60
- "@firecrawl/pdf-inspector-win32-x64-msvc": "1.16.0"
55
+ "@firecrawl/pdf-inspector-linux-x64-gnu": "1.18.0",
56
+ "@firecrawl/pdf-inspector-linux-x64-musl": "1.18.0",
57
+ "@firecrawl/pdf-inspector-linux-arm64-gnu": "1.18.0",
58
+ "@firecrawl/pdf-inspector-linux-arm64-musl": "1.18.0",
59
+ "@firecrawl/pdf-inspector-darwin-arm64": "1.18.0",
60
+ "@firecrawl/pdf-inspector-win32-x64-msvc": "1.18.0"
61
61
  }
62
62
  }