pdf-oxide-wasm 0.3.18 → 0.3.20
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/package.json +1 -1
- package/pdf_oxide.d.ts +779 -658
- package/pdf_oxide.js +1725 -1649
- package/pdf_oxide_bg.wasm +0 -0
- package/pdf_oxide_bg.wasm.d.ts +7 -3
package/pdf_oxide.d.ts
CHANGED
|
@@ -1,690 +1,811 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Style configuration for header/footer text.
|
|
6
|
+
*/
|
|
4
7
|
export class ArtifactStyle {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Set bold font for the artifact.
|
|
12
|
+
*/
|
|
13
|
+
bold(): ArtifactStyle;
|
|
14
|
+
/**
|
|
15
|
+
* Set color for the artifact.
|
|
16
|
+
*/
|
|
17
|
+
color(r: number, g: number, b: number): ArtifactStyle;
|
|
18
|
+
/**
|
|
19
|
+
* Set font for the artifact.
|
|
20
|
+
*/
|
|
21
|
+
font(name: string, size: number): ArtifactStyle;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new artifact style.
|
|
24
|
+
*/
|
|
25
|
+
constructor();
|
|
8
26
|
}
|
|
9
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Chroma subsampling format
|
|
30
|
+
*/
|
|
31
|
+
export enum ChromaSampling {
|
|
32
|
+
/**
|
|
33
|
+
* Both vertically and horizontally subsampled.
|
|
34
|
+
*/
|
|
35
|
+
Cs420 = 0,
|
|
36
|
+
/**
|
|
37
|
+
* Horizontally subsampled.
|
|
38
|
+
*/
|
|
39
|
+
Cs422 = 1,
|
|
40
|
+
/**
|
|
41
|
+
* Not subsampled.
|
|
42
|
+
*/
|
|
43
|
+
Cs444 = 2,
|
|
44
|
+
/**
|
|
45
|
+
* Monochrome.
|
|
46
|
+
*/
|
|
47
|
+
Cs400 = 3,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A header or footer artifact definition.
|
|
52
|
+
*/
|
|
10
53
|
export class WasmArtifact {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
free(): void;
|
|
55
|
+
[Symbol.dispose](): void;
|
|
56
|
+
/**
|
|
57
|
+
* Create a center-aligned artifact.
|
|
58
|
+
*/
|
|
59
|
+
static center(text: string): WasmArtifact;
|
|
60
|
+
/**
|
|
61
|
+
* Create a left-aligned artifact.
|
|
62
|
+
*/
|
|
63
|
+
static left(text: string): WasmArtifact;
|
|
64
|
+
/**
|
|
65
|
+
* Create a new artifact.
|
|
66
|
+
*/
|
|
67
|
+
constructor();
|
|
68
|
+
/**
|
|
69
|
+
* Create a right-aligned artifact.
|
|
70
|
+
*/
|
|
71
|
+
static right(text: string): WasmArtifact;
|
|
72
|
+
/**
|
|
73
|
+
* Set vertical offset for the artifact.
|
|
74
|
+
*/
|
|
75
|
+
withOffset(offset: number): WasmArtifact;
|
|
76
|
+
/**
|
|
77
|
+
* Set style for the artifact.
|
|
78
|
+
*/
|
|
79
|
+
withStyle(style: ArtifactStyle): WasmArtifact;
|
|
37
80
|
}
|
|
38
81
|
|
|
82
|
+
/**
|
|
83
|
+
* A footer definition.
|
|
84
|
+
*/
|
|
39
85
|
export class WasmFooter {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
86
|
+
free(): void;
|
|
87
|
+
[Symbol.dispose](): void;
|
|
88
|
+
/**
|
|
89
|
+
* Create a center-aligned footer.
|
|
90
|
+
*/
|
|
91
|
+
static center(text: string): WasmFooter;
|
|
92
|
+
/**
|
|
93
|
+
* Create a left-aligned footer.
|
|
94
|
+
*/
|
|
95
|
+
static left(text: string): WasmFooter;
|
|
96
|
+
/**
|
|
97
|
+
* Create a new empty footer.
|
|
98
|
+
*/
|
|
99
|
+
constructor();
|
|
100
|
+
/**
|
|
101
|
+
* Create a right-aligned footer.
|
|
102
|
+
*/
|
|
103
|
+
static right(text: string): WasmFooter;
|
|
58
104
|
}
|
|
59
105
|
|
|
106
|
+
/**
|
|
107
|
+
* A header definition.
|
|
108
|
+
*/
|
|
60
109
|
export class WasmHeader {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
110
|
+
free(): void;
|
|
111
|
+
[Symbol.dispose](): void;
|
|
112
|
+
/**
|
|
113
|
+
* Create a center-aligned header.
|
|
114
|
+
*/
|
|
115
|
+
static center(text: string): WasmHeader;
|
|
116
|
+
/**
|
|
117
|
+
* Create a left-aligned header.
|
|
118
|
+
*/
|
|
119
|
+
static left(text: string): WasmHeader;
|
|
120
|
+
/**
|
|
121
|
+
* Create a new empty header.
|
|
122
|
+
*/
|
|
123
|
+
constructor();
|
|
124
|
+
/**
|
|
125
|
+
* Create a right-aligned header.
|
|
126
|
+
*/
|
|
127
|
+
static right(text: string): WasmHeader;
|
|
79
128
|
}
|
|
80
129
|
|
|
130
|
+
/**
|
|
131
|
+
* OCR configuration for WebAssembly.
|
|
132
|
+
*/
|
|
81
133
|
export class WasmOcrConfig {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
134
|
+
free(): void;
|
|
135
|
+
[Symbol.dispose](): void;
|
|
136
|
+
/**
|
|
137
|
+
* Create a new OCR configuration.
|
|
138
|
+
*/
|
|
139
|
+
constructor();
|
|
88
140
|
}
|
|
89
141
|
|
|
142
|
+
/**
|
|
143
|
+
* OCR engine for WebAssembly.
|
|
144
|
+
*/
|
|
90
145
|
export class WasmOcrEngine {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
146
|
+
free(): void;
|
|
147
|
+
[Symbol.dispose](): void;
|
|
148
|
+
/**
|
|
149
|
+
* Create a new OCR engine.
|
|
150
|
+
*/
|
|
151
|
+
constructor(_det_model_path: string, _rec_model_path: string, _dict_path: string, _config?: WasmOcrConfig | null);
|
|
97
152
|
}
|
|
98
153
|
|
|
154
|
+
/**
|
|
155
|
+
* A complete page template with header and footer.
|
|
156
|
+
*/
|
|
99
157
|
export class WasmPageTemplate {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
158
|
+
free(): void;
|
|
159
|
+
[Symbol.dispose](): void;
|
|
160
|
+
/**
|
|
161
|
+
* Set footer artifact.
|
|
162
|
+
*/
|
|
163
|
+
footer(footer: WasmArtifact): WasmPageTemplate;
|
|
164
|
+
/**
|
|
165
|
+
* Set header artifact.
|
|
166
|
+
*/
|
|
167
|
+
header(header: WasmArtifact): WasmPageTemplate;
|
|
168
|
+
/**
|
|
169
|
+
* Create a new page template.
|
|
170
|
+
*/
|
|
171
|
+
constructor();
|
|
172
|
+
/**
|
|
173
|
+
* Skip rendering template on the first page.
|
|
174
|
+
*/
|
|
175
|
+
skipFirstPage(): WasmPageTemplate;
|
|
118
176
|
}
|
|
119
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Create new PDF documents from Markdown, HTML, or plain text.
|
|
180
|
+
*
|
|
181
|
+
* ```javascript
|
|
182
|
+
* const pdf = WasmPdf.fromMarkdown("# Hello\n\nWorld");
|
|
183
|
+
* const bytes = pdf.toBytes(); // Uint8Array
|
|
184
|
+
* console.log(`PDF size: ${pdf.size} bytes`);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
120
187
|
export class WasmPdf {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
188
|
+
private constructor();
|
|
189
|
+
free(): void;
|
|
190
|
+
[Symbol.dispose](): void;
|
|
191
|
+
/**
|
|
192
|
+
* Open an existing PDF from bytes for editing.
|
|
193
|
+
*
|
|
194
|
+
* @param data - PDF file contents as Uint8Array
|
|
195
|
+
* @returns WasmPdf for editing
|
|
196
|
+
*/
|
|
197
|
+
static fromBytes(data: Uint8Array): WasmPdf;
|
|
198
|
+
/**
|
|
199
|
+
* Create a PDF from HTML content.
|
|
200
|
+
*
|
|
201
|
+
* @param content - HTML string
|
|
202
|
+
* @param title - Optional document title
|
|
203
|
+
* @param author - Optional document author
|
|
204
|
+
*/
|
|
205
|
+
static fromHtml(content: string, title?: string | null, author?: string | null): WasmPdf;
|
|
206
|
+
/**
|
|
207
|
+
* Create a PDF from image bytes (PNG, JPEG, etc.).
|
|
208
|
+
*
|
|
209
|
+
* @param data - Image file contents as a Uint8Array
|
|
210
|
+
*/
|
|
211
|
+
static fromImageBytes(data: Uint8Array): WasmPdf;
|
|
212
|
+
/**
|
|
213
|
+
* Create a PDF from Markdown content.
|
|
214
|
+
*
|
|
215
|
+
* @param content - Markdown string
|
|
216
|
+
* @param title - Optional document title
|
|
217
|
+
* @param author - Optional document author
|
|
218
|
+
*/
|
|
219
|
+
static fromMarkdown(content: string, title?: string | null, author?: string | null): WasmPdf;
|
|
220
|
+
/**
|
|
221
|
+
* Create a PDF from multiple image byte arrays.
|
|
222
|
+
*
|
|
223
|
+
* Each image becomes a separate page. Pass an array of Uint8Arrays.
|
|
224
|
+
*
|
|
225
|
+
* @param images_array - Array of Uint8Arrays, each containing image file bytes (PNG/JPEG)
|
|
226
|
+
*/
|
|
227
|
+
static fromMultipleImageBytes(images_array: any): WasmPdf;
|
|
228
|
+
/**
|
|
229
|
+
* Create a PDF from plain text.
|
|
230
|
+
*
|
|
231
|
+
* @param content - Plain text string
|
|
232
|
+
* @param title - Optional document title
|
|
233
|
+
* @param author - Optional document author
|
|
234
|
+
*/
|
|
235
|
+
static fromText(content: string, title?: string | null, author?: string | null): WasmPdf;
|
|
236
|
+
/**
|
|
237
|
+
* Merge multiple PDF byte arrays into a single PDF.
|
|
238
|
+
*
|
|
239
|
+
* @param pdfs - Array of Uint8Array, each containing a PDF
|
|
240
|
+
* @returns WasmPdf containing all pages
|
|
241
|
+
*/
|
|
242
|
+
static merge(pdfs: Uint8Array[]): WasmPdf;
|
|
243
|
+
/**
|
|
244
|
+
* Get the PDF as a Uint8Array.
|
|
245
|
+
*/
|
|
246
|
+
toBytes(): Uint8Array;
|
|
247
|
+
/**
|
|
248
|
+
* Get the size of the PDF in bytes.
|
|
249
|
+
*/
|
|
250
|
+
readonly size: number;
|
|
177
251
|
}
|
|
178
252
|
|
|
253
|
+
/**
|
|
254
|
+
* A PDF document loaded from bytes for use in WebAssembly.
|
|
255
|
+
*
|
|
256
|
+
* Create an instance by passing PDF file bytes to the constructor.
|
|
257
|
+
* Call `.free()` when done to release memory.
|
|
258
|
+
*/
|
|
179
259
|
export class WasmPdfDocument {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
260
|
+
free(): void;
|
|
261
|
+
[Symbol.dispose](): void;
|
|
262
|
+
/**
|
|
263
|
+
* Apply all redactions in the document.
|
|
264
|
+
*/
|
|
265
|
+
applyAllRedactions(): void;
|
|
266
|
+
/**
|
|
267
|
+
* Apply redactions on a page (removes redacted content permanently).
|
|
268
|
+
*/
|
|
269
|
+
applyPageRedactions(page_index: number): void;
|
|
270
|
+
/**
|
|
271
|
+
* Authenticate with a password to decrypt an encrypted PDF.
|
|
272
|
+
*
|
|
273
|
+
* @param password - The password string
|
|
274
|
+
* @returns true if authentication succeeded
|
|
275
|
+
*/
|
|
276
|
+
authenticate(password: string): boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Clear all pending erase operations for a page.
|
|
279
|
+
*/
|
|
280
|
+
clearEraseRegions(page_index: number): void;
|
|
281
|
+
/**
|
|
282
|
+
* Crop margins from all pages.
|
|
283
|
+
*/
|
|
284
|
+
cropMargins(left: number, right: number, top: number, bottom: number): void;
|
|
285
|
+
/**
|
|
286
|
+
* Delete a page by index (0-based).
|
|
287
|
+
*/
|
|
288
|
+
deletePage(index: number): void;
|
|
289
|
+
/**
|
|
290
|
+
* Deprecated: Use eraseFooter instead.
|
|
291
|
+
*/
|
|
292
|
+
editFooter(page_index: number): void;
|
|
293
|
+
/**
|
|
294
|
+
* Deprecated: Use eraseHeader instead.
|
|
295
|
+
*/
|
|
296
|
+
editHeader(page_index: number): void;
|
|
297
|
+
/**
|
|
298
|
+
* Embed a file into the PDF document.
|
|
299
|
+
*
|
|
300
|
+
* @param name - Display name for the embedded file
|
|
301
|
+
* @param data - File contents as a Uint8Array
|
|
302
|
+
*/
|
|
303
|
+
embedFile(name: string, data: Uint8Array): void;
|
|
304
|
+
/**
|
|
305
|
+
* Erase both header and footer content.
|
|
306
|
+
*
|
|
307
|
+
* @param page_index - Zero-based page number
|
|
308
|
+
*/
|
|
309
|
+
eraseArtifacts(page_index: number): void;
|
|
310
|
+
/**
|
|
311
|
+
* Erase existing footer content.
|
|
312
|
+
*
|
|
313
|
+
* Identifies existing text in the footer area (bottom 15%) and marks it for erasure.
|
|
314
|
+
*
|
|
315
|
+
* @param page_index - Zero-based page number
|
|
316
|
+
*/
|
|
317
|
+
eraseFooter(page_index: number): void;
|
|
318
|
+
/**
|
|
319
|
+
* Erase existing header content.
|
|
320
|
+
*
|
|
321
|
+
* Identifies existing text in the header area (top 15%) and marks it for erasure.
|
|
322
|
+
*
|
|
323
|
+
* @param page_index - Zero-based page number
|
|
324
|
+
*/
|
|
325
|
+
eraseHeader(page_index: number): void;
|
|
326
|
+
/**
|
|
327
|
+
* Erase (whiteout) a rectangular region on a page.
|
|
328
|
+
*/
|
|
329
|
+
eraseRegion(page_index: number, llx: number, lly: number, urx: number, ury: number): void;
|
|
330
|
+
/**
|
|
331
|
+
* Erase multiple rectangular regions on a page.
|
|
332
|
+
*
|
|
333
|
+
* @param page_index - Zero-based page number
|
|
334
|
+
* @param rects - Flat array of coordinates [llx1,lly1,urx1,ury1, llx2,lly2,urx2,ury2, ...]
|
|
335
|
+
*/
|
|
336
|
+
eraseRegions(page_index: number, rects: Float32Array): void;
|
|
337
|
+
/**
|
|
338
|
+
* Export form field data as FDF or XFDF bytes.
|
|
339
|
+
*
|
|
340
|
+
* @param format - "fdf" or "xfdf" (default: "fdf")
|
|
341
|
+
* @returns Uint8Array containing the exported form data
|
|
342
|
+
*/
|
|
343
|
+
exportFormData(format?: string | null): Uint8Array;
|
|
344
|
+
/**
|
|
345
|
+
* Extract plain text from all pages, separated by form feed characters.
|
|
346
|
+
*/
|
|
347
|
+
extractAllText(): string;
|
|
348
|
+
/**
|
|
349
|
+
* Extract character-level data from a page.
|
|
350
|
+
*
|
|
351
|
+
* Returns an array of objects with: char, bbox {x, y, width, height},
|
|
352
|
+
* font_name, font_size, font_weight, is_italic, color {r, g, b}, etc.
|
|
353
|
+
*
|
|
354
|
+
* @param page_index - Zero-based page number
|
|
355
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
356
|
+
*/
|
|
357
|
+
extractChars(page_index: number, region?: Float32Array | null): any;
|
|
358
|
+
/**
|
|
359
|
+
* Extract image bytes from a page as PNG data.
|
|
360
|
+
*
|
|
361
|
+
* Returns an array of objects with: width, height, data (Uint8Array of PNG bytes), format ("png").
|
|
362
|
+
*/
|
|
363
|
+
extractImageBytes(page_index: number): any;
|
|
364
|
+
/**
|
|
365
|
+
* Extract image metadata from a page.
|
|
366
|
+
*
|
|
367
|
+
* Returns an array of objects with: width, height, color_space,
|
|
368
|
+
* bits_per_component, bbox (if available). Does NOT return raw image bytes.
|
|
369
|
+
*
|
|
370
|
+
* @param page_index - Zero-based page number
|
|
371
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
372
|
+
*/
|
|
373
|
+
extractImages(page_index: number, region?: Float32Array | null): any;
|
|
374
|
+
/**
|
|
375
|
+
* Extract only straight lines from a page (v0.3.14).
|
|
376
|
+
*
|
|
377
|
+
* Identifies paths that form a single straight line segment.
|
|
378
|
+
*
|
|
379
|
+
* @param page_index - Zero-based page number
|
|
380
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
381
|
+
* @returns Array of path objects
|
|
382
|
+
*/
|
|
383
|
+
extractLines(page_index: number, region?: Float32Array | null): any;
|
|
384
|
+
/**
|
|
385
|
+
* Extract complete page text data in a single call.
|
|
386
|
+
*
|
|
387
|
+
* Returns `{ spans, chars, page_width, page_height }`.
|
|
388
|
+
* The `chars` are derived from spans using font-metric widths when available.
|
|
389
|
+
*
|
|
390
|
+
* Optional `reading_order`: `"column_aware"` for XY-Cut column detection,
|
|
391
|
+
* or `"top_to_bottom"` (default).
|
|
392
|
+
*/
|
|
393
|
+
extractPageText(page_index: number, reading_order?: string | null): any;
|
|
394
|
+
/**
|
|
395
|
+
* Extract specific pages to a new PDF (returns bytes).
|
|
396
|
+
*/
|
|
397
|
+
extractPages(pages: Uint32Array): Uint8Array;
|
|
398
|
+
/**
|
|
399
|
+
* Extract vector paths (lines, curves, shapes) from a page.
|
|
400
|
+
*
|
|
401
|
+
* @param page_index - Zero-based page number
|
|
402
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
403
|
+
* @returns Array of path objects with bbox, stroke_color, fill_color, etc.
|
|
404
|
+
*/
|
|
405
|
+
extractPaths(page_index: number, region?: Float32Array | null): any;
|
|
406
|
+
/**
|
|
407
|
+
* Extract only rectangles from a page (v0.3.14).
|
|
408
|
+
*
|
|
409
|
+
* Identifies paths that form axis-aligned rectangles.
|
|
410
|
+
*
|
|
411
|
+
* @param page_index - Zero-based page number
|
|
412
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
413
|
+
* @returns Array of path objects
|
|
414
|
+
*/
|
|
415
|
+
extractRects(page_index: number, region?: Float32Array | null): any;
|
|
416
|
+
/**
|
|
417
|
+
* Extract span-level data from a page.
|
|
418
|
+
*
|
|
419
|
+
* Returns an array of objects with: text, bbox, font_name, font_size,
|
|
420
|
+
* font_weight, is_italic, color, etc.
|
|
421
|
+
*
|
|
422
|
+
* Optional `reading_order`: `"column_aware"` for XY-Cut column detection,
|
|
423
|
+
* or `"top_to_bottom"` (default).
|
|
424
|
+
*/
|
|
425
|
+
extractSpans(page_index: number, region?: Float32Array | null, reading_order?: string | null): any;
|
|
426
|
+
/**
|
|
427
|
+
* Extract tables from a page (v0.3.14).
|
|
428
|
+
*
|
|
429
|
+
* @param page_index - Zero-based page number
|
|
430
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
431
|
+
*/
|
|
432
|
+
extractTables(page_index: number, region?: Float32Array | null): any;
|
|
433
|
+
/**
|
|
434
|
+
* Extract plain text from a single page.
|
|
435
|
+
*
|
|
436
|
+
* @param page_index - Zero-based page number
|
|
437
|
+
* @param region - Optional [x, y, width, height] to filter by
|
|
438
|
+
*/
|
|
439
|
+
extractText(page_index: number, region: any): string;
|
|
440
|
+
/**
|
|
441
|
+
* Extract text lines from a page.
|
|
442
|
+
*
|
|
443
|
+
* Returns an array of objects with: text, bbox, words (array of Word objects).
|
|
444
|
+
*/
|
|
445
|
+
extractTextLines(page_index: number, region?: Float32Array | null): any;
|
|
446
|
+
/**
|
|
447
|
+
* Extract text using OCR (optical character recognition).
|
|
448
|
+
*
|
|
449
|
+
* NOTE: OCR is not yet supported in the WebAssembly build due to missing
|
|
450
|
+
* ONNX Runtime support for the web backend in the current implementation.
|
|
451
|
+
*/
|
|
452
|
+
extractTextOcr(_page_index: number, _engine?: WasmOcrEngine | null): string;
|
|
453
|
+
/**
|
|
454
|
+
* Extract word-level data from a page.
|
|
455
|
+
*
|
|
456
|
+
* Returns an array of objects with: text, bbox, font_name, font_size,
|
|
457
|
+
* font_weight, is_italic, is_bold.
|
|
458
|
+
*/
|
|
459
|
+
extractWords(page_index: number, region?: Float32Array | null): any;
|
|
460
|
+
/**
|
|
461
|
+
* Flatten all annotations in the document into page content.
|
|
462
|
+
*/
|
|
463
|
+
flattenAllAnnotations(): void;
|
|
464
|
+
/**
|
|
465
|
+
* Flatten all form fields into page content.
|
|
466
|
+
*
|
|
467
|
+
* After flattening, form field values become static text and are no longer editable.
|
|
468
|
+
*/
|
|
469
|
+
flattenForms(): void;
|
|
470
|
+
/**
|
|
471
|
+
* Flatten form fields on a specific page.
|
|
472
|
+
*
|
|
473
|
+
* @param page_index - Zero-based page number
|
|
474
|
+
*/
|
|
475
|
+
flattenFormsOnPage(page_index: number): void;
|
|
476
|
+
/**
|
|
477
|
+
* Flatten annotations on a page into the page content.
|
|
478
|
+
*/
|
|
479
|
+
flattenPageAnnotations(page_index: number): void;
|
|
480
|
+
/**
|
|
481
|
+
* Get annotations from a page.
|
|
482
|
+
*
|
|
483
|
+
* @param page_index - Zero-based page number
|
|
484
|
+
* @returns Array of annotation objects with fields like subtype, rect, contents, etc.
|
|
485
|
+
*/
|
|
486
|
+
getAnnotations(page_index: number): any;
|
|
487
|
+
/**
|
|
488
|
+
* Get the value of a specific form field by name.
|
|
489
|
+
*
|
|
490
|
+
* @param name - Full qualified field name (e.g., "name" or "topmostSubform[0].Page1[0].f1_01[0]")
|
|
491
|
+
* @returns The field value: string for text, boolean for checkbox, null if not found
|
|
492
|
+
*/
|
|
493
|
+
getFormFieldValue(name: string): any;
|
|
494
|
+
/**
|
|
495
|
+
* Get all form fields from the document.
|
|
496
|
+
*
|
|
497
|
+
* Returns an array of form field objects, each with:
|
|
498
|
+
* - name: Full qualified field name
|
|
499
|
+
* - field_type: "text", "button", "choice", "signature", or "unknown"
|
|
500
|
+
* - value: string, boolean, array of strings, or null
|
|
501
|
+
* - tooltip: string or null
|
|
502
|
+
* - bounds: [x1, y1, x2, y2] or null
|
|
503
|
+
* - flags: number or null
|
|
504
|
+
* - max_length: number or null
|
|
505
|
+
* - is_readonly: boolean
|
|
506
|
+
* - is_required: boolean
|
|
507
|
+
*/
|
|
508
|
+
getFormFields(): any;
|
|
509
|
+
/**
|
|
510
|
+
* Get the document outline (bookmarks / table of contents).
|
|
511
|
+
*
|
|
512
|
+
* @returns Array of outline items or null if no outline exists.
|
|
513
|
+
* Each item has: { title, page (number|null), dest_name (string, optional), children (array) }
|
|
514
|
+
*/
|
|
515
|
+
getOutline(): any;
|
|
516
|
+
/**
|
|
517
|
+
* Check if the document has a structure tree (Tagged PDF).
|
|
518
|
+
*/
|
|
519
|
+
hasStructureTree(): boolean;
|
|
520
|
+
/**
|
|
521
|
+
* Check if the document contains XFA form data.
|
|
522
|
+
*
|
|
523
|
+
* @returns true if the document has XFA form data
|
|
524
|
+
*/
|
|
525
|
+
hasXfa(): boolean;
|
|
526
|
+
/**
|
|
527
|
+
* Merge another PDF (provided as bytes) into this document.
|
|
528
|
+
*
|
|
529
|
+
* @param data - The PDF file contents to merge as a Uint8Array
|
|
530
|
+
* @returns Number of pages merged
|
|
531
|
+
*/
|
|
532
|
+
mergeFrom(data: Uint8Array): number;
|
|
533
|
+
/**
|
|
534
|
+
* Load a PDF document from raw bytes.
|
|
535
|
+
*
|
|
536
|
+
* @param data - PDF file contents as Uint8Array
|
|
537
|
+
* @param password - Optional password for encrypted PDFs
|
|
538
|
+
* @throws Error if the PDF is invalid or cannot be parsed
|
|
539
|
+
*/
|
|
540
|
+
constructor(data: Uint8Array, password?: string | null);
|
|
541
|
+
/**
|
|
542
|
+
* Get the number of pages in the document.
|
|
543
|
+
*/
|
|
544
|
+
pageCount(): number;
|
|
545
|
+
/**
|
|
546
|
+
* Get the CropBox of a page as [llx, lly, urx, ury], or null if not set.
|
|
547
|
+
*/
|
|
548
|
+
pageCropBox(page_index: number): any;
|
|
549
|
+
/**
|
|
550
|
+
* Get information about images on a page.
|
|
551
|
+
*
|
|
552
|
+
* Returns an array of {name, bounds: [x, y, width, height], matrix: [a, b, c, d, e, f]}.
|
|
553
|
+
*/
|
|
554
|
+
pageImages(page_index: number): any;
|
|
555
|
+
/**
|
|
556
|
+
* Get page label ranges from the document.
|
|
557
|
+
*
|
|
558
|
+
* @returns Array of {start_page, style, prefix, start_value} objects, or empty array
|
|
559
|
+
*/
|
|
560
|
+
pageLabels(): any;
|
|
561
|
+
/**
|
|
562
|
+
* Get the MediaBox of a page as [llx, lly, urx, ury].
|
|
563
|
+
*/
|
|
564
|
+
pageMediaBox(page_index: number): Float32Array;
|
|
565
|
+
/**
|
|
566
|
+
* Get the rotation of a page in degrees (0, 90, 180, 270).
|
|
567
|
+
*/
|
|
568
|
+
pageRotation(page_index: number): number;
|
|
569
|
+
/**
|
|
570
|
+
* Identify and remove both headers and footers.
|
|
571
|
+
*
|
|
572
|
+
* Prioritizes ISO 32000 spec-compliant /Artifact tags, with a heuristic
|
|
573
|
+
* fallback for untagged PDFs.
|
|
574
|
+
*
|
|
575
|
+
* @param threshold - Fraction of pages (0.0-1.0) where text must repeat (heuristic mode)
|
|
576
|
+
*/
|
|
577
|
+
removeArtifacts(threshold: number): number;
|
|
578
|
+
/**
|
|
579
|
+
* Identify and remove footers.
|
|
580
|
+
*
|
|
581
|
+
* Uses spec-compliant /Artifact tags when available (100% accuracy), or
|
|
582
|
+
* falls back to heuristic analysis of the bottom 15% of pages.
|
|
583
|
+
*
|
|
584
|
+
* @param threshold - Fraction of pages (0.0-1.0) where text must repeat (heuristic mode)
|
|
585
|
+
*/
|
|
586
|
+
removeFooters(threshold: number): number;
|
|
587
|
+
/**
|
|
588
|
+
* Identify and remove headers.
|
|
589
|
+
*
|
|
590
|
+
* Uses spec-compliant /Artifact tags when available (100% accuracy), or
|
|
591
|
+
* falls back to heuristic analysis of the top 15% of pages.
|
|
592
|
+
*
|
|
593
|
+
* @param threshold - Fraction of pages (0.0-1.0) where text must repeat (heuristic mode)
|
|
594
|
+
*/
|
|
595
|
+
removeHeaders(threshold: number): number;
|
|
596
|
+
/**
|
|
597
|
+
* Reposition an image on a page.
|
|
598
|
+
*/
|
|
599
|
+
repositionImage(page_index: number, name: string, x: number, y: number): void;
|
|
600
|
+
/**
|
|
601
|
+
* Resize an image on a page.
|
|
602
|
+
*/
|
|
603
|
+
resizeImage(page_index: number, name: string, width: number, height: number): void;
|
|
604
|
+
/**
|
|
605
|
+
* Rotate all pages by the given degrees.
|
|
606
|
+
*/
|
|
607
|
+
rotateAllPages(degrees: number): void;
|
|
608
|
+
/**
|
|
609
|
+
* Rotate a page by the given degrees (adds to current rotation).
|
|
610
|
+
*/
|
|
611
|
+
rotatePage(page_index: number, degrees: number): void;
|
|
612
|
+
/**
|
|
613
|
+
* Save all edits and return the resulting PDF as bytes.
|
|
614
|
+
*
|
|
615
|
+
* @returns Uint8Array containing the modified PDF
|
|
616
|
+
*/
|
|
617
|
+
save(): Uint8Array;
|
|
618
|
+
/**
|
|
619
|
+
* Save with encryption and return the resulting PDF as bytes.
|
|
620
|
+
*/
|
|
621
|
+
saveEncryptedToBytes(user_password: string, owner_password?: string | null, allow_print?: boolean | null, allow_copy?: boolean | null, allow_modify?: boolean | null, allow_annotate?: boolean | null): Uint8Array;
|
|
622
|
+
/**
|
|
623
|
+
* Save the modified PDF and return as bytes.
|
|
624
|
+
* `saveToBytes()` is the original method; `save()` is a convenience alias.
|
|
625
|
+
*
|
|
626
|
+
* @returns Uint8Array containing the modified PDF
|
|
627
|
+
*/
|
|
628
|
+
saveToBytes(): Uint8Array;
|
|
629
|
+
/**
|
|
630
|
+
* Search for text across all pages.
|
|
631
|
+
*
|
|
632
|
+
* @param pattern - Regex pattern or literal text to search for
|
|
633
|
+
* @param case_insensitive - Case insensitive search (default: false)
|
|
634
|
+
* @param literal - Treat pattern as literal text, not regex (default: false)
|
|
635
|
+
* @param whole_word - Match whole words only (default: false)
|
|
636
|
+
* @param max_results - Maximum results to return, 0 = unlimited (default: 0)
|
|
637
|
+
*
|
|
638
|
+
* Returns an array of {page, text, bbox, start_index, end_index, span_boxes}.
|
|
639
|
+
*/
|
|
640
|
+
search(pattern: string, case_insensitive?: boolean | null, literal?: boolean | null, whole_word?: boolean | null, max_results?: number | null): any;
|
|
641
|
+
/**
|
|
642
|
+
* Search for text on a specific page.
|
|
643
|
+
*/
|
|
644
|
+
searchPage(page_index: number, pattern: string, case_insensitive?: boolean | null, literal?: boolean | null, whole_word?: boolean | null, max_results?: number | null): any;
|
|
645
|
+
/**
|
|
646
|
+
* Set the document author.
|
|
647
|
+
*/
|
|
648
|
+
setAuthor(author: string): void;
|
|
649
|
+
/**
|
|
650
|
+
* Set the value of a form field.
|
|
651
|
+
*
|
|
652
|
+
* @param name - Full qualified field name
|
|
653
|
+
* @param value - New value: string for text fields, boolean for checkboxes
|
|
654
|
+
*/
|
|
655
|
+
setFormFieldValue(name: string, value: any): void;
|
|
656
|
+
/**
|
|
657
|
+
* Set the complete bounds of an image on a page.
|
|
658
|
+
*/
|
|
659
|
+
setImageBounds(page_index: number, name: string, x: number, y: number, width: number, height: number): void;
|
|
660
|
+
/**
|
|
661
|
+
* Set the document keywords.
|
|
662
|
+
*/
|
|
663
|
+
setKeywords(keywords: string): void;
|
|
664
|
+
/**
|
|
665
|
+
* Set the CropBox of a page.
|
|
666
|
+
*/
|
|
667
|
+
setPageCropBox(page_index: number, llx: number, lly: number, urx: number, ury: number): void;
|
|
668
|
+
/**
|
|
669
|
+
* Set the MediaBox of a page.
|
|
670
|
+
*/
|
|
671
|
+
setPageMediaBox(page_index: number, llx: number, lly: number, urx: number, ury: number): void;
|
|
672
|
+
/**
|
|
673
|
+
* Set the rotation of a page (0, 90, 180, or 270 degrees).
|
|
674
|
+
*/
|
|
675
|
+
setPageRotation(page_index: number, degrees: number): void;
|
|
676
|
+
/**
|
|
677
|
+
* Set the document subject.
|
|
678
|
+
*/
|
|
679
|
+
setSubject(subject: string): void;
|
|
680
|
+
/**
|
|
681
|
+
* Set the document title.
|
|
682
|
+
*/
|
|
683
|
+
setTitle(title: string): void;
|
|
684
|
+
/**
|
|
685
|
+
* Convert a single page to HTML.
|
|
686
|
+
*
|
|
687
|
+
* @param page_index - Zero-based page number
|
|
688
|
+
* @param preserve_layout - Use CSS positioning to preserve layout (default: false)
|
|
689
|
+
* @param detect_headings - Whether to detect headings (default: true)
|
|
690
|
+
*/
|
|
691
|
+
toHtml(page_index: number, preserve_layout?: boolean | null, detect_headings?: boolean | null, include_form_fields?: boolean | null): string;
|
|
692
|
+
/**
|
|
693
|
+
* Convert all pages to HTML.
|
|
694
|
+
*/
|
|
695
|
+
toHtmlAll(preserve_layout?: boolean | null, detect_headings?: boolean | null, include_form_fields?: boolean | null): string;
|
|
696
|
+
/**
|
|
697
|
+
* Convert a single page to Markdown.
|
|
698
|
+
*
|
|
699
|
+
* @param page_index - Zero-based page number
|
|
700
|
+
* @param detect_headings - Whether to detect headings (default: true)
|
|
701
|
+
* @param include_images - Whether to include images (default: false)
|
|
702
|
+
*/
|
|
703
|
+
toMarkdown(page_index: number, detect_headings?: boolean | null, include_images?: boolean | null, include_form_fields?: boolean | null): string;
|
|
704
|
+
/**
|
|
705
|
+
* Convert all pages to Markdown.
|
|
706
|
+
*/
|
|
707
|
+
toMarkdownAll(detect_headings?: boolean | null, include_images?: boolean | null, include_form_fields?: boolean | null): string;
|
|
708
|
+
/**
|
|
709
|
+
* Convert a single page to plain text (with layout preservation options).
|
|
710
|
+
*/
|
|
711
|
+
toPlainText(page_index: number): string;
|
|
712
|
+
/**
|
|
713
|
+
* Convert all pages to plain text.
|
|
714
|
+
*/
|
|
715
|
+
toPlainTextAll(): string;
|
|
716
|
+
/**
|
|
717
|
+
* Validate PDF/A compliance. Level: "1b", "2b", etc.
|
|
718
|
+
*/
|
|
719
|
+
validatePdfA(level: string): any;
|
|
720
|
+
/**
|
|
721
|
+
* Get the PDF version as [major, minor].
|
|
722
|
+
*/
|
|
723
|
+
version(): Uint8Array;
|
|
724
|
+
/**
|
|
725
|
+
* Focus extraction on a specific rectangular region of a page (v0.3.14).
|
|
726
|
+
*
|
|
727
|
+
* @param page_index - Zero-based page number
|
|
728
|
+
* @param region - [x, y, width, height] in points
|
|
729
|
+
*/
|
|
730
|
+
within(page_index: number, region: Float32Array): WasmPdfPageRegion;
|
|
731
|
+
/**
|
|
732
|
+
* Get XMP metadata from the document.
|
|
733
|
+
*
|
|
734
|
+
* @returns Object with XMP fields (dc_title, dc_creator, etc.) or null if no XMP
|
|
735
|
+
*/
|
|
736
|
+
xmpMetadata(): any;
|
|
644
737
|
}
|
|
645
738
|
|
|
739
|
+
/**
|
|
740
|
+
* A focused view of a PDF page region for scoped extraction (v0.3.14).
|
|
741
|
+
*/
|
|
646
742
|
export class WasmPdfPageRegion {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
743
|
+
private constructor();
|
|
744
|
+
free(): void;
|
|
745
|
+
[Symbol.dispose](): void;
|
|
746
|
+
/**
|
|
747
|
+
* Extract character-level data from this region.
|
|
748
|
+
*/
|
|
749
|
+
extractChars(): any;
|
|
750
|
+
/**
|
|
751
|
+
* Extract images from this region.
|
|
752
|
+
*/
|
|
753
|
+
extractImages(): any;
|
|
754
|
+
/**
|
|
755
|
+
* Extract straight lines from this region.
|
|
756
|
+
*/
|
|
757
|
+
extractLines(): any;
|
|
758
|
+
/**
|
|
759
|
+
* Extract vector paths from this region.
|
|
760
|
+
*/
|
|
761
|
+
extractPaths(): any;
|
|
762
|
+
/**
|
|
763
|
+
* Extract rectangles from this region.
|
|
764
|
+
*/
|
|
765
|
+
extractRects(): any;
|
|
766
|
+
/**
|
|
767
|
+
* Extract tables from this region.
|
|
768
|
+
*/
|
|
769
|
+
extractTables(): any;
|
|
770
|
+
/**
|
|
771
|
+
* Extract text from this region.
|
|
772
|
+
*/
|
|
773
|
+
extractText(): string;
|
|
774
|
+
/**
|
|
775
|
+
* Extract text lines from this region.
|
|
776
|
+
*/
|
|
777
|
+
extractTextLines(): any;
|
|
778
|
+
/**
|
|
779
|
+
* Extract text using OCR from this region.
|
|
780
|
+
*/
|
|
781
|
+
extractTextOcr(_engine?: WasmOcrEngine | null): string;
|
|
782
|
+
/**
|
|
783
|
+
* Extract words from this region.
|
|
784
|
+
*/
|
|
785
|
+
extractWords(): any;
|
|
690
786
|
}
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Disable all pdf_oxide log output — convenience wrapper for
|
|
790
|
+
* `setLogLevel("off")`.
|
|
791
|
+
*/
|
|
792
|
+
export function disableLogging(): void;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Set the maximum log level for pdf_oxide messages.
|
|
796
|
+
*
|
|
797
|
+
* Accepts one of: `"off"`, `"error"`, `"warn"` / `"warning"`, `"info"`,
|
|
798
|
+
* `"debug"`, `"trace"`. Case-insensitive. Default is `"off"` — the library
|
|
799
|
+
* is silent unless explicitly enabled.
|
|
800
|
+
*
|
|
801
|
+
* Logs are forwarded to the browser console (`console.log`, `console.warn`,
|
|
802
|
+
* `console.error`, etc.). Fixes issue #280.
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```javascript
|
|
806
|
+
* import init, { setLogLevel } from "pdf-oxide-wasm";
|
|
807
|
+
* await init();
|
|
808
|
+
* setLogLevel("warn");
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
export function setLogLevel(level: string): void;
|