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