@chialab/pdfjs-lib 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +29 -0
  2. package/dist/browser/FoxitDingbats-SB6TO3S5.js +9 -0
  3. package/dist/browser/FoxitFixed-UIGSMBQB.js +9 -0
  4. package/dist/browser/FoxitFixedBold-2PAEIZAT.js +9 -0
  5. package/dist/browser/FoxitFixedBoldItalic-OSQUQDEE.js +9 -0
  6. package/dist/browser/FoxitFixedItalic-W73RDK22.js +9 -0
  7. package/dist/browser/FoxitSerif-3HH3SOZF.js +9 -0
  8. package/dist/browser/FoxitSerifBold-HXP2QOO7.js +9 -0
  9. package/dist/browser/FoxitSerifBoldItalic-FZXLNWD7.js +9 -0
  10. package/dist/browser/FoxitSerifItalic-WQFHUBI2.js +9 -0
  11. package/dist/browser/FoxitSymbol-OVWU7LKS.js +9 -0
  12. package/dist/browser/LiberationMono-Regular-UUOCTXY2.js +9 -0
  13. package/dist/browser/LiberationSans-Bold-GSJN42N5.js +9 -0
  14. package/dist/browser/LiberationSans-BoldItalic-UCPQJ3L2.js +9 -0
  15. package/dist/browser/LiberationSans-Italic-6CIHEALY.js +9 -0
  16. package/dist/browser/LiberationSans-Regular-KIF3IRJY.js +9 -0
  17. package/dist/browser/LiberationSerif-Regular-ASQ2LI3D.js +9 -0
  18. package/dist/browser/chunk-DYHYQ33L.js +1775 -0
  19. package/dist/browser/chunk-O4UKW7AD.js +44 -0
  20. package/dist/browser/index.js +26324 -0
  21. package/dist/browser/worker.js +84242 -0
  22. package/dist/index.d.ts +10 -0
  23. package/dist/lib/AnnotationData.d.ts +204 -0
  24. package/dist/lib/Canvas.d.ts +17 -0
  25. package/dist/lib/PDFPageProxy.d.ts +1 -0
  26. package/dist/lib/Path2D.d.ts +72 -0
  27. package/dist/lib/StandardFontDataFactory.d.ts +14 -0
  28. package/dist/lib/SvgCanvasContext.d.ts +156 -0
  29. package/dist/lib/TextLayer.d.ts +51 -0
  30. package/dist/lib/polyfills.d.ts +0 -0
  31. package/dist/lib/utils.d.ts +13 -0
  32. package/dist/node/FoxitDingbats-65AZ2Z2V.js +9 -0
  33. package/dist/node/FoxitFixed-OZGLVVOQ.js +9 -0
  34. package/dist/node/FoxitFixedBold-37OOYMV7.js +9 -0
  35. package/dist/node/FoxitFixedBoldItalic-XYFHEG2V.js +9 -0
  36. package/dist/node/FoxitFixedItalic-MM7OSGS6.js +9 -0
  37. package/dist/node/FoxitSerif-MLMJQPRP.js +9 -0
  38. package/dist/node/FoxitSerifBold-AC7RJQWJ.js +9 -0
  39. package/dist/node/FoxitSerifBoldItalic-YCQ4CLKE.js +9 -0
  40. package/dist/node/FoxitSerifItalic-CXVTCST4.js +9 -0
  41. package/dist/node/FoxitSymbol-VUGMZN5C.js +9 -0
  42. package/dist/node/LiberationMono-Regular-KMFXXO3B.js +9 -0
  43. package/dist/node/LiberationSans-Bold-XSHQQBWB.js +9 -0
  44. package/dist/node/LiberationSans-BoldItalic-CTAZRFRL.js +9 -0
  45. package/dist/node/LiberationSans-Italic-WIOTUKLC.js +9 -0
  46. package/dist/node/LiberationSans-Regular-CDMMZL5S.js +9 -0
  47. package/dist/node/LiberationSerif-Regular-WAOWR76G.js +9 -0
  48. package/dist/node/chunk-7MW5RQZ5.js +30 -0
  49. package/dist/node/chunk-KTTVPO2G.js +1775 -0
  50. package/dist/node/index.js +26621 -0
  51. package/dist/node/worker.js +84242 -0
  52. package/dist/pdf.js/src/display/annotation_layer.d.ts +241 -0
  53. package/dist/pdf.js/src/display/annotation_storage.d.ts +99 -0
  54. package/dist/pdf.js/src/display/api.d.ts +1586 -0
  55. package/dist/pdf.js/src/display/canvas.d.ts +213 -0
  56. package/dist/pdf.js/src/display/canvas_factory.d.ts +27 -0
  57. package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +25 -0
  58. package/dist/pdf.js/src/display/display_utils.d.ts +247 -0
  59. package/dist/pdf.js/src/display/draw_layer.d.ts +26 -0
  60. package/dist/pdf.js/src/display/editor/alt_text.d.ts +34 -0
  61. package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +230 -0
  62. package/dist/pdf.js/src/display/editor/color_picker.d.ts +20 -0
  63. package/dist/pdf.js/src/display/editor/draw.d.ts +121 -0
  64. package/dist/pdf.js/src/display/editor/drawers/contour.d.ts +3 -0
  65. package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +31 -0
  66. package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +36 -0
  67. package/dist/pdf.js/src/display/editor/drawers/inkdraw.d.ts +129 -0
  68. package/dist/pdf.js/src/display/editor/drawers/outline.d.ts +19 -0
  69. package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +79 -0
  70. package/dist/pdf.js/src/display/editor/editor.d.ts +474 -0
  71. package/dist/pdf.js/src/display/editor/freetext.d.ts +59 -0
  72. package/dist/pdf.js/src/display/editor/highlight.d.ts +70 -0
  73. package/dist/pdf.js/src/display/editor/ink.d.ts +36 -0
  74. package/dist/pdf.js/src/display/editor/signature.d.ts +79 -0
  75. package/dist/pdf.js/src/display/editor/stamp.d.ts +48 -0
  76. package/dist/pdf.js/src/display/editor/toolbar.d.ts +21 -0
  77. package/dist/pdf.js/src/display/editor/tools.d.ts +424 -0
  78. package/dist/pdf.js/src/display/filter_factory.d.ts +29 -0
  79. package/dist/pdf.js/src/display/font_loader.d.ts +39 -0
  80. package/dist/pdf.js/src/display/metadata.d.ts +11 -0
  81. package/dist/pdf.js/src/display/node_utils.d.ts +32 -0
  82. package/dist/pdf.js/src/display/optional_content_config.d.ts +18 -0
  83. package/dist/pdf.js/src/display/pattern_helper.d.ts +73 -0
  84. package/dist/pdf.js/src/display/standard_fontdata_factory.d.ts +20 -0
  85. package/dist/pdf.js/src/display/svg_factory.d.ts +14 -0
  86. package/dist/pdf.js/src/display/text_layer.d.ts +85 -0
  87. package/dist/pdf.js/src/display/touch_manager.d.ts +14 -0
  88. package/dist/pdf.js/src/display/transport_stream.d.ts +67 -0
  89. package/dist/pdf.js/src/display/wasm_factory.d.ts +20 -0
  90. package/dist/pdf.js/src/display/worker_options.d.ts +25 -0
  91. package/dist/pdf.js/src/display/xfa_layer.d.ts +47 -0
  92. package/dist/pdf.js/src/display/xfa_text.d.ts +21 -0
  93. package/dist/pdf.js/src/interfaces.d.ts +122 -0
  94. package/dist/pdf.js/src/pdf.d.ts +55 -0
  95. package/dist/pdf.js/src/shared/image_utils.d.ts +17 -0
  96. package/dist/pdf.js/src/shared/message_handler.d.ts +48 -0
  97. package/dist/pdf.js/src/shared/murmurhash3.d.ts +7 -0
  98. package/dist/pdf.js/src/shared/scripting_utils.d.ts +16 -0
  99. package/dist/pdf.js/src/shared/util.d.ts +388 -0
  100. package/dist/pdf.js/web/interfaces.d.ts +167 -0
  101. package/dist/pdf.js/web/struct_tree_layer_builder.d.ts +25 -0
  102. package/dist/pdf.js/web/text_accessibility.d.ts +44 -0
  103. package/dist/pdf.js/web/ui_utils.d.ts +273 -0
  104. package/package.json +43 -0
