@d0paminedriven/pdfdown-ocr 0.12.0 → 0.13.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/index.d.ts CHANGED
@@ -1,70 +1,59 @@
1
- /* auto-generated by NAPI-RS */
2
-
1
+ /* auto-generated by @d0paminedriven/pdfdown-ocr */
3
2
  /**
4
3
  * Which binding artifact the generated loader actually loaded: `'native'` for
5
4
  * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
6
5
  * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
7
6
  * can point the loader at a WASI artifact this package does not build itself.
8
7
  */
9
- export declare const __napiBindingTarget: "native" | "wasm32-wasi" | "wasm32-wasip1";
8
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
10
9
 
11
10
  export declare class PdfDown {
12
- constructor(buffer: Buffer);
13
- /** Open a PDF or a workbook off the JavaScript thread; resolves to a `PdfDown`. */
14
- static openAsync(buffer: Buffer): Promise<PdfDown>;
15
- /** The format this document was opened as. */
16
- get format(): DocumentFormat;
17
- /** The cells of a workbook's selected sheets, typed, with their display text and formulas. */
18
- spreadsheetCells(opts?: SpreadsheetOptions | undefined | null): Array<SheetCells>;
19
- spreadsheetCellsAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<SheetCells>>;
20
- textPerPage(): Array<PageText>;
21
- imagesPerPage(): Array<PageImage>;
22
- annotationsPerPage(): Array<PageAnnotation>;
23
- metadata(): PdfMeta;
24
- /**
25
- * Positioned words and lines per page: a PDF's content stream (native text only), or one
26
- * logical page per selected sheet of a workbook, where `opts` picks the sheets and whether
27
- * hidden rows and columns keep their extents. A PDF ignores `opts`.
28
- */
29
- layout(opts?: SpreadsheetOptions | undefined | null): Array<PageLayout>;
30
- layoutAsync(opts?: SpreadsheetOptions | undefined | null): Promise<Array<PageLayout>>;
31
- attachments(): Array<Attachment>;
32
- attachmentsAsync(): Promise<Array<Attachment>>;
11
+ constructor(buffer: Buffer)
12
+ /** Open a PDF off the JavaScript thread; resolves to a `PdfDown`. */
13
+ static openAsync(buffer: Buffer): Promise<PdfDown>
14
+ textPerPage(): Array<PageText>
15
+ imagesPerPage(): Array<PageImage>
16
+ annotationsPerPage(): Array<PageAnnotation>
17
+ metadata(): PdfMeta
18
+ /** Positioned words and lines per page, from the page's content stream (native text only). */
19
+ layout(): Array<PageLayout>
20
+ layoutAsync(): Promise<Array<PageLayout>>
21
+ attachments(): Array<Attachment>
22
+ attachmentsAsync(): Promise<Array<Attachment>>
33
23
  /**
34
- * Structured invoice data. A PDF reads its embedded Factur-X / ZUGFeRD / XRechnung / UBL
35
- * XML; a workbook returns `source: "None"` with a warning until the layout-based engine
36
- * reads spreadsheet pages.
24
+ * Structured invoice data: the embedded Factur-X / ZUGFeRD / XRechnung / UBL XML when the
25
+ * document carries it, else the fields read from the pages.
37
26
  */
38
- invoice(opts?: InvoiceOptions | undefined | null): InvoiceResult;
39
- invoiceAsync(opts?: InvoiceOptions | undefined | null): Promise<InvoiceResult>;
40
- textPerPageAsync(): Promise<Array<PageText>>;
41
- imagesPerPageAsync(): Promise<Array<PageImage>>;
42
- annotationsPerPageAsync(): Promise<Array<PageAnnotation>>;
43
- metadataAsync(): Promise<PdfMeta>;
44
- document(): PdfDocument;
45
- documentAsync(): Promise<PdfDocument>;
46
- structuredText(): Array<StructuredPageText>;
47
- structuredTextAsync(): Promise<Array<StructuredPageText>>;
48
- formFieldsPerPage(): Array<PageFormField>;
49
- formFieldsPerPageAsync(): Promise<Array<PageFormField>>;
50
- textWithOcrPerPage(opts?: OcrOptions | undefined | null): Array<OcrPageText>;
51
- textWithOcrPerPageAsync(opts?: OcrOptions | undefined | null): Promise<Array<OcrPageText>>;
27
+ invoice(opts?: InvoiceOptions | undefined | null): InvoiceResult
28
+ invoiceAsync(opts?: InvoiceOptions | undefined | null): Promise<InvoiceResult>
29
+ textPerPageAsync(): Promise<Array<PageText>>
30
+ imagesPerPageAsync(): Promise<Array<PageImage>>
31
+ annotationsPerPageAsync(): Promise<Array<PageAnnotation>>
32
+ metadataAsync(): Promise<PdfMeta>
33
+ document(): PdfDocument
34
+ documentAsync(): Promise<PdfDocument>
35
+ structuredText(): Array<StructuredPageText>
36
+ structuredTextAsync(): Promise<Array<StructuredPageText>>
37
+ formFieldsPerPage(): Array<PageFormField>
38
+ formFieldsPerPageAsync(): Promise<Array<PageFormField>>
39
+ textWithOcrPerPage(opts?: OcrOptions | undefined | null): Array<OcrPageText>
40
+ textWithOcrPerPageAsync(opts?: OcrOptions | undefined | null): Promise<Array<OcrPageText>>
52
41
  /** Positioned words and lines per page with the OCR cascade. */
53
- layoutWithOcr(opts?: OcrOptions | undefined | null): Array<PageLayout>;
54
- layoutWithOcrAsync(opts?: OcrOptions | undefined | null): Promise<Array<PageLayout>>;
55
- documentOcr(opts?: OcrOptions | undefined | null): PdfDocumentOcr;
56
- documentOcrAsync(opts?: OcrOptions | undefined | null): Promise<PdfDocumentOcr>;
57
- renderPagesAsync(opts?: RenderOptions | undefined | null): Promise<Array<RenderedPage>>;
42
+ layoutWithOcr(opts?: OcrOptions | undefined | null): Array<PageLayout>
43
+ layoutWithOcrAsync(opts?: OcrOptions | undefined | null): Promise<Array<PageLayout>>
44
+ documentOcr(opts?: OcrOptions | undefined | null): PdfDocumentOcr
45
+ documentOcrAsync(opts?: OcrOptions | undefined | null): Promise<PdfDocumentOcr>
46
+ renderPagesAsync(opts?: RenderOptions | undefined | null): Promise<Array<RenderedPage>>
58
47
  }
59
48
 
60
49
  /** `value` is `lines` joined with `
61
50
  `. */
62
51
  export interface AddressField {
63
- value: string;
64
- text: string;
65
- confidence: number;
66
- span?: FieldSpan;
67
- lines: Array<string>;
52
+ value: string
53
+ text: string
54
+ confidence: number
55
+ span?: FieldSpan
56
+ lines: Array<string>
68
57
  }
69
58
 
70
59
  /**
@@ -75,16 +64,16 @@ export interface AddressField {
75
64
  */
76
65
  export interface AircraftReference {
77
66
  /** Airframe model, e.g. "Challenger 350", "Global 6000", "Phenom 300". */
78
- model?: StringField;
67
+ model?: StringField
79
68
  /** Manufacturer serial number (MSN). */
80
- serialNumber?: StringField;
69
+ serialNumber?: StringField
81
70
  /** Registration / tail number, e.g. "N123AB", "C-GXYZ". */
82
- registration?: StringField;
71
+ registration?: StringField
83
72
  /** Engine model, e.g. "BR710", "AE 3007", "PW308C". */
84
- engineModel?: StringField;
73
+ engineModel?: StringField
85
74
  /** Engine serial number (ESN). */
86
- engineSerialNumber?: StringField;
87
- span?: FieldSpan;
75
+ engineSerialNumber?: StringField
76
+ span?: FieldSpan
88
77
  }
89
78
 
90
79
  /**
@@ -92,153 +81,115 @@ export interface AircraftReference {
92
81
  * `/AF` associated file, or a page-level `/FileAttachment` annotation.
93
82
  */
94
83
  export interface Attachment {
95
- name: string;
84
+ name: string
96
85
  /** From the embedded file stream's `/Subtype`, e.g. `text/xml`. */
97
- mimeType?: string;
86
+ mimeType?: string
98
87
  /** Decoded payload size in bytes. */
99
- size: number;
88
+ size: number
100
89
  /** `/AFRelationship`: `Source`, `Data`, `Alternative`, `Supplement`, ... */
101
- relationship?: string;
102
- description?: string;
90
+ relationship?: string
91
+ description?: string
103
92
  /** 1-based page for a `/FileAttachment` annotation; absent for document-level files. */
104
- page?: number;
105
- data: Buffer;
93
+ page?: number
94
+ data: Buffer
106
95
  }
107
96
 
108
97
  /** Every embedded file: `/Names /EmbeddedFiles`, catalog `/AF`, and page `/FileAttachment` annotations. */
109
- export declare function attachments(buffer: Buffer): Array<Attachment>;
98
+ export declare function attachments(buffer: Buffer): Array<Attachment>
110
99
 
111
- export declare function attachmentsAsync(buffer: Buffer): Promise<Array<Attachment>>;
100
+ export declare function attachmentsAsync(buffer: Buffer): Promise<Array<Attachment>>
112
101
 
113
- export type BoxType = "CropBox" | "MediaBox" | "Unknown";
102
+ export type BoxType = 'CropBox' | 'MediaBox' | 'Unknown'
114
103
 
115
- export declare function capabilities(): Capabilities;
104
+ export declare function capabilities(): Capabilities
116
105
 
117
106
  export interface Capabilities {
118
- ocr: boolean;
119
- render: boolean;
120
- }
121
-
122
- /** A rectangle in the sheet frame: points, y up, with A1's top-left corner at `(0, height)`. */
123
- export interface CellBox {
124
- x0: number;
125
- y0: number;
126
- x1: number;
127
- y1: number;
107
+ ocr: boolean
108
+ render: boolean
128
109
  }
129
110
 
130
111
  export interface ChoiceOption {
131
- exportValue: string;
132
- displayValue: string;
112
+ exportValue: string
113
+ displayValue: string
133
114
  }
134
115
 
135
116
  /**
136
117
  * Which tier named the currency: evidence on the page (an ISO code or an unambiguous glyph),
137
118
  * content priors such as the vendor's country, the caller's option, or nothing.
138
119
  */
139
- export type CurrencySource = "Page" | "Content" | "Option" | "Unknown";
120
+ export type CurrencySource = 'Page' | 'Content' | 'Option' | 'Unknown'
140
121
 
141
122
  /** `value` is an ISO 8601 calendar date, `YYYY-MM-DD`. */
142
123
  export interface DateField {
143
- value: string;
144
- text: string;
145
- confidence: number;
146
- span?: FieldSpan;
124
+ value: string
125
+ text: string
126
+ confidence: number
127
+ span?: FieldSpan
147
128
  }
148
129
 
149
- export type DateOrder = "Auto" | "MDY" | "DMY" | "YMD";
130
+ export type DateOrder = 'Auto' | 'MDY' | 'DMY' | 'YMD'
150
131
 
151
- /** `Pdf`, `Xlsx`, or `Unknown` with what the buffer was instead. */
152
- export declare function detectFormat(buffer: Buffer): FormatDetection;
153
-
154
- /** `detectFormat` off the JavaScript thread: a zip's package directory is read to name it. */
155
- export declare function detectFormatAsync(buffer: Buffer): Promise<FormatDetection>;
156
-
157
- /** What `detectFormat` and `PdfDown` recognise. */
158
- export type DocumentFormat = "Pdf" | "Xlsx" | "Unknown";
159
-
160
- export type EInvoiceStandard = "FacturX" | "ZUGFeRD" | "XRechnung" | "UBL" | "Unknown";
132
+ export type EInvoiceStandard = 'FacturX' | 'ZUGFeRD' | 'XRechnung' | 'UBL' | 'Unknown'
161
133
 
162
134
  export interface EmbeddedInvoiceXml {
163
- filename: string;
164
- standard: EInvoiceStandard;
135
+ filename: string
136
+ standard: EInvoiceStandard
165
137
  /**
166
138
  * The guideline / customization identifier, e.g.
167
139
  * `urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic`.
168
140
  */
169
- profile?: string;
170
- xml: string;
141
+ profile?: string
142
+ xml: string
171
143
  }
172
144
 
173
- export declare function extractAnnotationsPerPage(buffer: Buffer): Array<PageAnnotation>;
145
+ export declare function extractAnnotationsPerPage(buffer: Buffer): Array<PageAnnotation>
174
146
 
175
- export declare function extractAnnotationsPerPageAsync(buffer: Buffer): Promise<Array<PageAnnotation>>;
147
+ export declare function extractAnnotationsPerPageAsync(buffer: Buffer): Promise<Array<PageAnnotation>>
176
148
 
177
- export declare function extractFormFieldsPerPage(buffer: Buffer): Array<PageFormField>;
149
+ export declare function extractFormFieldsPerPage(buffer: Buffer): Array<PageFormField>
178
150
 
179
- export declare function extractFormFieldsPerPageAsync(buffer: Buffer): Promise<Array<PageFormField>>;
151
+ export declare function extractFormFieldsPerPageAsync(buffer: Buffer): Promise<Array<PageFormField>>
180
152
 
181
- export declare function extractImagesPerPage(buffer: Buffer): Array<PageImage>;
153
+ export declare function extractImagesPerPage(buffer: Buffer): Array<PageImage>
182
154
 
183
- export declare function extractImagesPerPageAsync(buffer: Buffer): Promise<Array<PageImage>>;
155
+ export declare function extractImagesPerPageAsync(buffer: Buffer): Promise<Array<PageImage>>
184
156
 
185
157
  /**
186
158
  * Structured invoice data. This version reads embedded Factur-X / ZUGFeRD /
187
159
  * XRechnung / UBL XML; documents without it return `source: "None"`.
188
160
  */
189
- export declare function extractInvoice(buffer: Buffer, opts?: InvoiceOptions | undefined | null): InvoiceResult;
161
+ export declare function extractInvoice(buffer: Buffer, opts?: InvoiceOptions | undefined | null): InvoiceResult
190
162
 
191
- export declare function extractInvoiceAsync(
192
- buffer: Buffer,
193
- opts?: InvoiceOptions | undefined | null
194
- ): Promise<InvoiceResult>;
163
+ export declare function extractInvoiceAsync(buffer: Buffer, opts?: InvoiceOptions | undefined | null): Promise<InvoiceResult>
195
164
 