@@ -0,0 +1,1586 @@
1
+ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
2
+ export type RefProxy = {
3
+ num: number;
4
+ gen: number;
5
+ };
6
+ /**
7
+ * Document initialization / loading parameters object.
8
+ */
9
+ export type DocumentInitParameters = {
10
+ /**
11
+ * - The URL of the PDF.
12
+ */
13
+ url?: string | URL | undefined;
14
+ /**
15
+ * -
16
+ * Binary PDF data.
17
+ * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
18
+ * BASE64-encoded, use `atob()` to convert it to a binary string first.
19
+ *
20
+ * NOTE: If TypedArrays are used they will generally be transferred to the
21
+ * worker-thread. This will help reduce main-thread memory usage, however
22
+ * it will take ownership of the TypedArrays.
23
+ */
24
+ data?: string | ArrayBuffer | number[] | TypedArray | undefined;
25
+ /**
26
+ * - Basic authentication headers.
27
+ */
28
+ httpHeaders?: Object | undefined;
29
+ /**
30
+ * - Indicates whether or not
31
+ * cross-site Access-Control requests should be made using credentials such
32
+ * as cookies or authorization headers. The default is `false`.
33
+ */
34
+ withCredentials?: boolean | undefined;
35
+ /**
36
+ * - For decrypting password-protected PDFs.
37
+ */
38
+ password?: string | undefined;
39
+ /**
40
+ * - The PDF file length. It's used for progress
41
+ * reports and range requests operations.
42
+ */
43
+ length?: number | undefined;
44
+ /**
45
+ * - Allows for using a custom range
46
+ * transport implementation.
47
+ */
48
+ range?: PDFDataRangeTransport | undefined;
49
+ /**
50
+ * - Specify maximum number of bytes fetched
51
+ * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
52
+ */
53
+ rangeChunkSize?: number | undefined;
54
+ /**
55
+ * - The worker that will be used for loading and
56
+ * parsing the PDF data.
57
+ */
58
+ worker?: PDFWorker | undefined;
59
+ /**
60
+ * - Controls the logging level; the constants
61
+ * from {@link VerbosityLevel} should be used.
62
+ */
63
+ verbosity?: number | undefined;
64
+ /**
65
+ * - The base URL of the document, used when
66
+ * attempting to recover valid absolute URLs for annotations, and outline
67
+ * items, that (incorrectly) only specify relative URLs.
68
+ */
69
+ docBaseUrl?: string | undefined;
70
+ /**
71
+ * - The URL where the predefined Adobe CMaps are
72
+ * located. Include the trailing slash.
73
+ */
74
+ cMapUrl?: string | undefined;
75
+ /**
76
+ * - Specifies if the Adobe CMaps are binary
77
+ * packed or not. The default value is `true`.
78
+ */
79
+ cMapPacked?: boolean | undefined;
80
+ /**
81
+ * - The factory that will be used when
82
+ * reading built-in CMap files.
83
+ * The default value is {DOMCMapReaderFactory}.
84
+ */
85
+ CMapReaderFactory?: Object | undefined;
86
+ /**
87
+ * - When `true`, fonts that aren't
88
+ * embedded in the PDF document will fallback to a system font.
89
+ * The default value is `true` in web environments and `false` in Node.js;
90
+ * unless `disableFontFace === true` in which case this defaults to `false`
91
+ * regardless of the environment (to prevent completely broken fonts).
92
+ */
93
+ useSystemFonts?: boolean | undefined;
94
+ /**
95
+ * - The URL where the standard font
96
+ * files are located. Include the trailing slash.
97
+ */
98
+ standardFontDataUrl?: string | undefined;
99
+ /**
100
+ * - The factory that will be used
101
+ * when reading the standard font files.
102
+ * The default value is {DOMStandardFontDataFactory}.
103
+ */
104
+ StandardFontDataFactory?: Object | undefined;
105
+ /**
106
+ * - The URL where the wasm files are located.
107
+ * Include the trailing slash.
108
+ */
109
+ wasmUrl?: string | undefined;
110
+ /**
111
+ * - The factory that will be used
112
+ * when reading the wasm files.
113
+ * The default value is {DOMWasmFactory}.
114
+ */
115
+ WasmFactory?: Object | undefined;
116
+ /**
117
+ * - Enable using the Fetch API in the
118
+ * worker-thread when reading CMap and standard font files. When `true`,
119
+ * the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory`
120
+ * options are ignored.
121
+ * The default value is `true` in web environments and `false` in Node.js.
122
+ */
123
+ useWorkerFetch?: boolean | undefined;
124
+ /**
125
+ * - Attempt to use WebAssembly in order to
126
+ * improve e.g. image decoding performance.
127
+ * The default value is `true`.
128
+ */
129
+ useWasm?: boolean | undefined;
130
+ /**
131
+ * - Reject certain promises, e.g.
132
+ * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
133
+ * PDF data cannot be successfully parsed, instead of attempting to recover
134
+ * whatever possible of the data. The default value is `false`.
135
+ */
136
+ stopAtErrors?: boolean | undefined;
137
+ /**
138
+ * - The maximum allowed image size in total
139
+ * pixels, i.e. width * height. Images above this value will not be rendered.
140
+ * Use -1 for no limit, which is also the default value.
141
+ */
142
+ maxImageSize?: number | undefined;
143
+ /**
144
+ * - Determines if we can evaluate strings
145
+ * as JavaScript. Primarily used to improve performance of PDF functions.
146
+ * The default value is `true`.
147
+ */
148
+ isEvalSupported?: boolean | undefined;
149
+ /**
150
+ * - Determines if we can use
151
+ * `OffscreenCanvas` in the worker. Primarily used to improve performance of
152
+ * image conversion/rendering.
153
+ * The default value is `true` in web environments and `false` in Node.js.
154
+ */
155
+ isOffscreenCanvasSupported?: boolean | undefined;
156
+ /**
157
+ * - Determines if we can use
158
+ * `ImageDecoder` in the worker. Primarily used to improve performance of
159
+ * image conversion/rendering.
160
+ * The default value is `true` in web environments and `false` in Node.js.
161
+ *
162
+ * NOTE: Also temporarily disabled in Chromium browsers, until we no longer
163
+ * support the affected browser versions, because of various bugs:
164
+ *
165
+ * - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
166
+ * see https://issues.chromium.org/issues/374807001
167
+ *
168
+ * - Broken images when using the JPEG decoder with images that have custom
169
+ * colour profiles, e.g. GitHub discussion 19030;
170
+ * see https://issues.chromium.org/issues/378869810
171
+ */
172
+ isImageDecoderSupported?: boolean | undefined;
173
+ /**
174
+ * - The integer value is used to
175
+ * know when an image must be resized (uses `OffscreenCanvas` in the worker).
176
+ * If it's -1 then a possibly slow algorithm is used to guess the max value.
177
+ */
178
+ canvasMaxAreaInBytes?: number | undefined;
179
+ /**
180
+ * - By default fonts are converted to
181
+ * OpenType fonts and loaded via the Font Loading API or `@font-face` rules.
182
+ * If disabled, fonts will be rendered using a built-in font renderer that
183
+ * constructs the glyphs with primitive path commands.
184
+ * The default value is `false` in web environments and `true` in Node.js.
185
+ */
186
+ disableFontFace?: boolean | undefined;
187
+ /**
188
+ * - Include additional properties,
189
+ * which are unused during rendering of PDF documents, when exporting the
190
+ * parsed font data from the worker-thread. This may be useful for debugging
191
+ * purposes (and backwards compatibility), but note that it will lead to
192
+ * increased memory usage. The default value is `false`.
193
+ */
194
+ fontExtraProperties?: boolean | undefined;
195
+ /**
196
+ * - Render Xfa forms if any.
197
+ * The default value is `false`.
198
+ */
199
+ enableXfa?: boolean | undefined;
200
+ /**
201
+ * - Specify an explicit document
202
+ * context to create elements with and to load resources, such as fonts,
203
+ * into. Defaults to the current document.
204
+ */
205
+ ownerDocument?: HTMLDocument | undefined;
206
+ /**
207
+ * - Disable range request loading of PDF
208
+ * files. When enabled, and if the server supports partial content requests,
209
+ * then the PDF will be fetched in chunks. The default value is `false`.
210
+ */
211
+ disableRange?: boolean | undefined;
212
+ /**
213
+ * - Disable streaming of PDF file data.
214
+ * By default PDF.js attempts to load PDF files in chunks. The default value
215
+ * is `false`.
216
+ */
217
+ disableStream?: boolean | undefined;
218
+ /**
219
+ * - Disable pre-fetching of PDF file
220
+ * data. When range requests are enabled PDF.js will automatically keep
221
+ * fetching more data even if it isn't needed to display the current page.
222
+ * The default value is `false`.
223
+ *
224
+ * NOTE: It is also necessary to disable streaming, see above, in order for
225
+ * disabling of pre-fetching to work correctly.
226
+ */
227
+ disableAutoFetch?: boolean | undefined;
228
+ /**
229
+ * - Enables special hooks for debugging PDF.js
230
+ * (see `web/debugger.js`). The default value is `false`.
231
+ */
232
+ pdfBug?: boolean | undefined;
233
+ /**
234
+ * - The factory that will be used when
235
+ * creating canvases. The default value is {DOMCanvasFactory}.
236
+ */
237
+ CanvasFactory?: Object | undefined;
238
+ /**
239
+ * - The factory that will be used to
240
+ * create SVG filters when rendering some images on the main canvas.
241
+ * The default value is {DOMFilterFactory}.
242
+ */
243
+ FilterFactory?: Object | undefined;
244
+ /**
245
+ * - Enables hardware acceleration for
246
+ * rendering. The default value is `false`.
247
+ */
248
+ enableHWA?: boolean | undefined;
249
+ };
250
+ export type OnProgressParameters = {
251
+ /**
252
+ * - Currently loaded number of bytes.
253
+ */
254
+ loaded: number;
255
+ /**
256
+ * - Total number of bytes in the PDF file.
257
+ */
258
+ total: number;
259
+ };
260
+ /**
261
+ * Page getViewport parameters.
262
+ */
263
+ export type GetViewportParameters = {
264
+ /**
265
+ * - The desired scale of the viewport.
266
+ */
267
+ scale: number;
268
+ /**
269
+ * - The desired rotation, in degrees, of
270
+ * the viewport. If omitted it defaults to the page rotation.
271
+ */
272
+ rotation?: number | undefined;
273
+ /**
274
+ * - The horizontal, i.e. x-axis, offset.
275
+ * The default value is `0`.
276
+ */
277
+ offsetX?: number | undefined;
278
+ /**
279
+ * - The vertical, i.e. y-axis, offset.
280
+ * The default value is `0`.
281
+ */
282
+ offsetY?: number | undefined;
283
+ /**
284
+ * - If true, the y-axis will not be
285
+ * flipped. The default value is `false`.
286
+ */
287
+ dontFlip?: boolean | undefined;
288
+ };
289
+ /**
290
+ * Page getTextContent parameters.
291
+ */
292
+ export type getTextContentParameters = {
293
+ /**
294
+ * - When true include marked
295
+ * content items in the items array of TextContent. The default is `false`.
296
+ */
297
+ includeMarkedContent?: boolean | undefined;
298
+ /**
299
+ * - When true the text is *not*
300
+ * normalized in the worker-thread. The default is `false`.
301
+ */
302
+ disableNormalization?: boolean | undefined;
303
+ };
304
+ /**
305
+ * Page text content.
306
+ */
307
+ export type TextContent = {
308
+ /**
309
+ * - Array of
310
+ * {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent
311
+ * items are included when includeMarkedContent is true.
312
+ */
313
+ items: Array<TextItem | TextMarkedContent>;
314
+ /**
315
+ * - {@link TextStyle} objects,
316
+ * indexed by font name.
317
+ */
318
+ styles: {
319
+ [x: string]: TextStyle;
320
+ };
321
+ /**
322
+ * - The document /Lang attribute.
323
+ */
324
+ lang: string | null;
325
+ };
326
+ /**
327
+ * Page text content part.
328
+ */
329
+ export type TextItem = {
330
+ /**
331
+ * - Text content.
332
+ */
333
+ str: string;
334
+ /**
335
+ * - Text direction: 'ttb', 'ltr' or 'rtl'.
336
+ */
337
+ dir: string;
338
+ /**
339
+ * - Transformation matrix.
340
+ */
341
+ transform: Array<any>;
342
+ /**
343
+ * - Width in device space.
344
+ */
345
+ width: number;
346
+ /**
347
+ * - Height in device space.
348
+ */
349
+ height: number;
350
+ /**
351
+ * - Font name used by PDF.js for converted font.
352
+ */
353
+ fontName: string;
354
+ /**
355
+ * - Indicating if the text content is followed by a
356
+ * line-break.
357
+ */
358
+ hasEOL: boolean;
359
+ };
360
+ /**
361
+ * Page text marked content part.
362
+ */
363
+ export type TextMarkedContent = {
364
+ /**
365
+ * - Either 'beginMarkedContent',
366
+ * 'beginMarkedContentProps', or 'endMarkedContent'.
367
+ */
368
+ type: string;
369
+ /**
370
+ * - The marked content identifier. Only used for type
371
+ * 'beginMarkedContentProps'.
372
+ */
373
+ id: string;
374
+ };
375
+ /**
376
+ * Text style.
377
+ */
378
+ export type TextStyle = {
379
+ /**
380
+ * - Font ascent.
381
+ */
382
+ ascent: number;
383
+ /**
384
+ * - Font descent.
385
+ */
386
+ descent: number;
387
+ /**
388
+ * - Whether or not the text is in vertical mode.
389
+ */
390
+ vertical: boolean;
391
+ /**
392
+ * - The possible font family.
393
+ */
394
+ fontFamily: string;
395
+ };
396
+ /**
397
+ * Page annotation parameters.
398
+ */
399
+ export type GetAnnotationsParameters = {
400
+ /**
401
+ * - Determines the annotations that are fetched,
402
+ * can be 'display' (viewable annotations), 'print' (printable annotations),
403
+ * or 'any' (all annotations). The default value is 'display'.
404
+ */
405
+ intent?: string | undefined;
406
+ };
407
+ /**
408
+ * Page render parameters.
409
+ */
410
+ export type RenderParameters = {
411
+ /**
412
+ * - A 2D context of a DOM
413
+ * Canvas object.
414
+ */
415
+ canvasContext: CanvasRenderingContext2D;
416
+ /**
417
+ * - Rendering viewport obtained by calling
418
+ * the `PDFPageProxy.getViewport` method.
419
+ */
420
+ viewport: PageViewport;
421
+ /**
422
+ * - Rendering intent, can be 'display', 'print',
423
+ * or 'any'. The default value is 'display'.
424
+ */
425
+ intent?: string | undefined;
426
+ /**
427
+ * Controls which annotations are rendered
428
+ * onto the canvas, for annotations with appearance-data; the values from
429
+ * {@link AnnotationMode} should be used. The following values are supported:
430
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
431
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
432
+ * it also depends on the `intent`-option, see above).
433
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
434
+ * interactive form elements (those will be rendered in the display layer).
435
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
436
+ * (as above) but where interactive form elements are updated with data
437
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
438
+ * The default value is `AnnotationMode.ENABLE`.
439
+ */
440
+ annotationMode?: number | undefined;
441
+ /**
442
+ * - Additional transform, applied just
443
+ * before viewport transform.
444
+ */
445
+ transform?: any[] | undefined;
446
+ /**
447
+ * - Background
448
+ * to use for the canvas.
449
+ * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
450
+ * <color> value, a `CanvasGradient` object (a linear or radial gradient) or
451
+ * a `CanvasPattern` object (a repetitive image). The default value is
452
+ * 'rgb(255,255,255)'.
453
+ *
454
+ * NOTE: This option may be partially, or completely, ignored when the
455
+ * `pageColors`-option is used.
456
+ */
457
+ background?: string | CanvasGradient | CanvasPattern | undefined;
458
+ /**
459
+ * - Overwrites background and foreground colors
460
+ * with user defined ones in order to improve readability in high contrast
461
+ * mode.
462
+ */
463
+ pageColors?: Object | undefined;
464
+ /**
465
+ * -
466
+ * A promise that should resolve with an {@link OptionalContentConfig}created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
467
+ * the configuration will be fetched automatically with the default visibility
468
+ * states set.
469
+ */
470
+ optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
471
+ /**
472
+ * - Map some
473
+ * annotation ids with canvases used to render them.
474
+ */
475
+ annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
476
+ printAnnotationStorage?: PrintAnnotationStorage | undefined;
477
+ /**
478
+ * - Render the page in editing mode.
479
+ */
480
+ isEditing?: boolean | undefined;
481
+ };
482
+ /**
483
+ * Page getOperatorList parameters.
484
+ */
485
+ export type GetOperatorListParameters = {
486
+ /**
487
+ * - Rendering intent, can be 'display', 'print',
488
+ * or 'any'. The default value is 'display'.
489
+ */
490
+ intent?: string | undefined;
491
+ /**
492
+ * Controls which annotations are included
493
+ * in the operatorList, for annotations with appearance-data; the values from
494
+ * {@link AnnotationMode} should be used. The following values are supported:
495
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
496
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
497
+ * it also depends on the `intent`-option, see above).
498
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
499
+ * interactive form elements (those will be rendered in the display layer).
500
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
501
+ * (as above) but where interactive form elements are updated with data
502
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
503
+ * The default value is `AnnotationMode.ENABLE`.
504
+ */
505
+ annotationMode?: number | undefined;
506
+ printAnnotationStorage?: PrintAnnotationStorage | undefined;
507
+ /**
508
+ * - Render the page in editing mode.
509
+ */
510
+ isEditing?: boolean | undefined;
511
+ };
512
+ /**
513
+ * Structure tree node. The root node will have a role "Root".
514
+ */
515
+ export type StructTreeNode = {
516
+ /**
517
+ * - Array of
518
+ * {@link StructTreeNode} and {@link StructTreeContent} objects.
519
+ */
520
+ children: Array<StructTreeNode | StructTreeContent>;
521
+ /**
522
+ * - element's role, already mapped if a role map exists
523
+ * in the PDF.
524
+ */
525
+ role: string;
526
+ };
527
+ /**
528
+ * Structure tree content.
529
+ */
530
+ export type StructTreeContent = {
531
+ /**
532
+ * - either "content" for page and stream structure
533
+ * elements or "object" for object references.
534
+ */
535
+ type: string;
536
+ /**
537
+ * - unique id that will map to the text layer.
538
+ */
539
+ id: string;
540
+ };
541
+ /**
542
+ * PDF page operator list.
543
+ */
544
+ export type PDFOperatorList = {
545
+ /**
546
+ * - Array containing the operator functions.
547
+ */
548
+ fnArray: Array<number>;
549
+ /**
550
+ * - Array containing the arguments of the
551
+ * functions.
552
+ */
553
+ argsArray: Array<any>;
554
+ };
555
+ export type PDFWorkerParameters = {
556
+ /**
557
+ * - The name of the worker.
558
+ */
559
+ name?: string | undefined;
560
+ /**
561
+ * - The `workerPort` object.
562
+ */
563
+ port?: Worker | undefined;
564
+ /**
565
+ * - Controls the logging level;
566
+ * the constants from {@link VerbosityLevel} should be used.
567
+ */
568
+ verbosity?: number | undefined;
569
+ };
570
+ /** @type {string} */
571
+ export const build: string;
572
+ /**
573
+ * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
574
+ * Int16Array | Uint16Array |
575
+ * Int32Array | Uint32Array | Float32Array |
576
+ * Float64Array
577
+ * } TypedArray
578
+ */
579
+ /**
580
+ * @typedef {Object} RefProxy
581
+ * @property {number} num
582
+ * @property {number} gen
583
+ */
584
+ /**
585
+ * Document initialization / loading parameters object.
586
+ *
587
+ * @typedef {Object} DocumentInitParameters
588
+ * @property {string | URL} [url] - The URL of the PDF.
589
+ * @property {TypedArray | ArrayBuffer | Array<number> | string} [data] -
590
+ * Binary PDF data.
591
+ * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
592
+ * BASE64-encoded, use `atob()` to convert it to a binary string first.
593
+ *
594
+ * NOTE: If TypedArrays are used they will generally be transferred to the
595
+ * worker-thread. This will help reduce main-thread memory usage, however
596
+ * it will take ownership of the TypedArrays.
597
+ * @property {Object} [httpHeaders] - Basic authentication headers.
598
+ * @property {boolean} [withCredentials] - Indicates whether or not
599
+ * cross-site Access-Control requests should be made using credentials such
600
+ * as cookies or authorization headers. The default is `false`.
601
+ * @property {string} [password] - For decrypting password-protected PDFs.
602
+ * @property {number} [length] - The PDF file length. It's used for progress
603
+ * reports and range requests operations.
604
+ * @property {PDFDataRangeTransport} [range] - Allows for using a custom range
605
+ * transport implementation.
606
+ * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
607
+ * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
608
+ * @property {PDFWorker} [worker] - The worker that will be used for loading and
609
+ * parsing the PDF data.
610
+ * @property {number} [verbosity] - Controls the logging level; the constants
611
+ * from {@link VerbosityLevel} should be used.
612
+ * @property {string} [docBaseUrl] - The base URL of the document, used when
613
+ * attempting to recover valid absolute URLs for annotations, and outline
614
+ * items, that (incorrectly) only specify relative URLs.
615
+ * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are
616
+ * located. Include the trailing slash.
617
+ * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
618
+ * packed or not. The default value is `true`.
619
+ * @property {Object} [CMapReaderFactory] - The factory that will be used when
620
+ * reading built-in CMap files.
621
+ * The default value is {DOMCMapReaderFactory}.
622
+ * @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
623
+ * embedded in the PDF document will fallback to a system font.
624
+ * The default value is `true` in web environments and `false` in Node.js;
625
+ * unless `disableFontFace === true` in which case this defaults to `false`
626
+ * regardless of the environment (to prevent completely broken fonts).
627
+ * @property {string} [standardFontDataUrl] - The URL where the standard font
628
+ * files are located. Include the trailing slash.
629
+ * @property {Object} [StandardFontDataFactory] - The factory that will be used
630
+ * when reading the standard font files.
631
+ * The default value is {DOMStandardFontDataFactory}.
632
+ * @property {string} [wasmUrl] - The URL where the wasm files are located.
633
+ * Include the trailing slash.
634
+ * @property {Object} [WasmFactory] - The factory that will be used
635
+ * when reading the wasm files.
636
+ * The default value is {DOMWasmFactory}.
637
+ * @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the
638
+ * worker-thread when reading CMap and standard font files. When `true`,
639
+ * the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory`
640
+ * options are ignored.
641
+ * The default value is `true` in web environments and `false` in Node.js.
642
+ * @property {boolean} [useWasm] - Attempt to use WebAssembly in order to
643
+ * improve e.g. image decoding performance.
644
+ * The default value is `true`.
645
+ * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
646
+ * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
647
+ * PDF data cannot be successfully parsed, instead of attempting to recover
648
+ * whatever possible of the data. The default value is `false`.
649
+ * @property {number} [maxImageSize] - The maximum allowed image size in total
650
+ * pixels, i.e. width * height. Images above this value will not be rendered.
651
+ * Use -1 for no limit, which is also the default value.
652
+ * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
653
+ * as JavaScript. Primarily used to improve performance of PDF functions.
654
+ * The default value is `true`.
655
+ * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use
656
+ * `OffscreenCanvas` in the worker. Primarily used to improve performance of
657
+ * image conversion/rendering.
658
+ * The default value is `true` in web environments and `false` in Node.js.
659
+ * @property {boolean} [isImageDecoderSupported] - Determines if we can use
660
+ * `ImageDecoder` in the worker. Primarily used to improve performance of
661
+ * image conversion/rendering.
662
+ * The default value is `true` in web environments and `false` in Node.js.
663
+ *
664
+ * NOTE: Also temporarily disabled in Chromium browsers, until we no longer
665
+ * support the affected browser versions, because of various bugs:
666
+ *
667
+ * - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
668
+ * see https://issues.chromium.org/issues/374807001
669
+ *
670
+ * - Broken images when using the JPEG decoder with images that have custom
671
+ * colour profiles, e.g. GitHub discussion 19030;
672
+ * see https://issues.chromium.org/issues/378869810
673
+ *
674
+ * @property {number} [canvasMaxAreaInBytes] - The integer value is used to
675
+ * know when an image must be resized (uses `OffscreenCanvas` in the worker).
676
+ * If it's -1 then a possibly slow algorithm is used to guess the max value.
677
+ * @property {boolean} [disableFontFace] - By default fonts are converted to
678
+ * OpenType fonts and loaded via the Font Loading API or `@font-face` rules.
679
+ * If disabled, fonts will be rendered using a built-in font renderer that
680
+ * constructs the glyphs with primitive path commands.
681
+ * The default value is `false` in web environments and `true` in Node.js.
682
+ * @property {boolean} [fontExtraProperties] - Include additional properties,
683
+ * which are unused during rendering of PDF documents, when exporting the
684
+ * parsed font data from the worker-thread. This may be useful for debugging
685
+ * purposes (and backwards compatibility), but note that it will lead to
686
+ * increased memory usage. The default value is `false`.
687
+ * @property {boolean} [enableXfa] - Render Xfa forms if any.
688
+ * The default value is `false`.
689
+ * @property {HTMLDocument} [ownerDocument] - Specify an explicit document
690
+ * context to create elements with and to load resources, such as fonts,
691
+ * into. Defaults to the current document.
692
+ * @property {boolean} [disableRange] - Disable range request loading of PDF
693
+ * files. When enabled, and if the server supports partial content requests,
694
+ * then the PDF will be fetched in chunks. The default value is `false`.
695
+ * @property {boolean} [disableStream] - Disable streaming of PDF file data.
696
+ * By default PDF.js attempts to load PDF files in chunks. The default value
697
+ * is `false`.
698
+ * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file
699
+ * data. When range requests are enabled PDF.js will automatically keep
700
+ * fetching more data even if it isn't needed to display the current page.
701
+ * The default value is `false`.
702
+ *
703
+ * NOTE: It is also necessary to disable streaming, see above, in order for
704
+ * disabling of pre-fetching to work correctly.
705
+ * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
706
+ * (see `web/debugger.js`). The default value is `false`.
707
+ * @property {Object} [CanvasFactory] - The factory that will be used when
708
+ * creating canvases. The default value is {DOMCanvasFactory}.
709
+ * @property {Object} [FilterFactory] - The factory that will be used to
710
+ * create SVG filters when rendering some images on the main canvas.
711
+ * The default value is {DOMFilterFactory}.
712
+ * @property {boolean} [enableHWA] - Enables hardware acceleration for
713
+ * rendering. The default value is `false`.
714
+ */
715
+ /**
716
+ * This is the main entry point for loading a PDF and interacting with it.
717
+ *
718
+ * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or
719
+ * XHR as fallback) is used, which means it must follow same origin rules,
720
+ * e.g. no cross-domain requests without CORS.
721
+ *
722
+ * @param {string | URL | TypedArray | ArrayBuffer | DocumentInitParameters}
723
+ * src - Can be a URL where a PDF file is located, a typed array (Uint8Array)
724
+ * already populated with data, or a parameter object.
725
+ * @returns {PDFDocumentLoadingTask}
726
+ */
727
+ export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
728
+ export class LoopbackPort {
729
+ postMessage(obj: any, transfer: any): void;
730
+ addEventListener(name: any, listener: any, options?: null): void;
731
+ removeEventListener(name: any, listener: any): void;
732
+ terminate(): void;
733
+ #private;
734
+ }
735
+ /**
736
+ * Abstract class to support range requests file loading.
737
+ *
738
+ * NOTE: The TypedArrays passed to the constructor and relevant methods below
739
+ * will generally be transferred to the worker-thread. This will help reduce
740
+ * main-thread memory usage, however it will take ownership of the TypedArrays.
741
+ */
742
+ export class PDFDataRangeTransport {
743
+ /**
744
+ * @param {number} length
745
+ * @param {Uint8Array|null} initialData
746
+ * @param {boolean} [progressiveDone]
747
+ * @param {string} [contentDispositionFilename]
748
+ */
749
+ constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean, contentDispositionFilename?: string);
750
+ length: number;
751
+ initialData: Uint8Array<ArrayBufferLike> | null;
752
+ progressiveDone: boolean;
753
+ contentDispositionFilename: string;
754
+ _rangeListeners: any[];
755
+ _progressListeners: any[];
756
+ _progressiveReadListeners: any[];
757
+ _progressiveDoneListeners: any[];
758
+ _readyCapability: PromiseWithResolvers<any>;
759
+ /**
760
+ * @param {function} listener
761
+ */
762
+ addRangeListener(listener: Function): void;
763
+ /**
764
+ * @param {function} listener
765
+ */
766
+ addProgressListener(listener: Function): void;
767
+ /**
768
+ * @param {function} listener
769
+ */
770
+ addProgressiveReadListener(listener: Function): void;
771
+ /**
772
+ * @param {function} listener
773
+ */
774
+ addProgressiveDoneListener(listener: Function): void;
775
+ /**
776
+ * @param {number} begin
777
+ * @param {Uint8Array|null} chunk
778
+ */
779
+ onDataRange(begin: number, chunk: Uint8Array | null): void;
780
+ /**
781
+ * @param {number} loaded
782
+ * @param {number|undefined} total
783
+ */
784
+ onDataProgress(loaded: number, total: number | undefined): void;
785
+ /**
786
+ * @param {Uint8Array|null} chunk
787
+ */
788
+ onDataProgressiveRead(chunk: Uint8Array | null): void;
789
+ onDataProgressiveDone(): void;
790
+ transportReady(): void;
791
+ /**
792
+ * @param {number} begin
793
+ * @param {number} end
794
+ */
795
+ requestDataRange(begin: number, end: number): void;
796
+ abort(): void;
797
+ }
798
+ /**
799
+ * @typedef {Object} OnProgressParameters
800
+ * @property {number} loaded - Currently loaded number of bytes.
801
+ * @property {number} total - Total number of bytes in the PDF file.
802
+ */
803
+ /**
804
+ * The loading task controls the operations required to load a PDF document
805
+ * (such as network requests) and provides a way to listen for completion,
806
+ * after which individual pages can be rendered.
807
+ */
808
+ export class PDFDocumentLoadingTask {
809
+ static "__#55@#docId": number;
810
+ _capability: PromiseWithResolvers<any>;
811
+ _transport: any;
812
+ _worker: any;
813
+ /**
814
+ * Unique identifier for the document loading task.
815
+ * @type {string}
816
+ */
817
+ docId: string;
818
+ /**
819
+ * Whether the loading task is destroyed or not.
820
+ * @type {boolean}
821
+ */
822
+ destroyed: boolean;
823
+ /**
824
+ * Callback to request a password if a wrong or no password was provided.
825
+ * The callback receives two parameters: a function that should be called
826
+ * with the new password, and a reason (see {@link PasswordResponses}).
827
+ * @type {function}
828
+ */
829
+ onPassword: Function;
830
+ /**
831
+ * Callback to be able to monitor the loading progress of the PDF file
832
+ * (necessary to implement e.g. a loading bar).
833
+ * The callback receives an {@link OnProgressParameters} argument.
834
+ * @type {function}
835
+ */
836
+ onProgress: Function;
837
+ /**
838
+ * Promise for document loading task completion.
839
+ * @type {Promise<PDFDocumentProxy>}
840
+ */
841
+ get promise(): Promise<PDFDocumentProxy>;
842
+ /**
843
+ * Abort all network requests and destroy the worker.
844
+ * @returns {Promise<void>} A promise that is resolved when destruction is
845
+ * completed.
846
+ */
847
+ destroy(): Promise<void>;
848
+ }
849
+ /**
850
+ * Proxy to a `PDFDocument` in the worker thread.
851
+ */
852
+ export class PDFDocumentProxy {
853
+ constructor(pdfInfo: any, transport: any);
854
+ _pdfInfo: any;
855
+ _transport: any;
856
+ /**
857
+ * @type {AnnotationStorage} Storage for annotation data in forms.
858
+ */
859
+ get annotationStorage(): AnnotationStorage;
860
+ /**
861
+ * @type {Object} The canvas factory instance.
862
+ */
863
+ get canvasFactory(): Object;
864
+ /**
865
+ * @type {Object} The filter factory instance.
866
+ */
867
+ get filterFactory(): Object;
868
+ /**
869
+ * @type {number} Total number of pages in the PDF file.
870
+ */
871
+ get numPages(): number;
872
+ /**
873
+ * @type {Array<string | null>} A (not guaranteed to be) unique ID to identify
874
+ * the PDF document.
875
+ * NOTE: The first element will always be defined for all PDF documents,
876
+ * whereas the second element is only defined for *modified* PDF documents.
877
+ */
878
+ get fingerprints(): Array<string | null>;
879
+ /**
880
+ * @type {boolean} True if only XFA form.
881
+ */
882
+ get isPureXfa(): boolean;
883
+ /**
884
+ * NOTE: This is (mostly) intended to support printing of XFA forms.
885
+ *
886
+ * @type {Object | null} An object representing a HTML tree structure
887
+ * to render the XFA, or `null` when no XFA form exists.
888
+ */
889
+ get allXfaHtml(): Object | null;
890
+ /**
891
+ * @param {number} pageNumber - The page number to get. The first page is 1.
892
+ * @returns {Promise<PDFPageProxy>} A promise that is resolved with
893
+ * a {@link PDFPageProxy} object.
894
+ */
895
+ getPage(pageNumber: number): Promise<PDFPageProxy>;
896
+ /**
897
+ * @param {RefProxy} ref - The page reference.
898
+ * @returns {Promise<number>} A promise that is resolved with the page index,
899
+ * starting from zero, that is associated with the reference.
900
+ */
901
+ getPageIndex(ref: RefProxy): Promise<number>;
902
+ /**
903
+ * @returns {Promise<Object<string, Array<any>>>} A promise that is resolved
904
+ * with a mapping from named destinations to references.
905
+ *
906
+ * This can be slow for large documents. Use `getDestination` instead.
907
+ */
908
+ getDestinations(): Promise<{
909
+ [x: string]: Array<any>;
910
+ }>;
911
+ /**
912
+ * @param {string} id - The named destination to get.
913
+ * @returns {Promise<Array<any> | null>} A promise that is resolved with all
914
+ * information of the given named destination, or `null` when the named
915
+ * destination is not present in the PDF file.
916
+ */
917
+ getDestination(id: string): Promise<Array<any> | null>;
918
+ /**
919
+ * @returns {Promise<Array<string> | null>} A promise that is resolved with
920
+ * an {Array} containing the page labels that correspond to the page
921
+ * indexes, or `null` when no page labels are present in the PDF file.
922
+ */
923
+ getPageLabels(): Promise<Array<string> | null>;
924
+ /**
925
+ * @returns {Promise<string>} A promise that is resolved with a {string}
926
+ * containing the page layout name.
927
+ */
928
+ getPageLayout(): Promise<string>;
929
+ /**
930
+ * @returns {Promise<string>} A promise that is resolved with a {string}
931
+ * containing the page mode name.
932
+ */
933
+ getPageMode(): Promise<string>;
934
+ /**
935
+ * @returns {Promise<Object | null>} A promise that is resolved with an
936
+ * {Object} containing the viewer preferences, or `null` when no viewer
937
+ * preferences are present in the PDF file.
938
+ */
939
+ getViewerPreferences(): Promise<Object | null>;
940
+ /**
941
+ * @returns {Promise<any | null>} A promise that is resolved with an {Array}
942
+ * containing the destination, or `null` when no open action is present
943
+ * in the PDF.
944
+ */
945
+ getOpenAction(): Promise<any | null>;
946
+ /**
947
+ * @returns {Promise<any>} A promise that is resolved with a lookup table
948
+ * for mapping named attachments to their content.
949
+ */
950
+ getAttachments(): Promise<any>;
951
+ /**
952
+ * @returns {Promise<Object | null>} A promise that is resolved with
953
+ * an {Object} with the JavaScript actions:
954
+ * - from the name tree.
955
+ * - from A or AA entries in the catalog dictionary.
956
+ * , or `null` if no JavaScript exists.
957
+ */
958
+ getJSActions(): Promise<Object | null>;
959
+ /**
960
+ * @typedef {Object} OutlineNode
961
+ * @property {string} title
962
+ * @property {boolean} bold
963
+ * @property {boolean} italic
964
+ * @property {Uint8ClampedArray} color - The color in RGB format to use for
965
+ * display purposes.
966
+ * @property {string | Array<any> | null} dest
967
+ * @property {string | null} url
968
+ * @property {string | undefined} unsafeUrl
969
+ * @property {boolean | undefined} newWindow
970
+ * @property {number | undefined} count
971
+ * @property {Array<OutlineNode>} items
972
+ */
973
+ /**
974
+ * @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an
975
+ * {Array} that is a tree outline (if it has one) of the PDF file.
976
+ */
977
+ getOutline(): Promise<Array<{
978
+ title: string;
979
+ bold: boolean;
980
+ italic: boolean;
981
+ /**
982
+ * - The color in RGB format to use for
983
+ * display purposes.
984
+ */
985
+ color: Uint8ClampedArray;
986
+ dest: string | Array<any> | null;
987
+ url: string | null;
988
+ unsafeUrl: string | undefined;
989
+ newWindow: boolean | undefined;
990
+ count: number | undefined;
991
+ items: Array</*elided*/ any>;
992
+ }>>;
993
+ /**
994
+ * @typedef {Object} GetOptionalContentConfigParameters
995
+ * @property {string} [intent] - Determines the optional content groups that
996
+ * are visible by default; valid values are:
997
+ * - 'display' (viewable groups).
998
+ * - 'print' (printable groups).
999
+ * - 'any' (all groups).
1000
+ * The default value is 'display'.
1001
+ */
1002
+ /**
1003
+ * @param {GetOptionalContentConfigParameters} [params] - Optional content
1004
+ * config parameters.
1005
+ * @returns {Promise<OptionalContentConfig>} A promise that is resolved with
1006
+ * an {@link OptionalContentConfig} that contains all the optional content
1007
+ * groups (assuming that the document has any).
1008
+ */
1009
+ getOptionalContentConfig({ intent }?: {
1010
+ /**
1011
+ * - Determines the optional content groups that
1012
+ * are visible by default; valid values are:
1013
+ * - 'display' (viewable groups).
1014
+ * - 'print' (printable groups).
1015
+ * - 'any' (all groups).
1016
+ * The default value is 'display'.
1017
+ */
1018
+ intent?: string | undefined;
1019
+ }): Promise<OptionalContentConfig>;
1020
+ /**
1021
+ * @returns {Promise<Array<number> | null>} A promise that is resolved with
1022
+ * an {Array} that contains the permission flags for the PDF document, or
1023
+ * `null` when no permissions are present in the PDF file.
1024
+ */
1025
+ getPermissions(): Promise<Array<number> | null>;
1026
+ /**
1027
+ * @returns {Promise<{ info: Object, metadata: Metadata }>} A promise that is
1028
+ * resolved with an {Object} that has `info` and `metadata` properties.
1029
+ * `info` is an {Object} filled with anything available in the information
1030
+ * dictionary and similarly `metadata` is a {Metadata} object with
1031
+ * information from the metadata section of the PDF.
1032
+ */
1033
+ getMetadata(): Promise<{
1034
+ info: Object;
1035
+ metadata: Metadata;
1036
+ }>;
1037
+ /**
1038
+ * @typedef {Object} MarkInfo
1039
+ * Properties correspond to Table 321 of the PDF 32000-1:2008 spec.
1040
+ * @property {boolean} Marked
1041
+ * @property {boolean} UserProperties
1042
+ * @property {boolean} Suspects
1043
+ */
1044
+ /**
1045
+ * @returns {Promise<MarkInfo | null>} A promise that is resolved with
1046
+ * a {MarkInfo} object that contains the MarkInfo flags for the PDF
1047
+ * document, or `null` when no MarkInfo values are present in the PDF file.
1048
+ */
1049
+ getMarkInfo(): Promise<{
1050
+ Marked: boolean;
1051
+ UserProperties: boolean;
1052
+ Suspects: boolean;
1053
+ } | null>;
1054
+ /**
1055
+ * @returns {Promise<Uint8Array>} A promise that is resolved with a
1056
+ * {Uint8Array} containing the raw data of the PDF document.
1057
+ */
1058
+ getData(): Promise<Uint8Array>;
1059
+ /**
1060
+ * @returns {Promise<Uint8Array>} A promise that is resolved with a
1061
+ * {Uint8Array} containing the full data of the saved document.
1062
+ */
1063
+ saveDocument(): Promise<Uint8Array>;
1064
+ /**
1065
+ * @returns {Promise<{ length: number }>} A promise that is resolved when the
1066
+ * document's data is loaded. It is resolved with an {Object} that contains
1067
+ * the `length` property that indicates size of the PDF data in bytes.
1068
+ */
1069
+ getDownloadInfo(): Promise<{
1070
+ length: number;
1071
+ }>;
1072
+ /**
1073
+ * Cleans up resources allocated by the document on both the main and worker
1074
+ * threads.
1075
+ *
1076
+ * NOTE: Do not, under any circumstances, call this method when rendering is
1077
+ * currently ongoing since that may lead to rendering errors.
1078
+ *
1079
+ * @param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM.
1080
+ * NOTE: This will increase persistent memory usage, hence don't use this
1081
+ * option unless absolutely necessary. The default value is `false`.
1082
+ * @returns {Promise} A promise that is resolved when clean-up has finished.
1083
+ */
1084
+ cleanup(keepLoadedFonts?: boolean): Promise<any>;
1085
+ /**
1086
+ * Destroys the current document instance and terminates the worker.
1087
+ */
1088
+ destroy(): Promise<void>;
1089
+ /**
1090
+ * @param {RefProxy} ref - The page reference.
1091
+ * @returns {number | null} The page number, if it's cached.
1092
+ */
1093
+ cachedPageNumber(ref: RefProxy): number | null;
1094
+ /**
1095
+ * @type {DocumentInitParameters} A subset of the current
1096
+ * {DocumentInitParameters}, which are needed in the viewer.
1097
+ */
1098
+ get loadingParams(): DocumentInitParameters;
1099
+ /**
1100
+ * @type {PDFDocumentLoadingTask} The loadingTask for the current document.
1101
+ */
1102
+ get loadingTask(): PDFDocumentLoadingTask;
1103
+ /**
1104
+ * @returns {Promise<Object<string, Array<Object>> | null>} A promise that is
1105
+ * resolved with an {Object} containing /AcroForm field data for the JS
1106
+ * sandbox, or `null` when no field data is present in the PDF file.
1107
+ */
1108
+ getFieldObjects(): Promise<{
1109
+ [x: string]: Array<Object>;
1110
+ } | null>;
1111
+ /**
1112
+ * @returns {Promise<boolean>} A promise that is resolved with `true`
1113
+ * if some /AcroForm fields have JavaScript actions.
1114
+ */
1115
+ hasJSActions(): Promise<boolean>;
1116
+ /**
1117
+ * @returns {Promise<Array<string> | null>} A promise that is resolved with an
1118
+ * {Array<string>} containing IDs of annotations that have a calculation
1119
+ * action, or `null` when no such annotations are present in the PDF file.
1120
+ */
1121
+ getCalculationOrderIds(): Promise<Array<string> | null>;
1122
+ }
1123
+ /**
1124
+ * Page getViewport parameters.
1125
+ *
1126
+ * @typedef {Object} GetViewportParameters
1127
+ * @property {number} scale - The desired scale of the viewport.
1128
+ * @property {number} [rotation] - The desired rotation, in degrees, of
1129
+ * the viewport. If omitted it defaults to the page rotation.
1130
+ * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.
1131
+ * The default value is `0`.
1132
+ * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.
1133
+ * The default value is `0`.
1134
+ * @property {boolean} [dontFlip] - If true, the y-axis will not be
1135
+ * flipped. The default value is `false`.
1136
+ */
1137
+ /**
1138
+ * Page getTextContent parameters.
1139
+ *
1140
+ * @typedef {Object} getTextContentParameters
1141
+ * @property {boolean} [includeMarkedContent] - When true include marked
1142
+ * content items in the items array of TextContent. The default is `false`.
1143
+ * @property {boolean} [disableNormalization] - When true the text is *not*
1144
+ * normalized in the worker-thread. The default is `false`.
1145
+ */
1146
+ /**
1147
+ * Page text content.
1148
+ *
1149
+ * @typedef {Object} TextContent
1150
+ * @property {Array<TextItem | TextMarkedContent>} items - Array of
1151
+ * {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent
1152
+ * items are included when includeMarkedContent is true.
1153
+ * @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
1154
+ * indexed by font name.
1155
+ * @property {string | null} lang - The document /Lang attribute.
1156
+ */
1157
+ /**
1158
+ * Page text content part.
1159
+ *
1160
+ * @typedef {Object} TextItem
1161
+ * @property {string} str - Text content.
1162
+ * @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'.
1163
+ * @property {Array<any>} transform - Transformation matrix.
1164
+ * @property {number} width - Width in device space.
1165
+ * @property {number} height - Height in device space.
1166
+ * @property {string} fontName - Font name used by PDF.js for converted font.
1167
+ * @property {boolean} hasEOL - Indicating if the text content is followed by a
1168
+ * line-break.
1169
+ */
1170
+ /**
1171
+ * Page text marked content part.
1172
+ *
1173
+ * @typedef {Object} TextMarkedContent
1174
+ * @property {string} type - Either 'beginMarkedContent',
1175
+ * 'beginMarkedContentProps', or 'endMarkedContent'.
1176
+ * @property {string} id - The marked content identifier. Only used for type
1177
+ * 'beginMarkedContentProps'.
1178
+ */
1179
+ /**
1180
+ * Text style.
1181
+ *
1182
+ * @typedef {Object} TextStyle
1183
+ * @property {number} ascent - Font ascent.
1184
+ * @property {number} descent - Font descent.
1185
+ * @property {boolean} vertical - Whether or not the text is in vertical mode.
1186
+ * @property {string} fontFamily - The possible font family.
1187
+ */
1188
+ /**
1189
+ * Page annotation parameters.
1190
+ *
1191
+ * @typedef {Object} GetAnnotationsParameters
1192
+ * @property {string} [intent] - Determines the annotations that are fetched,
1193
+ * can be 'display' (viewable annotations), 'print' (printable annotations),
1194
+ * or 'any' (all annotations). The default value is 'display'.
1195
+ */
1196
+ /**
1197
+ * Page render parameters.
1198
+ *
1199
+ * @typedef {Object} RenderParameters
1200
+ * @property {CanvasRenderingContext2D} canvasContext - A 2D context of a DOM
1201
+ * Canvas object.
1202
+ * @property {PageViewport} viewport - Rendering viewport obtained by calling
1203
+ * the `PDFPageProxy.getViewport` method.
1204
+ * @property {string} [intent] - Rendering intent, can be 'display', 'print',
1205
+ * or 'any'. The default value is 'display'.
1206
+ * @property {number} [annotationMode] Controls which annotations are rendered
1207
+ * onto the canvas, for annotations with appearance-data; the values from
1208
+ * {@link AnnotationMode} should be used. The following values are supported:
1209
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
1210
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
1211
+ * it also depends on the `intent`-option, see above).
1212
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
1213
+ * interactive form elements (those will be rendered in the display layer).
1214
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
1215
+ * (as above) but where interactive form elements are updated with data
1216
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
1217
+ * The default value is `AnnotationMode.ENABLE`.
1218
+ * @property {Array<any>} [transform] - Additional transform, applied just
1219
+ * before viewport transform.
1220
+ * @property {CanvasGradient | CanvasPattern | string} [background] - Background
1221
+ * to use for the canvas.
1222
+ * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
1223
+ * <color> value, a `CanvasGradient` object (a linear or radial gradient) or
1224
+ * a `CanvasPattern` object (a repetitive image). The default value is
1225
+ * 'rgb(255,255,255)'.
1226
+ *
1227
+ * NOTE: This option may be partially, or completely, ignored when the
1228
+ * `pageColors`-option is used.
1229
+ * @property {Object} [pageColors] - Overwrites background and foreground colors
1230
+ * with user defined ones in order to improve readability in high contrast
1231
+ * mode.
1232
+ * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -
1233
+ * A promise that should resolve with an {@link OptionalContentConfig}
1234
+ * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
1235
+ * the configuration will be fetched automatically with the default visibility
1236
+ * states set.
1237
+ * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
1238
+ * annotation ids with canvases used to render them.
1239
+ * @property {PrintAnnotationStorage} [printAnnotationStorage]
1240
+ * @property {boolean} [isEditing] - Render the page in editing mode.
1241
+ */
1242
+ /**
1243
+ * Page getOperatorList parameters.
1244
+ *
1245
+ * @typedef {Object} GetOperatorListParameters
1246
+ * @property {string} [intent] - Rendering intent, can be 'display', 'print',
1247
+ * or 'any'. The default value is 'display'.
1248
+ * @property {number} [annotationMode] Controls which annotations are included
1249
+ * in the operatorList, for annotations with appearance-data; the values from
1250
+ * {@link AnnotationMode} should be used. The following values are supported:
1251
+ * - `AnnotationMode.DISABLE`, which disables all annotations.
1252
+ * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
1253
+ * it also depends on the `intent`-option, see above).
1254
+ * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain
1255
+ * interactive form elements (those will be rendered in the display layer).
1256
+ * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
1257
+ * (as above) but where interactive form elements are updated with data
1258
+ * from the {@link AnnotationStorage}-instance; useful e.g. for printing.
1259
+ * The default value is `AnnotationMode.ENABLE`.
1260
+ * @property {PrintAnnotationStorage} [printAnnotationStorage]
1261
+ * @property {boolean} [isEditing] - Render the page in editing mode.
1262
+ */
1263
+ /**
1264
+ * Structure tree node. The root node will have a role "Root".
1265
+ *
1266
+ * @typedef {Object} StructTreeNode
1267
+ * @property {Array<StructTreeNode | StructTreeContent>} children - Array of
1268
+ * {@link StructTreeNode} and {@link StructTreeContent} objects.
1269
+ * @property {string} role - element's role, already mapped if a role map exists
1270
+ * in the PDF.
1271
+ */
1272
+ /**
1273
+ * Structure tree content.
1274
+ *
1275
+ * @typedef {Object} StructTreeContent
1276
+ * @property {string} type - either "content" for page and stream structure
1277
+ * elements or "object" for object references.
1278
+ * @property {string} id - unique id that will map to the text layer.
1279
+ */
1280
+ /**
1281
+ * PDF page operator list.
1282
+ *
1283
+ * @typedef {Object} PDFOperatorList
1284
+ * @property {Array<number>} fnArray - Array containing the operator functions.
1285
+ * @property {Array<any>} argsArray - Array containing the arguments of the
1286
+ * functions.
1287
+ */
1288
+ /**
1289
+ * Proxy to a `PDFPage` in the worker thread.
1290
+ */
1291
+ export class PDFPageProxy {
1292
+ constructor(pageIndex: any, pageInfo: any, transport: any, pdfBug?: boolean);
1293
+ _pageIndex: any;
1294
+ _pageInfo: any;
1295
+ _transport: any;
1296
+ _stats: StatTimer | null;
1297
+ _pdfBug: boolean;
1298
+ /** @type {PDFObjects} */
1299
+ commonObjs: PDFObjects;
1300
+ objs: PDFObjects;
1301
+ _intentStates: Map<any, any>;
1302
+ destroyed: boolean;
1303
+ /**
1304
+ * @type {number} Page number of the page. First page is 1.
1305
+ */
1306
+ get pageNumber(): number;
1307
+ /**
1308
+ * @type {number} The number of degrees the page is rotated clockwise.
1309
+ */
1310
+ get rotate(): number;
1311
+ /**
1312
+ * @type {RefProxy | null} The reference that points to this page.
1313
+ */
1314
+ get ref(): RefProxy | null;
1315
+ /**
1316
+ * @type {number} The default size of units in 1/72nds of an inch.
1317
+ */
1318
+ get userUnit(): number;
1319
+ /**
1320
+ * @type {Array<number>} An array of the visible portion of the PDF page in
1321
+ * user space units [x1, y1, x2, y2].
1322
+ */
1323
+ get view(): Array<number>;
1324
+ /**
1325
+ * @param {GetViewportParameters} params - Viewport parameters.
1326
+ * @returns {PageViewport} Contains 'width' and 'height' properties
1327
+ * along with transforms required for rendering.
1328
+ */
1329
+ getViewport({ scale, rotation, offsetX, offsetY, dontFlip, }?: GetViewportParameters): PageViewport;
1330
+ /**
1331
+ * @param {GetAnnotationsParameters} [params] - Annotation parameters.
1332
+ * @returns {Promise<Array<any>>} A promise that is resolved with an
1333
+ * {Array} of the annotation objects.
1334
+ */
1335
+ getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
1336
+ /**
1337
+ * @returns {Promise<Object>} A promise that is resolved with an
1338
+ * {Object} with JS actions.
1339
+ */
1340
+ getJSActions(): Promise<Object>;
1341
+ /**
1342
+ * @type {Object} The filter factory instance.
1343
+ */
1344
+ get filterFactory(): Object;
1345
+ /**
1346
+ * @type {boolean} True if only XFA form.
1347
+ */
1348
+ get isPureXfa(): boolean;
1349
+ /**
1350
+ * @returns {Promise<Object | null>} A promise that is resolved with
1351
+ * an {Object} with a fake DOM object (a tree structure where elements
1352
+ * are {Object} with a name, attributes (class, style, ...), value and
1353
+ * children, very similar to a HTML DOM tree), or `null` if no XFA exists.
1354
+ */
1355
+ getXfa(): Promise<Object | null>;
1356
+ /**
1357
+ * Begins the process of rendering a page to the desired context.
1358
+ *
1359
+ * @param {RenderParameters} params - Page render parameters.
1360
+ * @returns {RenderTask} An object that contains a promise that is
1361
+ * resolved when the page finishes rendering.
1362
+ */
1363
+ render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
1364
+ /**
1365
+ * @param {GetOperatorListParameters} params - Page getOperatorList
1366
+ * parameters.
1367
+ * @returns {Promise<PDFOperatorList>} A promise resolved with an
1368
+ * {@link PDFOperatorList} object that represents the page's operator list.
1369
+ */
1370
+ getOperatorList({ intent, annotationMode, printAnnotationStorage, isEditing, }?: GetOperatorListParameters): Promise<PDFOperatorList>;
1371
+ /**
1372
+ * NOTE: All occurrences of whitespace will be replaced by
1373
+ * standard spaces (0x20).
1374
+ *
1375
+ * @param {getTextContentParameters} params - getTextContent parameters.
1376
+ * @returns {ReadableStream} Stream for reading text content chunks.
1377
+ */
1378
+ streamTextContent({ includeMarkedContent, disableNormalization, }?: getTextContentParameters): ReadableStream;
1379
+ /**
1380
+ * NOTE: All occurrences of whitespace will be replaced by
1381
+ * standard spaces (0x20).
1382
+ *
1383
+ * @param {getTextContentParameters} params - getTextContent parameters.
1384
+ * @returns {Promise<TextContent>} A promise that is resolved with a
1385
+ * {@link TextContent} object that represents the page's text content.
1386
+ */
1387
+ getTextContent(params?: getTextContentParameters): Promise<TextContent>;
1388
+ /**
1389
+ * @returns {Promise<StructTreeNode>} A promise that is resolved with a
1390
+ * {@link StructTreeNode} object that represents the page's structure tree,
1391
+ * or `null` when no structure tree is present for the current page.
1392
+ */
1393
+ getStructTree(): Promise<StructTreeNode>;
1394
+ /**
1395
+ * Destroys the page object.
1396
+ * @private
1397
+ */
1398
+ private _destroy;
1399
+ /**
1400
+ * Cleans up resources allocated by the page.
1401
+ *
1402
+ * @param {boolean} [resetStats] - Reset page stats, if enabled.
1403
+ * The default value is `false`.
1404
+ * @returns {boolean} Indicates if clean-up was successfully run.
1405
+ */
1406
+ cleanup(resetStats?: boolean): boolean;
1407
+ /**
1408
+ * @private
1409
+ */
1410
+ private _startRenderPage;
1411
+ /**
1412
+ * @private
1413
+ */
1414
+ private _renderPageChunk;
1415
+ /**
1416
+ * @private
1417
+ */
1418
+ private _pumpOperatorList;
1419
+ /**
1420
+ * @private
1421
+ */
1422
+ private _abortOperatorList;
1423
+ /**
1424
+ * @type {StatTimer | null} Returns page stats, if enabled; returns `null`
1425
+ * otherwise.
1426
+ */
1427
+ get stats(): StatTimer | null;
1428
+ #private;
1429
+ }
1430
+ /**
1431
+ * @typedef {Object} PDFWorkerParameters
1432
+ * @property {string} [name] - The name of the worker.
1433
+ * @property {Worker} [port] - The `workerPort` object.
1434
+ * @property {number} [verbosity] - Controls the logging level;
1435
+ * the constants from {@link VerbosityLevel} should be used.
1436
+ */
1437
+ /**
1438
+ * PDF.js web worker abstraction that controls the instantiation of PDF
1439
+ * documents. Message handlers are used to pass information from the main
1440
+ * thread to the worker thread and vice versa. If the creation of a web
1441
+ * worker is not possible, a "fake" worker will be used instead.
1442
+ *
1443
+ * @param {PDFWorkerParameters} params - The worker initialization parameters.
1444
+ */
1445
+ export class PDFWorker {
1446
+ static "__#58@#fakeWorkerId": number;
1447
+ static "__#58@#isWorkerDisabled": boolean;
1448
+ static "__#58@#workerPorts": any;
1449
+ /**
1450
+ * @param {PDFWorkerParameters} params - The worker initialization parameters.
1451
+ */
1452
+ static fromPort(params: PDFWorkerParameters): any;
1453
+ /**
1454
+ * The current `workerSrc`, when it exists.
1455
+ * @type {string}
1456
+ */
1457
+ static get workerSrc(): string;
1458
+ static get "__#58@#mainThreadWorkerMessageHandler"(): any;
1459
+ static get _setupFakeWorkerGlobal(): any;
1460
+ constructor({ name, port, verbosity, }?: {
1461
+ name?: null | undefined;
1462
+ port?: null | undefined;
1463
+ verbosity?: number | undefined;
1464
+ });
1465
+ name: any;
1466
+ destroyed: boolean;
1467
+ verbosity: number;
1468
+ _readyCapability: PromiseWithResolvers<any>;
1469
+ _port: any;
1470
+ _webWorker: Worker | null;
1471
+ _messageHandler: MessageHandler | null;
1472
+ /**
1473
+ * Promise for worker initialization completion.
1474
+ * @type {Promise<void>}
1475
+ */
1476
+ get promise(): Promise<void>;
1477
+ /**
1478
+ * The current `workerPort`, when it exists.
1479
+ * @type {Worker}
1480
+ */
1481
+ get port(): Worker;
1482
+ /**
1483
+ * The current MessageHandler-instance.
1484
+ * @type {MessageHandler}
1485
+ */
1486
+ get messageHandler(): MessageHandler;
1487
+ _initializeFromPort(port: any): void;
1488
+ _initialize(): void;
1489
+ _setupFakeWorker(): void;
1490
+ /**
1491
+ * Destroys the worker instance.
1492
+ */
1493
+ destroy(): void;
1494
+ #private;
1495
+ }
1496
+ /**
1497
+ * Allows controlling of the rendering tasks.
1498
+ */
1499
+ export class RenderTask {
1500
+ constructor(internalRenderTask: any);
1501
+ /**
1502
+ * Callback for incremental rendering -- a function that will be called
1503
+ * each time the rendering is paused. To continue rendering call the
1504
+ * function that is the first argument to the callback.
1505
+ * @type {function}
1506
+ */
1507
+ onContinue: Function;
1508
+ /**
1509
+ * A function that will be synchronously called when the rendering tasks
1510
+ * finishes with an error (either because of an actual error, or because the
1511
+ * rendering is cancelled).
1512
+ *
1513
+ * @type {function}
1514
+ * @param {Error} error
1515
+ */
1516
+ onError: Function;
1517
+ /**
1518
+ * Promise for rendering task completion.
1519
+ * @type {Promise<void>}
1520
+ */
1521
+ get promise(): Promise<void>;
1522
+ /**
1523
+ * Cancels the rendering task. If the task is currently rendering it will
1524
+ * not be cancelled until graphics pauses with a timeout. The promise that
1525
+ * this object extends will be rejected when cancelled.
1526
+ *
1527
+ * @param {number} [extraDelay]
1528
+ */
1529
+ cancel(extraDelay?: number): void;
1530
+ /**
1531
+ * Whether form fields are rendered separately from the main operatorList.
1532
+ * @type {boolean}
1533
+ */
1534
+ get separateAnnots(): boolean;
1535
+ #private;
1536
+ }
1537
+ /** @type {string} */
1538
+ export const version: string;
1539
+ import { PageViewport } from "./display_utils.js";
1540
+ import { OptionalContentConfig } from "./optional_content_config.js";
1541
+ import { PrintAnnotationStorage } from "./annotation_storage.js";
1542
+ import { AnnotationStorage } from "./annotation_storage.js";
1543
+ import { Metadata } from "./metadata.js";
1544
+ import { StatTimer } from "./display_utils.js";
1545
+ /**
1546
+ * A PDF document and page is built of many objects. E.g. there are objects for
1547
+ * fonts, images, rendering code, etc. These objects may get processed inside of
1548
+ * a worker. This class implements some basic methods to manage these objects.
1549
+ */
1550
+ declare class PDFObjects {
1551
+ /**
1552
+ * If called *without* callback, this returns the data of `objId` but the
1553
+ * object needs to be resolved. If it isn't, this method throws.
1554
+ *
1555
+ * If called *with* a callback, the callback is called with the data of the
1556
+ * object once the object is resolved. That means, if you call this method
1557
+ * and the object is already resolved, the callback gets called right away.
1558
+ *
1559
+ * @param {string} objId
1560
+ * @param {function} [callback]
1561
+ * @returns {any}
1562
+ */
1563
+ get(objId: string, callback?: Function): any;
1564
+ /**
1565
+ * @param {string} objId
1566
+ * @returns {boolean}
1567
+ */
1568
+ has(objId: string): boolean;
1569
+ /**
1570
+ * @param {string} objId
1571
+ * @returns {boolean}
1572
+ */
1573
+ delete(objId: string): boolean;
1574
+ /**
1575
+ * Resolves the object `objId` with optional `data`.
1576
+ *
1577
+ * @param {string} objId
1578
+ * @param {any} [data]
1579
+ */
1580
+ resolve(objId: string, data?: any): void;
1581
+ clear(): void;
1582
+ [Symbol.iterator](): Generator<any[], void, unknown>;
1583
+ #private;
1584
+ }
1585
+ import { MessageHandler } from "../shared/message_handler.js";
1586
+ export {};