196
165
  /**
197
166
  * Positioned words and lines per page with the OCR cascade: native glyph
198
167
  * placement, then OCR of embedded images mapped through their placements,
199
- * then (with PDFium) OCR of the rasterised page.
168
+ * then (with PDFium) OCR of the rasterized page.
200
169
  */
201
- export declare function extractLayoutWithOcrPerPage(
202
- buffer: Buffer,
203
- opts?: OcrOptions | undefined | null
204
- ): Array<PageLayout>;
170
+ export declare function extractLayoutWithOcrPerPage(buffer: Buffer, opts?: OcrOptions | undefined | null): Array<PageLayout>
205
171
 
206
- export declare function extractLayoutWithOcrPerPageAsync(
207
- buffer: Buffer,
208
- opts?: OcrOptions | undefined | null
209
- ): Promise<Array<PageLayout>>;
172
+ export declare function extractLayoutWithOcrPerPageAsync(buffer: Buffer, opts?: OcrOptions | undefined | null): Promise<Array<PageLayout>>
210
173
 
211
- export declare function extractStructuredTextPerPage(buffer: Buffer): Array<StructuredPageText>;
174
+ export declare function extractStructuredTextPerPage(buffer: Buffer): Array<StructuredPageText>
212
175
 
213
- export declare function extractStructuredTextPerPageAsync(buffer: Buffer): Promise<Array<StructuredPageText>>;
176
+ export declare function extractStructuredTextPerPageAsync(buffer: Buffer): Promise<Array<StructuredPageText>>
214
177
 
215
- export declare function extractTextPerPage(buffer: Buffer): Array<PageText>;
178
+ export declare function extractTextPerPage(buffer: Buffer): Array<PageText>
216
179
 
217
- export declare function extractTextPerPageAsync(buffer: Buffer): Promise<Array<PageText>>;
180
+ export declare function extractTextPerPageAsync(buffer: Buffer): Promise<Array<PageText>>
218
181
 
219
- export declare function extractTextWithOcrPerPage(
220
- buffer: Buffer,
221
- opts?: OcrOptions | undefined | null
222
- ): Array<OcrPageText>;
182
+ export declare function extractTextWithOcrPerPage(buffer: Buffer, opts?: OcrOptions | undefined | null): Array<OcrPageText>
223
183
 
224
- export declare function extractTextWithOcrPerPageAsync(
225
- buffer: Buffer,
226
- opts?: OcrOptions | undefined | null
227
- ): Promise<Array<OcrPageText>>;
184
+ export declare function extractTextWithOcrPerPageAsync(buffer: Buffer, opts?: OcrOptions | undefined | null): Promise<Array<OcrPageText>>
228
185
 
229
186
  /** Where a field was read from, in PDF user space on a 1-based page. */
230
187
  export interface FieldSpan {
231
- page: number;
232
- x0: number;
233
- y0: number;
234
- x1: number;
235
- y1: number;
236
- }
237
-
238
- /** The outcome of `detectFormat`: the format, and for `Unknown` what the input was instead. */
239
- export interface FormatDetection {
240
- format: DocumentFormat;
241
- detail?: string;
188
+ page: number
189
+ x0: number
190
+ y0: number
191
+ x1: number
192
+ y1: number
242
193
  }
243
194
 
244
195
  /**
@@ -247,23 +198,23 @@ export interface FormatDetection {
247
198
  */
248
199
  export interface FormInfo {
249
200
  /** `/AcroForm` present (false when only orphan widgets were found). */
250
- hasAcroForm: boolean;
201
+ hasAcroForm: boolean
251
202
  /** `/AcroForm /XFA` present (XFA is not parsed). */
252
- hasXfa: boolean;
253
- needAppearances: boolean;
254
- sigFlags: number;
203
+ hasXfa: boolean
204
+ needAppearances: boolean
205
+ sigFlags: number
255
206
  /** Logical fields, placed + unplaced; may differ from `totalFormFields`. */
256
- fieldCount: number;
207
+ fieldCount: number
257
208
  /** Placements; always equals `totalFormFields` and `formFields.length`. */
258
- widgetCount: number;
259
- unplacedFields: Array<UnplacedFormField>;
209
+ widgetCount: number
210
+ unplacedFields: Array<UnplacedFormField>
260
211
  /** The `/Kids` depth cap was hit somewhere: the result is partial. */
261
- truncated: boolean;
212
+ truncated: boolean
262
213
  /** Dangling references, non-array `/Annots`, non-dictionary `/Kids` entries, depth cap. */
263
- warnings: Array<string>;
214
+ warnings: Array<string>
264
215
  }
265
216
 
266
- export type InvoiceDocumentType = "Invoice" | "CreditNote" | "Unknown";
217
+ export type InvoiceDocumentType = 'Invoice' | 'CreditNote' | 'Unknown'
267
218
 
268
219
  /**
269
220
  * Field names mirror the de-facto vocabulary of common invoice extractors so
@@ -271,70 +222,64 @@ export type InvoiceDocumentType = "Invoice" | "CreditNote" | "Unknown";
271
222
  * talks to any service.
272
223
  */
273
224
  export interface InvoiceFields {
274
- vendorName?: StringField;
275
- vendorAddress?: AddressField;
276
- vendorTaxId?: StringField;
277
- vendorEmail?: StringField;
278
- vendorPhone?: StringField;
279
- vendorWebsite?: StringField;
280
- customerName?: StringField;
281
- customerId?: StringField;
282
- customerAddress?: AddressField;
283
- customerTaxId?: StringField;
284
- billingAddress?: AddressField;
285
- shippingAddress?: AddressField;
286
- remittanceAddress?: AddressField;
287
- invoiceId?: StringField;
288
- invoiceDate?: DateField;
289
- dueDate?: DateField;
290
- purchaseOrder?: StringField;
291
- paymentTerm?: StringField;
292
- serviceStartDate?: DateField;
293
- serviceEndDate?: DateField;
294
- currencyCode?: string;
295
- subTotal?: MoneyField;
296
- totalDiscount?: MoneyField;
297
- totalTax?: MoneyField;
298
- shippingCost?: MoneyField;
299
- invoiceTotal?: MoneyField;
300
- amountDue?: MoneyField;
301
- previousUnpaidBalance?: MoneyField;
225
+ vendorName?: StringField
226
+ vendorAddress?: AddressField
227
+ vendorTaxId?: StringField
228
+ vendorEmail?: StringField
229
+ vendorPhone?: StringField
230
+ vendorWebsite?: StringField
231
+ customerName?: StringField
232
+ customerId?: StringField
233
+ customerAddress?: AddressField
234
+ customerTaxId?: StringField
235
+ billingAddress?: AddressField
236
+ shippingAddress?: AddressField
237
+ remittanceAddress?: AddressField
238
+ invoiceId?: StringField
239
+ invoiceDate?: DateField
240
+ dueDate?: DateField
241
+ purchaseOrder?: StringField
242
+ paymentTerm?: StringField
243
+ serviceStartDate?: DateField
244
+ serviceEndDate?: DateField
245
+ currencyCode?: string
246
+ subTotal?: MoneyField
247
+ totalDiscount?: MoneyField
248
+ totalTax?: MoneyField
249
+ shippingCost?: MoneyField
250
+ invoiceTotal?: MoneyField
251
+ amountDue?: MoneyField
252
+ previousUnpaidBalance?: MoneyField
302
253
  /** MRO work order / shop order the invoice bills against. */
303
- workOrder?: StringField;
254
+ workOrder?: StringField
304
255
  /** Aircraft and engines the invoice relates to; empty when none is identified. */
305
- aircraft: Array<AircraftReference>;
306
- taxDetails: Array<TaxDetail>;
307
- paymentDetails: Array<PaymentDetail>;
308
- items: Array<InvoiceItem>;
256
+ aircraft: Array<AircraftReference>
257
+ taxDetails: Array<TaxDetail>
258
+ paymentDetails: Array<PaymentDetail>
259
+ items: Array<InvoiceItem>
309
260
  }
310
261
 
311
262
  /**
312
- * The layout track over pages from anywhere: a PDF's own layout, `layoutWithOcr`, a workbook's
313
- * logical pages, or pages the caller built.
263
+ * The layout track over pages from anywhere: a PDF's own layout, `layoutWithOcr`, or pages
264
+ * the caller built.
314
265
  */
315
- export declare function invoiceFromLayout(
316
- pages: Array<PageLayout>,
317
- opts?: InvoiceOptions | undefined | null
318
- ): InvoiceResult;
266
+ export declare function invoiceFromLayout(pages: Array<PageLayout>, opts?: InvoiceOptions | undefined | null): InvoiceResult
319
267
 
320
- export declare function invoiceFromLayoutAsync(
321
- pages: Array<PageLayout>,
322
- opts?: InvoiceOptions | undefined | null
323
- ): Promise<InvoiceResult>;
268
+ export declare function invoiceFromLayoutAsync(pages: Array<PageLayout>, opts?: InvoiceOptions | undefined | null): Promise<InvoiceResult>
324
269
 
325
270
  export interface InvoiceItem {
326
- description?: StringField;
327
- productCode?: StringField;
328
- quantity?: NumberField;
329
- unit?: StringField;
330
- unitPrice?: MoneyField;
331
- taxRate?: NumberField;
332
- tax?: MoneyField;
333
- discount?: MoneyField;
334
- date?: DateField;
335
- amount?: MoneyField;
271
+ description?: StringField
272
+ productCode?: StringField
273
+ quantity?: NumberField
274
+ unit?: StringField
275
+ unitPrice?: MoneyField
276
+ taxRate?: NumberField
277
+ tax?: MoneyField
278
+ discount?: MoneyField
279
+ date?: DateField
280
+ amount?: MoneyField
336
281
  /** Absent when the item came from embedded XML (no page geometry). */
337
- span?: FieldSpan;
282
+ span?: FieldSpan
338
283
  }
339
284
 
340
285
  /**
@@ -346,332 +291,154 @@ export interface InvoiceItem {
346
291
  */
347
292
  export interface InvoiceOptions {
348
293
  /** Label lexicons to enable; default `["en"]`. */
349
- languages?: Array<string>;
294
+ languages?: Array<string>
350
295
  /** ISO 4217 hint when the page shows only symbols. */
351
- currency?: string;
352
- dateOrder?: DateOrder;
353
- decimalSeparator?: "Auto" | "." | ",";
296
+ currency?: string
297
+ dateOrder?: DateOrder
298
+ decimalSeparator?: "Auto" | "." | ","
354
299
  /** Default `true`. Embedded Factur-X / ZUGFeRD / XRechnung / UBL XML is used when present. */
355
- preferEmbeddedXml?: boolean;
300
+ preferEmbeddedXml?: boolean
356
301
  /** Reserved; accepted and ignored. */
357
- includeLayout?: boolean;
302
+ includeLayout?: boolean
358
303
  /**
359
304
  * Default `false`. Lists, in `warnings`, the candidates each field was chosen from, with
360
305
  * their scores.
361
306
  */
362
- includeCandidates?: boolean;
307
+ includeCandidates?: boolean
363
308
  }
364
309
 
365
310
  export interface InvoiceResult {
366
- source: InvoiceSource;
367
- documentType: InvoiceDocumentType;
311
+ source: InvoiceSource
312
+ documentType: InvoiceDocumentType
368
313
  /** Document-level confidence, 0..1. */
369
- confidence: number;
370
- fields: InvoiceFields;
371
- warnings: Array<string>;
372
- embeddedXml?: EmbeddedInvoiceXml;
314
+ confidence: number
315
+ fields: InvoiceFields
316
+ warnings: Array<string>
317
+ embeddedXml?: EmbeddedInvoiceXml
373
318
  /** Which tier named `fields.currencyCode`; absent when no layout pass ran. */
374
- currencySource?: CurrencySource;
319
+ currencySource?: CurrencySource
375
320
  /** The evidence behind `documentType: CreditNote`; empty otherwise. */
376
- creditSignals: Array<string>;
321
+ creditSignals: Array<string>
377
322
  }
378
323
 
379
324
  /**
380
325
  * Which extraction path produced the result: embedded XML, the page text (native, OCR,
381
- * rendered or mixed), a workbook's cells, or `None` when the document had no readable
326
+ * rendered or mixed), or `None` when the document had no readable
382
327
  * pages and no embedded XML.
383
328
  */
384
- export type InvoiceSource = "EmbeddedXml" | "Native" | "Ocr" | "Rendered" | "Mixed" | "Spreadsheet" | "None";
385
-
386
- /**
387
- * The logical pages of a workbook buffer's selected sheets, as `PageLayout` with
388
- * `source: "Spreadsheet"`.
389
- */
390
- export declare function layoutFromXlsx(buffer: Buffer, opts?: SpreadsheetOptions | undefined | null): Array<PageLayout>;
391
-
392
- export declare function layoutFromXlsxAsync(
393
- buffer: Buffer,
394
- opts?: SpreadsheetOptions | undefined | null
395
- ): Promise<Array<PageLayout>>;
329
+ export type InvoiceSource = 'EmbeddedXml' | 'Native' | 'Ocr' | 'Rendered' | 'Mixed' | 'None'
396
330
 
397
331
  /**
398
332
  * Positioned words and lines per page from the content stream (native text only).
399
333
  * Coordinates are PDF user space in points, y up.
400
334
  */
401
- export declare function layoutPerPage(buffer: Buffer): Array<PageLayout>;
335
+ export declare function layoutPerPage(buffer: Buffer): Array<PageLayout>
402
336
 
403
- export declare function layoutPerPageAsync(buffer: Buffer): Promise<Array<PageLayout>>;
337
+ export declare function layoutPerPageAsync(buffer: Buffer): Promise<Array<PageLayout>>
404
338
 
405
339
  /**
406
340
  * Money as a JS number plus the exact printed text; `text` is authoritative
407
341
  * when cents matter.
408
342
  */
409
343
  export interface MoneyField {
410
- value: number;
411
- text: string;
412
- confidence: number;
413
- span?: FieldSpan;
414
- currencyCode?: string;
415
- currencySymbol?: string;
344
+ value: number
345
+ text: string
346
+ confidence: number
347
+ span?: FieldSpan
348
+ currencyCode?: string
349
+ currencySymbol?: string
416
350
  }
417
351
 
418
352
  export interface NumberField {
419
- value: number;
420
- text: string;
421
- confidence: number;
422
- span?: FieldSpan;
353
+ value: number
354
+ text: string
355
+ confidence: number
356
+ span?: FieldSpan
423
357
  }
424
358
 
425
- /**
426
- * Whether a Number cell's value is a whole number JavaScript can hold exactly, or a fraction.
427
- * A percentage is a fraction (50% is 0.5); the subtype is about the value, not the format.
428
- */
429
- export type NumberSubtype = "Integer" | "Float";
430
-
431
359
  export interface OcrOptions {
432
- lang?: string;
433
- minTextLength?: number;
434
- maxThreads?: number;
435
- render?: RenderMode;
436
- renderDpi?: number;
437
- pdfiumPath?: string;
360
+ lang?: string
361
+ minTextLength?: number
362
+ maxThreads?: number
363
+ render?: RenderMode
364
+ renderDpi?: number
365
+ pdfiumPath?: string
438
366
  }
439
367
 
440
368
  export interface OcrPageText {
441
- page: number;
442
- text: string;
443
- source: TextSource;
369
+ page: number
370
+ text: string
371
+ source: TextSource
444
372
  }
445
373
 
446
374
  export interface OcrStructuredPageText {
447
- page: number;
448
- header: string;
449
- body: string;
450
- footer: string;
451
- source: TextSource;
375
+ page: number
376
+ header: string
377
+ body: string
378
+ footer: string
379
+ source: TextSource
452
380
  }
453
381
 
454
382
  export interface PageAnnotation {
455
- page: number;
456
- subtype: string;
457
- rect: Array<number>;
458
- uri?: string;
459
- dest?: string;
460
- content?: string;
383
+ page: number
384
+ subtype: string
385
+ rect: Array<number>
386
+ uri?: string
387
+ dest?: string
388
+ content?: string
461
389
  }
462
390
 
463
391
  export interface PageBox {
464
392
  /** Number of pages that share these dimensions. */
465
- pageCount: number;
466
- left: number;
467
- bottom: number;
468
- right: number;
469
- top: number;
470
- width: number;
471
- height: number;
472
- boxType: BoxType;
393
+ pageCount: number
394
+ left: number
395
+ bottom: number
396
+ right: number
397
+ top: number
398
+ width: number
399
+ height: number
400
+ boxType: BoxType
473
401
  /**
474
402
  * Present only on non-dominant boxes — lists the specific pages with these
475
403
  * dimensions. `None` on the first (most frequent) entry means "all pages
476
404
  * not listed in any other entry's `pages` array."
477
405
  */
478
- pages?: Array<number>;
406
+ pages?: Array<number>
479
407
  }
480
408
 
481
409
  export type PageFormField =
482
- | {
483
- type: "Text";
484
- page: number;
485
- rect: Array<number>;
486
- objectId: string;
487
- fieldObjectId: string;
488
- name: string;
489
- partialName: string;
490
- widgetIndex: number;
491
- widgetCount: number;
492
- value?: string;
493
- defaultValue?: string;
494
- tooltip?: string;
495
- mappingName?: string;
496
- readOnly: boolean;
497
- required: boolean;
498
- noExport: boolean;
499
- hasActions: boolean;
500
- multiline: boolean;
501
- password: boolean;
502
- comb: boolean;
503
- richText: boolean;
504
- maxLen?: number;
505
- }
506
- | {
507
- type: "Checkbox";
508
- page: number;
509
- rect: Array<number>;
510
- objectId: string;
511
- fieldObjectId: string;
512
- name: string;
513
- partialName: string;
514
- widgetIndex: number;
515
- widgetCount: number;
516
- value?: string;
517
- defaultValue?: string;
518
- tooltip?: string;
519
- mappingName?: string;
520
- readOnly: boolean;
521
- required: boolean;
522
- noExport: boolean;
523
- hasActions: boolean;
524
- onState?: string;
525
- exportValue?: string;
526
- checked: boolean;
527
- }
528
- | {
529
- type: "Radio";
530
- page: number;
531
- rect: Array<number>;
532
- objectId: string;
533
- fieldObjectId: string;
534
- name: string;
535
- partialName: string;
536
- widgetIndex: number;
537
- widgetCount: number;
538
- value?: string;
539
- defaultValue?: string;
540
- tooltip?: string;
541
- mappingName?: string;
542
- readOnly: boolean;
543
- required: boolean;
544
- noExport: boolean;
545
- hasActions: boolean;
546
- onState?: string;
547
- exportValue?: string;
548
- selected: boolean;
549
- }
550
- | {
551
- type: "ComboBox";
552
- page: number;
553
- rect: Array<number>;
554
- objectId: string;
555
- fieldObjectId: string;
556
- name: string;
557
- partialName: string;
558
- widgetIndex: number;
559
- widgetCount: number;
560
- value?: string;
561
- defaultValue?: string;
562
- tooltip?: string;
563
- mappingName?: string;
564
- readOnly: boolean;
565
- required: boolean;
566
- noExport: boolean;
567
- hasActions: boolean;
568
- options: Array<ChoiceOption>;
569
- editable: boolean;
570
- }
571
- | {
572
- type: "ListBox";
573
- page: number;
574
- rect: Array<number>;
575
- objectId: string;
576
- fieldObjectId: string;
577
- name: string;
578
- partialName: string;
579
- widgetIndex: number;
580
- widgetCount: number;
581
- value?: string;
582
- defaultValue?: string;
583
- tooltip?: string;
584
- mappingName?: string;
585
- readOnly: boolean;
586
- required: boolean;
587
- noExport: boolean;
588
- hasActions: boolean;
589
- options: Array<ChoiceOption>;
590
- multiSelect: boolean;
591
- values?: Array<string>;
592
- }
593
- | {
594
- type: "PushButton";
595
- page: number;
596
- rect: Array<number>;
597
- objectId: string;
598
- fieldObjectId: string;
599
- name: string;
600
- partialName: string;
601
- widgetIndex: number;
602
- widgetCount: number;
603
- value?: string;
604
- defaultValue?: string;
605
- tooltip?: string;
606
- mappingName?: string;
607
- readOnly: boolean;
608
- required: boolean;
609
- noExport: boolean;
610
- hasActions: boolean;
611
- }
612
- | {
613
- type: "Signature";
614
- page: number;
615
- rect: Array<number>;
616
- objectId: string;
617
- fieldObjectId: string;
618
- name: string;
619
- partialName: string;
620
- widgetIndex: number;
621
- widgetCount: number;
622
- value?: string;
623
- defaultValue?: string;
624
- tooltip?: string;
625
- mappingName?: string;
626
- readOnly: boolean;
627
- required: boolean;
628
- noExport: boolean;
629
- hasActions: boolean;
630
- signed: boolean;
631
- }
632
- | {
633
- type: "Unknown";
634
- page: number;
635
- rect: Array<number>;
636
- objectId: string;
637
- fieldObjectId: string;
638
- name: string;
639
- partialName: string;
640
- widgetIndex: number;
641
- widgetCount: number;
642
- value?: string;
643
- defaultValue?: string;
644
- tooltip?: string;
645
- mappingName?: string;
646
- readOnly: boolean;
647
- required: boolean;
648
- noExport: boolean;
649
- hasActions: boolean;
650
- };
410
+ | { type: 'Text'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean; multiline: boolean; password: boolean; comb: boolean; richText: boolean; maxLen?: number }
411
+ | { type: 'Checkbox'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean; onState?: string; exportValue?: string; checked: boolean }
412
+ | { type: 'Radio'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean; onState?: string; exportValue?: string; selected: boolean }
413
+ | { type: 'ComboBox'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean; options: Array<ChoiceOption>; editable: boolean }
414
+ | { type: 'ListBox'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean; options: Array<ChoiceOption>; multiSelect: boolean; values?: Array<string> }
415
+ | { type: 'PushButton'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean }
416
+ | { type: 'Signature'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean; signed: boolean }
417
+ | { type: 'Unknown'; page: number; rect: Array<number>; objectId: string; fieldObjectId: string; name: string; partialName: string; widgetIndex: number; widgetCount: number; value?: string; defaultValue?: string; tooltip?: string; mappingName?: string; readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean }
651
418
 
652
419
  export interface PageImage {
653
- page: number;
654
- imageIndex: number;
655
- width: number;
656
- height: number;
657
- data: Buffer;
658
- colorSpace: string;
659
- bitsPerComponent: number;
660
- filter: string;
661
- xobjectName: string;
662
- objectId: string;
420
+ page: number
421
+ imageIndex: number
422
+ width: number
423
+ height: number
424
+ data: Buffer
425
+ colorSpace: string
426
+ bitsPerComponent: number
427
+ filter: string
428
+ xobjectName: string
429
+ objectId: string
663
430
  }
664
431
 
665
432
  export interface PageLayout {
666
- page: number;
433
+ page: number
667
434
  /**
668
435
  * CropBox (fallback MediaBox) size in points. Coordinates in `words`,
669
436
  * `lines` and `images` are raw user space, not shifted to this box's origin.
670
437
  */
671
- width: number;
672
- height: number;
438
+ width: number
439
+ height: number
673
440
  /** `/Rotate`, reported and not applied. */
674
- rotate: number;
441
+ rotate: number
675
442
  /**
676
443
  * Clockwise degrees (0, 90, 180, 270) the OCR tiers turned the page so its
677
444
  * text reads upright: the turn carrying the most confident OCR text across
@@ -684,363 +451,151 @@ export interface PageLayout {
684
451
  * For any page, displayed coordinates are this frame turned clockwise by
685
452
  * `rotate - contentRotation` (mod 360).
686
453
  */
687
- contentRotation: number;
454
+ contentRotation: number
688
455
  /**
689
456
  * Deepest cascade tier that ran: `Native`, or `Ocr` / `Rendered` on a page
690
457
  * whose native words (if any) were kept alongside the OCR words.
691
458
  */
692
- source: TextSource;
693
- /** Spreadsheet pages only: the sheet this logical page projects. */
694
- sheet?: string;
695
- words: Array<TextWord>;
696
- lines: Array<TextLine>;
697
- images: Array<PlacedImage>;
698
- warnings: Array<string>;
459
+ source: TextSource
460
+ words: Array<TextWord>
461
+ lines: Array<TextLine>
462
+ images: Array<PlacedImage>
463
+ warnings: Array<string>
699
464
  }
700
465
 
701
466
  export interface PageText {
702
- page: number;
703
- text: string;
467
+ page: number
468
+ text: string
704
469
  }
705
470
 
706
471
  export interface PaymentDetail {
707
- iban?: StringField;
708
- swift?: StringField;
709
- bankName?: StringField;
710
- accountNumber?: StringField;
711
- routingNumber?: StringField;
472
+ iban?: StringField
473
+ swift?: StringField
474
+ bankName?: StringField
475
+ accountNumber?: StringField
476
+ routingNumber?: StringField
712
477
  }
713
478
 
714
- export declare function pdfDocument(buffer: Buffer): PdfDocument;
479
+ export declare function pdfDocument(buffer: Buffer): PdfDocument
715
480
 
716
481
  export interface PdfDocument {
717
- version: string;
718
- isLinearized: boolean;
719
- pageCount: number;
720
- creator?: string;
721
- producer?: string;
722
- creationDate?: string;
723
- modificationDate?: string;
724
- pageBoxes: Array<PageBox>;
725
- totalImages: number;
726
- totalAnnotations: number;
727
- imagePages: Array<number>;
728
- annotationPages: Array<number>;
729
- text: Array<PageText>;
730
- structuredText: Array<StructuredPageText>;
731
- images: Array<PageImage>;
732
- annotations: Array<PageAnnotation>;
733
- form?: FormInfo;
734
- formFields: Array<PageFormField>;
735
- totalFormFields: number;
736
- formFieldPages: Array<number>;
737
- }
738
-
739
- export declare function pdfDocumentAsync(buffer: Buffer): Promise<PdfDocument>;
740
-
741
- export declare function pdfDocumentOcr(buffer: Buffer, opts?: OcrOptions | undefined | null): PdfDocumentOcr;
482
+ version: string
483
+ isLinearized: boolean
484
+ pageCount: number
485
+ creator?: string
486
+ producer?: string
487
+ creationDate?: string
488
+ modificationDate?: string
489
+ pageBoxes: Array<PageBox>
490
+ totalImages: number
491
+ totalAnnotations: number
492
+ imagePages: Array<number>
493
+ annotationPages: Array<number>
494
+ text: Array<PageText>
495
+ structuredText: Array<StructuredPageText>
496
+ images: Array<PageImage>
497
+ annotations: Array<PageAnnotation>
498
+ form?: FormInfo
499
+ formFields: Array<PageFormField>
500
+ totalFormFields: number
501
+ formFieldPages: Array<number>
502
+ }
503
+
504
+ export declare function pdfDocumentAsync(buffer: Buffer): Promise<PdfDocument>
505
+
506
+ export declare function pdfDocumentOcr(buffer: Buffer, opts?: OcrOptions | undefined | null): PdfDocumentOcr
742
507
 
743
508
  export interface PdfDocumentOcr {
744
- version: string;
745
- isLinearized: boolean;
746
- pageCount: number;
747
- creator?: string;
748
- producer?: string;
749
- creationDate?: string;
750
- modificationDate?: string;
751
- pageBoxes: Array<PageBox>;
752
- totalImages: number;
753
- totalAnnotations: number;
754
- imagePages: Array<number>;
755
- annotationPages: Array<number>;
756
- text: Array<OcrPageText>;
757
- structuredText: Array<OcrStructuredPageText>;
758
- images: Array<PageImage>;
759
- annotations: Array<PageAnnotation>;
760
- form?: FormInfo;
761
- formFields: Array<PageFormField>;
762
- totalFormFields: number;
763
- formFieldPages: Array<number>;
764
- }
765
-
766
- export declare function pdfDocumentOcrAsync(
767
- buffer: Buffer,
768
- opts?: OcrOptions | undefined | null
769
- ): Promise<PdfDocumentOcr>;
509
+ version: string
510
+ isLinearized: boolean
511
+ pageCount: number
512
+ creator?: string
513
+ producer?: string
514
+ creationDate?: string
515
+ modificationDate?: string
516
+ pageBoxes: Array<PageBox>
517
+ totalImages: number
518
+ totalAnnotations: number
519
+ imagePages: Array<number>
520
+ annotationPages: Array<number>
521
+ text: Array<OcrPageText>
522
+ structuredText: Array<OcrStructuredPageText>
523
+ images: Array<PageImage>
524
+ annotations: Array<PageAnnotation>
525
+ form?: FormInfo
526
+ formFields: Array<PageFormField>
527
+ totalFormFields: number
528
+ formFieldPages: Array<number>
529
+ }
530
+
531
+ export declare function pdfDocumentOcrAsync(buffer: Buffer, opts?: OcrOptions | undefined | null): Promise<PdfDocumentOcr>
770
532
 
771
533
  export interface PdfMeta {
772
- pageCount: number;
773
- version: string;
774
- isLinearized: boolean;
775
- creator?: string;
776
- producer?: string;
777
- creationDate?: string;
778
- modificationDate?: string;
779
- pageBoxes: Array<PageBox>;
534
+ pageCount: number
535
+ version: string
536
+ isLinearized: boolean
537
+ creator?: string
538
+ producer?: string
539
+ creationDate?: string
540
+ modificationDate?: string
541
+ pageBoxes: Array<PageBox>
780
542
  /** AcroForm facts; present when `/AcroForm` exists or orphan widgets were found. */
781
- form?: FormInfo;
543
+ form?: FormInfo
782
544
  }
783
545
 
784
- export declare function pdfMetadata(buffer: Buffer): PdfMeta;
546
+ export declare function pdfMetadata(buffer: Buffer): PdfMeta
785
547
 
786
- export declare function pdfMetadataAsync(buffer: Buffer): Promise<PdfMeta>;
548
+ export declare function pdfMetadataAsync(buffer: Buffer): Promise<PdfMeta>
787
549
 
788
550
  /**
789
551
  * Where an image XObject was painted: the unit square under the CTM at the
790
552
  * `Do` operator, as an axis-aligned box in user space.
791
553
  */
792
554
  export interface PlacedImage {
793
- xobjectName: string;
794
- x0: number;
795
- y0: number;
796
- x1: number;
797
- y1: number;
555
+ xobjectName: string
556
+ x0: number
557
+ y0: number
558
+ x1: number
559
+ y1: number
798
560
  }
799
561
 
800
562
  export interface RenderedPage {
801
- page: number;
802
- width: number;
803
- height: number;
804
- dpi: number;
805
- data: Buffer;
563
+ page: number
564
+ width: number
565
+ height: number
566
+ dpi: number
567
+ data: Buffer
806
568
  }
807
569
 
808
- export type RenderMode = "Auto" | "Never" | "Always";
570
+ export type RenderMode = 'Auto' | 'Never' | 'Always'
809
571
 
810
572
  export interface RenderOptions {
811
- dpi?: number;
812
- mode?: RenderMode;
813
- }
814
-
815
- export declare function renderPagesAsync(
816
- buffer: Buffer,
817
- opts?: RenderOptions | undefined | null
818
- ): Promise<Array<RenderedPage>>;
819
-
820
- /**
821
- * One cell of a worksheet: a discriminated union on `type` whose typed value is `value`
822
- * (none for `Blank`): a Number carries the full double plus its `subtype` and the
823
- * `currencySymbol` its format names; a Date carries an ISO date or date-time; a Time the
824
- * clock of a time-only cell. `text` is the display text, `raw` the stored spelling (the
825
- * serial for dates and times), `format` the code that produced `text`, `formula` the expression stored on this
826
- * cell, `sharedFormula` the master cell when this cell follows a shared formula, `cached`
827
- * whether a result was stored, `merge` the range this cell anchors, `hidden` whether its row
828
- * or column is hidden, `box` its rectangle in the sheet frame (a merged anchor spans its
829
- * range).
830
- */
831
- export type SheetCell =
832
- | {
833
- type: "Text";
834
- ref: string;
835
- row: number;
836
- col: number;
837
- text: string;
838
- raw: string;
839
- format?: string;
840
- formatSupported: boolean;
841
- formula?: string;
842
- sharedFormula?: string;
843
- cached: boolean;
844
- merge?: string;
845
- hidden: boolean;
846
- box: CellBox;
847
- value: string;
848
- }
849
- | {
850
- type: "Number";
851
- ref: string;
852
- row: number;
853
- col: number;
854
- text: string;
855
- raw: string;
856
- format?: string;
857
- formatSupported: boolean;
858
- formula?: string;
859
- sharedFormula?: string;
860
- cached: boolean;
861
- merge?: string;
862
- hidden: boolean;
863
- box: CellBox;
864
- value: number;
865
- subtype: NumberSubtype;
866
- currencySymbol?: string;
867
- }
868
- | {
869
- type: "Boolean";
870
- ref: string;
871
- row: number;
872
- col: number;
873
- text: string;
874
- raw: string;
875
- format?: string;
876
- formatSupported: boolean;
877
- formula?: string;
878
- sharedFormula?: string;
879
- cached: boolean;
880
- merge?: string;
881
- hidden: boolean;
882
- box: CellBox;
883
- value: boolean;
884
- }
885
- | {
886
- type: "Error";
887
- ref: string;
888
- row: number;
889
- col: number;
890
- text: string;
891
- raw: string;
892
- format?: string;
893
- formatSupported: boolean;
894
- formula?: string;
895
- sharedFormula?: string;
896
- cached: boolean;
897
- merge?: string;
898
- hidden: boolean;
899
- box: CellBox;
900
- value: string;
901
- }
902
- | {
903
- type: "Date";
904
- ref: string;
905
- row: number;
906
- col: number;
907
- text: string;
908
- raw: string;
909
- format?: string;
910
- formatSupported: boolean;
911
- formula?: string;
912
- sharedFormula?: string;
913
- cached: boolean;
914
- merge?: string;
915
- hidden: boolean;
916
- box: CellBox;
917
- value: string;
918
- }
919
- | {
920
- type: "Time";
921
- ref: string;
922
- row: number;
923
- col: number;
924
- text: string;
925
- raw: string;
926
- format?: string;
927
- formatSupported: boolean;
928
- formula?: string;
929
- sharedFormula?: string;
930
- cached: boolean;
931
- merge?: string;
932
- hidden: boolean;
933
- box: CellBox;
934
- value: string;
935
- }
936
- | {
937
- type: "Blank";
938
- ref: string;
939
- row: number;
940
- col: number;
941
- text: string;
942
- raw: string;
943
- format?: string;
944
- formatSupported: boolean;
945
- formula?: string;
946
- sharedFormula?: string;
947
- cached: boolean;
948
- merge?: string;
949
- hidden: boolean;
950
- box: CellBox;
951
- };
952
-
953
- /** One selected worksheet's cells, with the sheet facts a reader needs beside them. */
954
- export interface SheetCells {
955
- sheet: string;
956
- /** Position in the workbook, 0-based. */
957
- index: number;
958
- hidden: boolean;
959
- /** The declared `<dimension>`, which a producer may overstate. */
960
- dimension?: string;
961
- printArea?: string;
962
- /** Merged ranges in A1 form. */
963
- merges: Array<string>;
964
- /**
965
- * The sheet frame's size in points: A1 to the last non-empty cell or merged range, with hidden
966
- * rows and columns counted or not per `hiddenCells`.
967
- */
968
- width: number;
969
- height: number;
970
- /** Points; what a column or row absent from `columns` / `rows` measures. */
971
- defaultColumnWidth: number;
972
- defaultRowHeight: number;
973
- /** Only the columns and rows that differ from the default or are hidden. */
974
- columns: Array<SheetColumn>;
975
- rows: Array<SheetRow>;
976
- warnings: Array<string>;
977
- cells: Array<SheetCell>;
978
- }
979
-
980
- /** A column whose width differs from the sheet default, or that is hidden. 0-based. */
981
- export interface SheetColumn {
982
- index: number;
983
- /** Points; zero for a hidden column when hidden cells are excluded. */
984
- width: number;
985
- hidden: boolean;
986
- }
987
-
988
- /**
989
- * A row whose height differs from the sheet default (auto-fit growth included), or that is
990
- * hidden. 0-based.
991
- */
992
- export interface SheetRow {
993
- index: number;
994
- /** Points; zero for a hidden row when hidden cells are excluded. */
995
- height: number;
996
- hidden: boolean;
573
+ dpi?: number
574
+ mode?: RenderMode
997
575
  }
998
576
 
999
- /** The cells of a workbook buffer's selected sheets. */
1000
- export declare function spreadsheetCells(
1001
- buffer: Buffer,
1002
- opts?: SpreadsheetOptions | undefined | null
1003
- ): Array<SheetCells>;
1004
-
1005
- export declare function spreadsheetCellsAsync(
1006
- buffer: Buffer,
1007
- opts?: SpreadsheetOptions | undefined | null
1008
- ): Promise<Array<SheetCells>>;
1009
-
1010
- /** Workbook options shared by `spreadsheetCells` and `layout`. */
1011
- export interface SpreadsheetOptions {
1012
- /** Sheet names to include, in workbook order; default: every visible sheet. */
1013
- sheets?: Array<string>;
1014
- /** Include hidden sheets (default false). */
1015
- hiddenSheets?: boolean;
1016
- /**
1017
- * Cells in hidden rows and columns. For `spreadsheetCells` the default is true: they are listed
1018
- * with `hidden: true`. For `layout` the default is false: zero extent and omitted; true gives
1019
- * them their real extents back.
1020
- */
1021
- hiddenCells?: boolean;
1022
- }
577
+ export declare function renderPagesAsync(buffer: Buffer, opts?: RenderOptions | undefined | null): Promise<Array<RenderedPage>>
1023
578
 
1024
579
  export interface StringField {
1025
- value: string;
580
+ value: string
1026
581
  /** The exact source text the value was derived from. */
1027
- text: string;
1028
- confidence: number;
1029
- span?: FieldSpan;
582
+ text: string
583
+ confidence: number
584
+ span?: FieldSpan
1030
585
  }
1031
586
 
1032
587
  export interface StructuredPageText {
1033
- page: number;
1034
- header: string;
1035
- body: string;
1036
- footer: string;
588
+ page: number
589
+ header: string
590
+ body: string
591
+ footer: string
1037
592
  }
1038
593
 
1039
594
  export interface TaxDetail {
1040
- rate?: NumberField;
1041
- amount?: MoneyField;
1042
- base?: MoneyField;
1043
- category?: StringField;
595
+ rate?: NumberField
596
+ amount?: MoneyField
597
+ base?: MoneyField
598
+ category?: StringField
1044
599
  }
1045
600
 
1046
601
  /**
@@ -1048,55 +603,49 @@ export interface TaxDetail {
1048
603
  * address a contiguous slice of `PageLayout.words`.
1049
604
  */
1050
605
  export interface TextLine {
1051
- text: string;
1052
- x0: number;
1053
- y0: number;
1054
- x1: number;
1055
- y1: number;
1056
- firstWord: number;
1057
- wordCount: number;
606
+ text: string
607
+ x0: number
608
+ y0: number
609
+ x1: number
610
+ y1: number
611
+ firstWord: number
612
+ wordCount: number
1058
613
  }
1059
614
 
1060
615
  /**
1061
616
  * The deepest tier of the OCR cascade that ran for a page: `Native` when the
1062
617
  * page's own glyphs were the page, `Ocr` when its embedded rasters were OCR'd,
1063
- * `Rendered` when the page was rasterised and OCR'd (only with the `render`
618
+ * `Rendered` when the page was rasterized and OCR'd (only with the `render`
1064
619
  * feature). A hybrid page keeps its native words alongside the OCR words and
1065
620
  * still reports the OCR tier, even when that tier added no words; tell the
1066
621
  * two apart by `confidence`, which only OCR words carry, and see the "native
1067
- * words kept" warnings. `Spreadsheet` is the logical page of a workbook sheet,
1068
- * laid out from column widths and row heights. Present in every build.
622
+ * words kept" warnings. Present in every build.
1069
623
  */
1070
- export type TextSource = "Native" | "Ocr" | "Rendered" | "Spreadsheet";
624
+ export type TextSource = 'Native' | 'Ocr' | 'Rendered'
1071
625
 
1072
626
  /** One word with its box in PDF user space (points, y up). */
1073
627
  export interface TextWord {
1074
- text: string;
1075
- x0: number;
1076
- y0: number;
1077
- x1: number;
1078
- y1: number;
628
+ text: string
629
+ x0: number
630
+ y0: number
631
+ x1: number
632
+ y1: number
1079
633
  /** Index into `PageLayout.lines`. */
1080
- line: number;
634
+ line: number
1081
635
  /** Native only: font size in user space (after the CTM), in points. */
1082
- fontSize?: number;
636
+ fontSize?: number
1083
637
  /** Native only: base font name with any subset prefix stripped. */
1084
- fontName?: string;
638
+ fontName?: string
1085
639
  /**
1086
640
  * Native: from the font descriptor and name; absent when the font gives no weight evidence
1087
641
  * (anonymous names such as `CIDFont+F1`) and for OCR words.
1088
642
  */
1089
- bold?: boolean;
1090
- italic?: boolean;
643
+ bold?: boolean
644
+ italic?: boolean
1091
645
  /** Native only: true when the word is set in a barcode font, so its glyphs are bars, not letters. */
1092
- symbolic?: boolean;
646
+ symbolic?: boolean
1093
647
  /** OCR only: Tesseract word confidence, 0..1. */
1094
- confidence?: number;
1095
- /**
1096
- * Spreadsheet only: the reference of the cell this word was laid out from (`"C3"`); the
1097
- * anchor for a merged range.
1098
- */
1099
- cell?: string;
648
+ confidence?: number
1100
649
  }
1101
650
 
1102
651
  /**
@@ -1108,29 +657,29 @@ export interface UnplacedFormField {
1108
657
  * `"N G obj"`, or `"<parent fieldObjectId>/kid I"` / `"/Fields I"` when the field
1109
658
  * dictionary itself is written inline.
1110
659
  */
1111
- fieldObjectId: string;
1112
- name: string;
1113
- partialName: string;
1114
- type: PageFormField["type"];
1115
- value?: string;
660
+ fieldObjectId: string
661
+ name: string
662
+ partialName: string
663
+ type: PageFormField["type"]
664
+ value?: string
1116
665
  /** Multi-select list boxes. */
1117
- values?: Array<string>;
1118
- defaultValue?: string;
1119
- tooltip?: string;
1120
- mappingName?: string;
666
+ values?: Array<string>
667
+ defaultValue?: string
668
+ tooltip?: string
669
+ mappingName?: string
1121
670
  /** Choice fields. */
1122
- options?: Array<ChoiceOption>;
1123
- maxLen?: number;
1124
- readOnly: boolean;
1125
- required: boolean;
1126
- noExport: boolean;
1127
- hasActions: boolean;
1128
- multiline: boolean;
1129
- password: boolean;
1130
- comb: boolean;
1131
- richText: boolean;
1132
- editable: boolean;
1133
- multiSelect: boolean;
671
+ options?: Array<ChoiceOption>
672
+ maxLen?: number
673
+ readOnly: boolean
674
+ required: boolean
675
+ noExport: boolean
676
+ hasActions: boolean
677
+ multiline: boolean
678
+ password: boolean
679
+ comb: boolean
680
+ richText: boolean
681
+ editable: boolean
682
+ multiSelect: boolean
1134
683
  /** Signature fields: signature data present in /V (not cryptographic validation). */
1135
- signed: boolean;
684
+ signed: boolean
1136
685
  }