pdfjs-serverless 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +14 -4
- package/dist/types/src/display/annotation_storage.d.ts +9 -0
- package/dist/types/src/display/api.d.ts +119 -53
- package/dist/types/src/display/canvas.d.ts +4 -1
- package/dist/types/src/display/canvas_factory.d.ts +27 -0
- package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
- package/dist/types/src/display/display_utils.d.ts +29 -59
- package/dist/types/src/display/draw_layer.d.ts +6 -19
- package/dist/types/src/display/editor/alt_text.d.ts +17 -5
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +15 -9
- package/dist/types/src/display/editor/color_picker.d.ts +1 -0
- package/dist/types/src/display/editor/draw.d.ts +120 -0
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
- package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
- package/dist/types/src/display/editor/drawers/inkdraw.d.ts +128 -0
- package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
- package/dist/types/src/display/editor/editor.d.ts +60 -12
- package/dist/types/src/display/editor/freetext.d.ts +7 -18
- package/dist/types/src/display/editor/highlight.d.ts +9 -27
- package/dist/types/src/display/editor/ink.d.ts +15 -73
- package/dist/types/src/display/editor/stamp.d.ts +27 -10
- package/dist/types/src/display/editor/toolbar.d.ts +3 -1
- package/dist/types/src/display/editor/tools.d.ts +32 -7
- package/dist/types/src/display/fetch_stream.d.ts +6 -13
- package/dist/types/src/display/filter_factory.d.ts +29 -0
- package/dist/types/src/display/font_loader.d.ts +3 -1
- package/dist/types/src/display/network.d.ts +10 -6
- package/dist/types/src/display/network_utils.d.ts +5 -3
- package/dist/types/src/display/node_stream.d.ts +7 -23
- package/dist/types/src/display/node_utils.d.ts +8 -11
- package/dist/types/src/display/optional_content_config.d.ts +1 -1
- package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
- package/dist/types/src/display/svg_factory.d.ts +14 -0
- package/dist/types/src/display/text_layer.d.ts +15 -13
- package/dist/types/src/display/touch_manager.d.ts +14 -0
- package/dist/types/src/display/transport_stream.d.ts +1 -1
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/interfaces.d.ts +4 -0
- package/dist/types/src/pdf.d.ts +5 -6
- package/dist/types/src/shared/message_handler.d.ts +10 -4
- package/dist/types/src/shared/util.d.ts +12 -20
- package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -2
- package/dist/types/web/annotation_layer_builder.d.ts +3 -1
- package/dist/types/web/app_options.d.ts +4 -2
- package/dist/types/web/download_manager.d.ts +1 -2
- package/dist/types/web/event_utils.d.ts +10 -8
- package/dist/types/web/genericl10n.d.ts +5 -5
- package/dist/types/web/interfaces.d.ts +7 -14
- package/dist/types/web/l10n.d.ts +6 -2
- package/dist/types/web/pdf_find_controller.d.ts +24 -0
- package/dist/types/web/pdf_link_service.d.ts +2 -2
- package/dist/types/web/pdf_page_view.d.ts +17 -17
- package/dist/types/web/pdf_rendering_queue.d.ts +1 -1
- package/dist/types/web/pdf_thumbnail_view.d.ts +11 -3
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -1
- package/dist/types/web/pdf_viewer.d.ts +24 -11
- package/dist/types/web/struct_tree_layer_builder.d.ts +4 -2
- package/dist/types/web/text_layer_builder.d.ts +5 -5
- package/dist/types/web/ui_utils.d.ts +10 -21
- package/package.json +19 -19
- package/dist/types/src/display/base_factory.d.ts +0 -56
- package/dist/types/src/display/editor/outliner.d.ts +0 -70
|
@@ -4,6 +4,7 @@ export type TextAccessibilityManager = import("../../web/text_accessibility.js")
|
|
|
4
4
|
export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
|
|
5
5
|
export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
|
|
6
6
|
export type AnnotationEditorUIManager = any;
|
|
7
|
+
export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
|
|
7
8
|
export type AnnotationElementParameters = {
|
|
8
9
|
data: Object;
|
|
9
10
|
layer: HTMLDivElement;
|
|
@@ -49,7 +50,8 @@ export type AnnotationLayerParameters = {
|
|
|
49
50
|
} | null | undefined;
|
|
50
51
|
annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
|
|
51
52
|
accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
|
|
52
|
-
annotationEditorUIManager?:
|
|
53
|
+
annotationEditorUIManager?: AnnotationEditorUIManager;
|
|
54
|
+
structTreeLayer?: import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined;
|
|
53
55
|
};
|
|
54
56
|
/**
|
|
55
57
|
* @typedef {Object} AnnotationLayerParameters
|
|
@@ -70,18 +72,20 @@ export type AnnotationLayerParameters = {
|
|
|
70
72
|
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
|
|
71
73
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
72
74
|
* @property {AnnotationEditorUIManager} [annotationEditorUIManager]
|
|
75
|
+
* @property {StructTreeLayerBuilder} [structTreeLayer]
|
|
73
76
|
*/
|
|
74
77
|
/**
|
|
75
78
|
* Manage the layer containing all the annotations.
|
|
76
79
|
*/
|
|
77
80
|
export class AnnotationLayer {
|
|
78
|
-
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, }: {
|
|
81
|
+
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: {
|
|
79
82
|
div: any;
|
|
80
83
|
accessibilityManager: any;
|
|
81
84
|
annotationCanvasMap: any;
|
|
82
85
|
annotationEditorUIManager: any;
|
|
83
86
|
page: any;
|
|
84
87
|
viewport: any;
|
|
88
|
+
structTreeLayer: any;
|
|
85
89
|
});
|
|
86
90
|
div: any;
|
|
87
91
|
page: any;
|
|
@@ -89,6 +93,7 @@ export class AnnotationLayer {
|
|
|
89
93
|
zIndex: number;
|
|
90
94
|
_annotationEditorUIManager: any;
|
|
91
95
|
popupShow: any[] | undefined;
|
|
96
|
+
hasEditableAnnotations(): boolean;
|
|
92
97
|
/**
|
|
93
98
|
* Render a new annotation layer with all annotation elements.
|
|
94
99
|
*
|
|
@@ -113,7 +118,11 @@ export class FreeTextAnnotationElement extends AnnotationElement {
|
|
|
113
118
|
textPosition: any;
|
|
114
119
|
annotationEditorType: number;
|
|
115
120
|
render(): HTMLElement | undefined;
|
|
116
|
-
|
|
121
|
+
}
|
|
122
|
+
export class HighlightAnnotationElement extends AnnotationElement {
|
|
123
|
+
constructor(parameters: any);
|
|
124
|
+
annotationEditorType: number;
|
|
125
|
+
render(): HTMLElement | undefined;
|
|
117
126
|
}
|
|
118
127
|
export class InkAnnotationElement extends AnnotationElement {
|
|
119
128
|
constructor(parameters: any);
|
|
@@ -126,6 +135,7 @@ export class InkAnnotationElement extends AnnotationElement {
|
|
|
126
135
|
}
|
|
127
136
|
export class StampAnnotationElement extends AnnotationElement {
|
|
128
137
|
constructor(parameters: any);
|
|
138
|
+
annotationEditorType: number;
|
|
129
139
|
render(): HTMLElement | undefined;
|
|
130
140
|
}
|
|
131
141
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
@@ -154,6 +164,7 @@ declare class AnnotationElement {
|
|
|
154
164
|
_fieldObjects: any;
|
|
155
165
|
parent: any;
|
|
156
166
|
container: HTMLElement | undefined;
|
|
167
|
+
get _isEditable(): any;
|
|
157
168
|
get hasPopupData(): boolean;
|
|
158
169
|
updateEdited(params: any): void;
|
|
159
170
|
resetEdited(): void;
|
|
@@ -210,7 +221,6 @@ declare class AnnotationElement {
|
|
|
210
221
|
*/
|
|
211
222
|
public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
|
|
212
223
|
addHighlightArea(): void;
|
|
213
|
-
get _isEditable(): boolean;
|
|
214
224
|
_editOnDoubleClick(): void;
|
|
215
225
|
#private;
|
|
216
226
|
}
|
|
@@ -63,6 +63,14 @@ export class AnnotationStorage {
|
|
|
63
63
|
transfer: any[];
|
|
64
64
|
};
|
|
65
65
|
get editorStats(): any;
|
|
66
|
+
resetModifiedIds(): void;
|
|
67
|
+
/**
|
|
68
|
+
* @returns {{ids: Set<string>, hash: string}}
|
|
69
|
+
*/
|
|
70
|
+
get modifiedIds(): {
|
|
71
|
+
ids: Set<string>;
|
|
72
|
+
hash: string;
|
|
73
|
+
};
|
|
66
74
|
#private;
|
|
67
75
|
}
|
|
68
76
|
/**
|
|
@@ -81,6 +89,7 @@ export class PrintAnnotationStorage extends AnnotationStorage {
|
|
|
81
89
|
hash: any;
|
|
82
90
|
transfer: any;
|
|
83
91
|
};
|
|
92
|
+
get modifiedIds(): any;
|
|
84
93
|
#private;
|
|
85
94
|
}
|
|
86
95
|
export const SerializableEmpty: Readonly<{
|
|
@@ -48,7 +48,7 @@ export type DocumentInitParameters = {
|
|
|
48
48
|
range?: PDFDataRangeTransport | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* - Specify maximum number of bytes fetched
|
|
51
|
-
* per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE
|
|
51
|
+
* per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
|
|
52
52
|
*/
|
|
53
53
|
rangeChunkSize?: number | undefined;
|
|
54
54
|
/**
|
|
@@ -58,7 +58,7 @@ export type DocumentInitParameters = {
|
|
|
58
58
|
worker?: PDFWorker | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* - Controls the logging level; the constants
|
|
61
|
-
* from {@link VerbosityLevel
|
|
61
|
+
* from {@link VerbosityLevel} should be used.
|
|
62
62
|
*/
|
|
63
63
|
verbosity?: number | undefined;
|
|
64
64
|
/**
|
|
@@ -137,6 +137,23 @@ export type DocumentInitParameters = {
|
|
|
137
137
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
138
138
|
*/
|
|
139
139
|
isOffscreenCanvasSupported?: boolean | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* - Determines if we can use
|
|
142
|
+
* `ImageDecoder` in the worker. Primarily used to improve performance of
|
|
143
|
+
* image conversion/rendering.
|
|
144
|
+
* The default value is `true` in web environments and `false` in Node.js.
|
|
145
|
+
*
|
|
146
|
+
* NOTE: Also temporarily disabled in Chromium browsers, until we no longer
|
|
147
|
+
* support the affected browser versions, because of various bugs:
|
|
148
|
+
*
|
|
149
|
+
* - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
|
|
150
|
+
* see https://issues.chromium.org/issues/374807001
|
|
151
|
+
*
|
|
152
|
+
* - Broken images when using the JPEG decoder with images that have custom
|
|
153
|
+
* colour profiles, e.g. GitHub discussion 19030;
|
|
154
|
+
* see https://issues.chromium.org/issues/378869810
|
|
155
|
+
*/
|
|
156
|
+
isImageDecoderSupported?: boolean | undefined;
|
|
140
157
|
/**
|
|
141
158
|
* - The integer value is used to
|
|
142
159
|
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
|
@@ -198,15 +215,21 @@ export type DocumentInitParameters = {
|
|
|
198
215
|
*/
|
|
199
216
|
pdfBug?: boolean | undefined;
|
|
200
217
|
/**
|
|
201
|
-
* - The factory
|
|
202
|
-
*
|
|
218
|
+
* - The factory that will be used when
|
|
219
|
+
* creating canvases. The default value is {DOMCanvasFactory}.
|
|
220
|
+
*/
|
|
221
|
+
CanvasFactory?: Object | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* - The factory that will be used to
|
|
224
|
+
* create SVG filters when rendering some images on the main canvas.
|
|
225
|
+
* The default value is {DOMFilterFactory}.
|
|
203
226
|
*/
|
|
204
|
-
|
|
227
|
+
FilterFactory?: Object | undefined;
|
|
205
228
|
/**
|
|
206
|
-
* -
|
|
207
|
-
*
|
|
229
|
+
* - Enables hardware acceleration for
|
|
230
|
+
* rendering. The default value is `false`.
|
|
208
231
|
*/
|
|
209
|
-
|
|
232
|
+
enableHWA?: boolean | undefined;
|
|
210
233
|
};
|
|
211
234
|
export type OnProgressParameters = {
|
|
212
235
|
/**
|
|
@@ -268,12 +291,12 @@ export type getTextContentParameters = {
|
|
|
268
291
|
export type TextContent = {
|
|
269
292
|
/**
|
|
270
293
|
* - Array of
|
|
271
|
-
* {@link TextItem
|
|
294
|
+
* {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent
|
|
272
295
|
* items are included when includeMarkedContent is true.
|
|
273
296
|
*/
|
|
274
297
|
items: Array<TextItem | TextMarkedContent>;
|
|
275
298
|
/**
|
|
276
|
-
* - {@link TextStyle
|
|
299
|
+
* - {@link TextStyle} objects,
|
|
277
300
|
* indexed by font name.
|
|
278
301
|
*/
|
|
279
302
|
styles: {
|
|
@@ -387,7 +410,7 @@ export type RenderParameters = {
|
|
|
387
410
|
/**
|
|
388
411
|
* Controls which annotations are rendered
|
|
389
412
|
* onto the canvas, for annotations with appearance-data; the values from
|
|
390
|
-
* {@link AnnotationMode
|
|
413
|
+
* {@link AnnotationMode} should be used. The following values are supported:
|
|
391
414
|
* - `AnnotationMode.DISABLE`, which disables all annotations.
|
|
392
415
|
* - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
|
|
393
416
|
* it also depends on the `intent`-option, see above).
|
|
@@ -395,7 +418,7 @@ export type RenderParameters = {
|
|
|
395
418
|
* interactive form elements (those will be rendered in the display layer).
|
|
396
419
|
* - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
|
|
397
420
|
* (as above) but where interactive form elements are updated with data
|
|
398
|
-
* from the {@link AnnotationStorage
|
|
421
|
+
* from the {@link AnnotationStorage}-instance; useful e.g. for printing.
|
|
399
422
|
* The default value is `AnnotationMode.ENABLE`.
|
|
400
423
|
*/
|
|
401
424
|
annotationMode?: number | undefined;
|
|
@@ -424,7 +447,7 @@ export type RenderParameters = {
|
|
|
424
447
|
pageColors?: Object | undefined;
|
|
425
448
|
/**
|
|
426
449
|
* -
|
|
427
|
-
* A promise that should resolve with an {@link OptionalContentConfig
|
|
450
|
+
* A promise that should resolve with an {@link OptionalContentConfig}created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
|
|
428
451
|
* the configuration will be fetched automatically with the default visibility
|
|
429
452
|
* states set.
|
|
430
453
|
*/
|
|
@@ -435,6 +458,10 @@ export type RenderParameters = {
|
|
|
435
458
|
*/
|
|
436
459
|
annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
|
|
437
460
|
printAnnotationStorage?: PrintAnnotationStorage | undefined;
|
|
461
|
+
/**
|
|
462
|
+
* - Render the page in editing mode.
|
|
463
|
+
*/
|
|
464
|
+
isEditing?: boolean | undefined;
|
|
438
465
|
};
|
|
439
466
|
/**
|
|
440
467
|
* Page getOperatorList parameters.
|
|
@@ -448,7 +475,7 @@ export type GetOperatorListParameters = {
|
|
|
448
475
|
/**
|
|
449
476
|
* Controls which annotations are included
|
|
450
477
|
* in the operatorList, for annotations with appearance-data; the values from
|
|
451
|
-
* {@link AnnotationMode
|
|
478
|
+
* {@link AnnotationMode} should be used. The following values are supported:
|
|
452
479
|
* - `AnnotationMode.DISABLE`, which disables all annotations.
|
|
453
480
|
* - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
|
|
454
481
|
* it also depends on the `intent`-option, see above).
|
|
@@ -456,11 +483,15 @@ export type GetOperatorListParameters = {
|
|
|
456
483
|
* interactive form elements (those will be rendered in the display layer).
|
|
457
484
|
* - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
|
|
458
485
|
* (as above) but where interactive form elements are updated with data
|
|
459
|
-
* from the {@link AnnotationStorage
|
|
486
|
+
* from the {@link AnnotationStorage}-instance; useful e.g. for printing.
|
|
460
487
|
* The default value is `AnnotationMode.ENABLE`.
|
|
461
488
|
*/
|
|
462
489
|
annotationMode?: number | undefined;
|
|
463
490
|
printAnnotationStorage?: PrintAnnotationStorage | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* - Render the page in editing mode.
|
|
493
|
+
*/
|
|
494
|
+
isEditing?: boolean | undefined;
|
|
464
495
|
};
|
|
465
496
|
/**
|
|
466
497
|
* Structure tree node. The root node will have a role "Root".
|
|
@@ -468,7 +499,7 @@ export type GetOperatorListParameters = {
|
|
|
468
499
|
export type StructTreeNode = {
|
|
469
500
|
/**
|
|
470
501
|
* - Array of
|
|
471
|
-
* {@link StructTreeNode
|
|
502
|
+
* {@link StructTreeNode} and {@link StructTreeContent} objects.
|
|
472
503
|
*/
|
|
473
504
|
children: Array<StructTreeNode | StructTreeContent>;
|
|
474
505
|
/**
|
|
@@ -516,16 +547,16 @@ export type PDFWorkerParameters = {
|
|
|
516
547
|
port?: Worker | undefined;
|
|
517
548
|
/**
|
|
518
549
|
* - Controls the logging level;
|
|
519
|
-
* the constants from {@link VerbosityLevel
|
|
550
|
+
* the constants from {@link VerbosityLevel} should be used.
|
|
520
551
|
*/
|
|
521
552
|
verbosity?: number | undefined;
|
|
522
553
|
};
|
|
523
554
|
/** @type {string} */
|
|
524
555
|
export const build: string;
|
|
525
556
|
export const DefaultCanvasFactory: typeof DOMCanvasFactory | typeof NodeCanvasFactory;
|
|
526
|
-
export const DefaultCMapReaderFactory: typeof
|
|
557
|
+
export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory;
|
|
527
558
|
export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
|
|
528
|
-
export const DefaultStandardFontDataFactory: typeof
|
|
559
|
+
export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
|
|
529
560
|
/**
|
|
530
561
|
* @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
|
|
531
562
|
* Int16Array | Uint16Array |
|
|
@@ -606,6 +637,21 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
606
637
|
* `OffscreenCanvas` in the worker. Primarily used to improve performance of
|
|
607
638
|
* image conversion/rendering.
|
|
608
639
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
640
|
+
* @property {boolean} [isImageDecoderSupported] - Determines if we can use
|
|
641
|
+
* `ImageDecoder` in the worker. Primarily used to improve performance of
|
|
642
|
+
* image conversion/rendering.
|
|
643
|
+
* The default value is `true` in web environments and `false` in Node.js.
|
|
644
|
+
*
|
|
645
|
+
* NOTE: Also temporarily disabled in Chromium browsers, until we no longer
|
|
646
|
+
* support the affected browser versions, because of various bugs:
|
|
647
|
+
*
|
|
648
|
+
* - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
|
|
649
|
+
* see https://issues.chromium.org/issues/374807001
|
|
650
|
+
*
|
|
651
|
+
* - Broken images when using the JPEG decoder with images that have custom
|
|
652
|
+
* colour profiles, e.g. GitHub discussion 19030;
|
|
653
|
+
* see https://issues.chromium.org/issues/378869810
|
|
654
|
+
*
|
|
609
655
|
* @property {number} [canvasMaxAreaInBytes] - The integer value is used to
|
|
610
656
|
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
|
611
657
|
* If it's -1 then a possibly slow algorithm is used to guess the max value.
|
|
@@ -639,10 +685,13 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
639
685
|
* disabling of pre-fetching to work correctly.
|
|
640
686
|
* @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
|
|
641
687
|
* (see `web/debugger.js`). The default value is `false`.
|
|
642
|
-
* @property {Object} [
|
|
643
|
-
*
|
|
644
|
-
* @property {Object} [
|
|
645
|
-
*
|
|
688
|
+
* @property {Object} [CanvasFactory] - The factory that will be used when
|
|
689
|
+
* creating canvases. The default value is {DOMCanvasFactory}.
|
|
690
|
+
* @property {Object} [FilterFactory] - The factory that will be used to
|
|
691
|
+
* create SVG filters when rendering some images on the main canvas.
|
|
692
|
+
* The default value is {DOMFilterFactory}.
|
|
693
|
+
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
694
|
+
* rendering. The default value is `false`.
|
|
646
695
|
*/
|
|
647
696
|
/**
|
|
648
697
|
* This is the main entry point for loading a PDF and interacting with it.
|
|
@@ -656,10 +705,10 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
656
705
|
* already populated with data, or a parameter object.
|
|
657
706
|
* @returns {PDFDocumentLoadingTask}
|
|
658
707
|
*/
|
|
659
|
-
export function getDocument(src
|
|
708
|
+
export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
|
|
660
709
|
export class LoopbackPort {
|
|
661
710
|
postMessage(obj: any, transfer: any): void;
|
|
662
|
-
addEventListener(name: any, listener: any): void;
|
|
711
|
+
addEventListener(name: any, listener: any, options?: null): void;
|
|
663
712
|
removeEventListener(name: any, listener: any): void;
|
|
664
713
|
terminate(): void;
|
|
665
714
|
#private;
|
|
@@ -678,9 +727,9 @@ export class PDFDataRangeTransport {
|
|
|
678
727
|
* @param {boolean} [progressiveDone]
|
|
679
728
|
* @param {string} [contentDispositionFilename]
|
|
680
729
|
*/
|
|
681
|
-
constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean
|
|
730
|
+
constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean, contentDispositionFilename?: string);
|
|
682
731
|
length: number;
|
|
683
|
-
initialData: Uint8Array | null;
|
|
732
|
+
initialData: Uint8Array<ArrayBufferLike> | null;
|
|
684
733
|
progressiveDone: boolean;
|
|
685
734
|
contentDispositionFilename: string;
|
|
686
735
|
_rangeListeners: any[];
|
|
@@ -738,7 +787,7 @@ export class PDFDataRangeTransport {
|
|
|
738
787
|
* after which individual pages can be rendered.
|
|
739
788
|
*/
|
|
740
789
|
export class PDFDocumentLoadingTask {
|
|
741
|
-
static "__#
|
|
790
|
+
static "__#54@#docId": number;
|
|
742
791
|
_capability: any;
|
|
743
792
|
_transport: any;
|
|
744
793
|
_worker: any;
|
|
@@ -789,6 +838,10 @@ export class PDFDocumentProxy {
|
|
|
789
838
|
* @type {AnnotationStorage} Storage for annotation data in forms.
|
|
790
839
|
*/
|
|
791
840
|
get annotationStorage(): AnnotationStorage;
|
|
841
|
+
/**
|
|
842
|
+
* @type {Object} The canvas factory instance.
|
|
843
|
+
*/
|
|
844
|
+
get canvasFactory(): Object;
|
|
792
845
|
/**
|
|
793
846
|
* @type {Object} The filter factory instance.
|
|
794
847
|
*/
|
|
@@ -798,12 +851,12 @@ export class PDFDocumentProxy {
|
|
|
798
851
|
*/
|
|
799
852
|
get numPages(): number;
|
|
800
853
|
/**
|
|
801
|
-
* @type {Array<string
|
|
802
|
-
*
|
|
854
|
+
* @type {Array<string | null>} A (not guaranteed to be) unique ID to identify
|
|
855
|
+
* the PDF document.
|
|
803
856
|
* NOTE: The first element will always be defined for all PDF documents,
|
|
804
857
|
* whereas the second element is only defined for *modified* PDF documents.
|
|
805
858
|
*/
|
|
806
|
-
get fingerprints(): string
|
|
859
|
+
get fingerprints(): Array<string | null>;
|
|
807
860
|
/**
|
|
808
861
|
* @type {boolean} True if only XFA form.
|
|
809
862
|
*/
|
|
@@ -902,7 +955,7 @@ export class PDFDocumentProxy {
|
|
|
902
955
|
* @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an
|
|
903
956
|
* {Array} that is a tree outline (if it has one) of the PDF file.
|
|
904
957
|
*/
|
|
905
|
-
getOutline(): Promise<{
|
|
958
|
+
getOutline(): Promise<Array<{
|
|
906
959
|
title: string;
|
|
907
960
|
bold: boolean;
|
|
908
961
|
italic: boolean;
|
|
@@ -916,8 +969,8 @@ export class PDFDocumentProxy {
|
|
|
916
969
|
unsafeUrl: string | undefined;
|
|
917
970
|
newWindow: boolean | undefined;
|
|
918
971
|
count: number | undefined;
|
|
919
|
-
items: any
|
|
920
|
-
}
|
|
972
|
+
items: Array</*elided*/ any>;
|
|
973
|
+
}>>;
|
|
921
974
|
/**
|
|
922
975
|
* @typedef {Object} GetOptionalContentConfigParameters
|
|
923
976
|
* @property {string} [intent] - Determines the optional content groups that
|
|
@@ -944,7 +997,7 @@ export class PDFDocumentProxy {
|
|
|
944
997
|
* The default value is 'display'.
|
|
945
998
|
*/
|
|
946
999
|
intent?: string | undefined;
|
|
947
|
-
}
|
|
1000
|
+
}): Promise<OptionalContentConfig>;
|
|
948
1001
|
/**
|
|
949
1002
|
* @returns {Promise<Array<number> | null>} A promise that is resolved with
|
|
950
1003
|
* an {Array} that contains the permission flags for the PDF document, or
|
|
@@ -1009,7 +1062,7 @@ export class PDFDocumentProxy {
|
|
|
1009
1062
|
* option unless absolutely necessary. The default value is `false`.
|
|
1010
1063
|
* @returns {Promise} A promise that is resolved when clean-up has finished.
|
|
1011
1064
|
*/
|
|
1012
|
-
cleanup(keepLoadedFonts?: boolean
|
|
1065
|
+
cleanup(keepLoadedFonts?: boolean): Promise<any>;
|
|
1013
1066
|
/**
|
|
1014
1067
|
* Destroys the current document instance and terminates the worker.
|
|
1015
1068
|
*/
|
|
@@ -1165,6 +1218,7 @@ export class PDFDocumentProxy {
|
|
|
1165
1218
|
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
|
|
1166
1219
|
* annotation ids with canvases used to render them.
|
|
1167
1220
|
* @property {PrintAnnotationStorage} [printAnnotationStorage]
|
|
1221
|
+
* @property {boolean} [isEditing] - Render the page in editing mode.
|
|
1168
1222
|
*/
|
|
1169
1223
|
/**
|
|
1170
1224
|
* Page getOperatorList parameters.
|
|
@@ -1185,6 +1239,7 @@ export class PDFDocumentProxy {
|
|
|
1185
1239
|
* from the {@link AnnotationStorage}-instance; useful e.g. for printing.
|
|
1186
1240
|
* The default value is `AnnotationMode.ENABLE`.
|
|
1187
1241
|
* @property {PrintAnnotationStorage} [printAnnotationStorage]
|
|
1242
|
+
* @property {boolean} [isEditing] - Render the page in editing mode.
|
|
1188
1243
|
*/
|
|
1189
1244
|
/**
|
|
1190
1245
|
* Structure tree node. The root node will have a role "Root".
|
|
@@ -1247,7 +1302,7 @@ export class PDFPageProxy {
|
|
|
1247
1302
|
* @type {Array<number>} An array of the visible portion of the PDF page in
|
|
1248
1303
|
* user space units [x1, y1, x2, y2].
|
|
1249
1304
|
*/
|
|
1250
|
-
get view(): number
|
|
1305
|
+
get view(): Array<number>;
|
|
1251
1306
|
/**
|
|
1252
1307
|
* @param {GetViewportParameters} params - Viewport parameters.
|
|
1253
1308
|
* @returns {PageViewport} Contains 'width' and 'height' properties
|
|
@@ -1259,7 +1314,7 @@ export class PDFPageProxy {
|
|
|
1259
1314
|
* @returns {Promise<Array<any>>} A promise that is resolved with an
|
|
1260
1315
|
* {Array} of the annotation objects.
|
|
1261
1316
|
*/
|
|
1262
|
-
getAnnotations({ intent }?: GetAnnotationsParameters
|
|
1317
|
+
getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
|
|
1263
1318
|
/**
|
|
1264
1319
|
* @returns {Promise<Object>} A promise that is resolved with an
|
|
1265
1320
|
* {Object} with JS actions.
|
|
@@ -1287,14 +1342,14 @@ export class PDFPageProxy {
|
|
|
1287
1342
|
* @returns {RenderTask} An object that contains a promise that is
|
|
1288
1343
|
* resolved when the page finishes rendering.
|
|
1289
1344
|
*/
|
|
1290
|
-
render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, }: RenderParameters): RenderTask;
|
|
1345
|
+
render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
|
|
1291
1346
|
/**
|
|
1292
1347
|
* @param {GetOperatorListParameters} params - Page getOperatorList
|
|
1293
1348
|
* parameters.
|
|
1294
1349
|
* @returns {Promise<PDFOperatorList>} A promise resolved with an
|
|
1295
1350
|
* {@link PDFOperatorList} object that represents the page's operator list.
|
|
1296
1351
|
*/
|
|
1297
|
-
getOperatorList({ intent, annotationMode, printAnnotationStorage, }?: GetOperatorListParameters): Promise<PDFOperatorList>;
|
|
1352
|
+
getOperatorList({ intent, annotationMode, printAnnotationStorage, isEditing, }?: GetOperatorListParameters): Promise<PDFOperatorList>;
|
|
1298
1353
|
/**
|
|
1299
1354
|
* NOTE: All occurrences of whitespace will be replaced by
|
|
1300
1355
|
* standard spaces (0x20).
|
|
@@ -1330,7 +1385,7 @@ export class PDFPageProxy {
|
|
|
1330
1385
|
* The default value is `false`.
|
|
1331
1386
|
* @returns {boolean} Indicates if clean-up was successfully run.
|
|
1332
1387
|
*/
|
|
1333
|
-
cleanup(resetStats?: boolean
|
|
1388
|
+
cleanup(resetStats?: boolean): boolean;
|
|
1334
1389
|
/**
|
|
1335
1390
|
* @private
|
|
1336
1391
|
*/
|
|
@@ -1354,6 +1409,13 @@ export class PDFPageProxy {
|
|
|
1354
1409
|
get stats(): StatTimer | null;
|
|
1355
1410
|
#private;
|
|
1356
1411
|
}
|
|
1412
|
+
/**
|
|
1413
|
+
* @typedef {Object} PDFWorkerParameters
|
|
1414
|
+
* @property {string} [name] - The name of the worker.
|
|
1415
|
+
* @property {Worker} [port] - The `workerPort` object.
|
|
1416
|
+
* @property {number} [verbosity] - Controls the logging level;
|
|
1417
|
+
* the constants from {@link VerbosityLevel} should be used.
|
|
1418
|
+
*/
|
|
1357
1419
|
/**
|
|
1358
1420
|
* PDF.js web worker abstraction that controls the instantiation of PDF
|
|
1359
1421
|
* documents. Message handlers are used to pass information from the main
|
|
@@ -1363,7 +1425,9 @@ export class PDFPageProxy {
|
|
|
1363
1425
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1364
1426
|
*/
|
|
1365
1427
|
export class PDFWorker {
|
|
1366
|
-
static "__#
|
|
1428
|
+
static "__#57@#fakeWorkerId": number;
|
|
1429
|
+
static "__#57@#isWorkerDisabled": boolean;
|
|
1430
|
+
static "__#57@#workerPorts": any;
|
|
1367
1431
|
/**
|
|
1368
1432
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1369
1433
|
*/
|
|
@@ -1373,7 +1437,7 @@ export class PDFWorker {
|
|
|
1373
1437
|
* @type {string}
|
|
1374
1438
|
*/
|
|
1375
1439
|
static get workerSrc(): string;
|
|
1376
|
-
static get "__#
|
|
1440
|
+
static get "__#57@#mainThreadWorkerMessageHandler"(): any;
|
|
1377
1441
|
static get _setupFakeWorkerGlobal(): any;
|
|
1378
1442
|
constructor({ name, port, verbosity, }?: {
|
|
1379
1443
|
name?: null | undefined;
|
|
@@ -1409,10 +1473,7 @@ export class PDFWorker {
|
|
|
1409
1473
|
* Destroys the worker instance.
|
|
1410
1474
|
*/
|
|
1411
1475
|
destroy(): void;
|
|
1412
|
-
|
|
1413
|
-
export namespace PDFWorkerUtil {
|
|
1414
|
-
let isWorkerDisabled: boolean;
|
|
1415
|
-
let fakeWorkerId: number;
|
|
1476
|
+
#private;
|
|
1416
1477
|
}
|
|
1417
1478
|
/**
|
|
1418
1479
|
* Allows controlling of the rendering tasks.
|
|
@@ -1438,7 +1499,7 @@ export class RenderTask {
|
|
|
1438
1499
|
*
|
|
1439
1500
|
* @param {number} [extraDelay]
|
|
1440
1501
|
*/
|
|
1441
|
-
cancel(extraDelay?: number
|
|
1502
|
+
cancel(extraDelay?: number): void;
|
|
1442
1503
|
/**
|
|
1443
1504
|
* Whether form fields are rendered separately from the main operatorList.
|
|
1444
1505
|
* @type {boolean}
|
|
@@ -1451,12 +1512,12 @@ export const version: string;
|
|
|
1451
1512
|
import { PageViewport } from "./display_utils.js";
|
|
1452
1513
|
import { OptionalContentConfig } from "./optional_content_config.js";
|
|
1453
1514
|
import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
1454
|
-
import { DOMCanvasFactory } from "./
|
|
1515
|
+
import { DOMCanvasFactory } from "./canvas_factory.js";
|
|
1455
1516
|
import { NodeCanvasFactory } from "./node_utils";
|
|
1456
|
-
import {
|
|
1457
|
-
import { DOMFilterFactory } from "./
|
|
1517
|
+
import { DOMCMapReaderFactory } from "./cmap_reader_factory";
|
|
1518
|
+
import { DOMFilterFactory } from "./filter_factory.js";
|
|
1458
1519
|
import { NodeFilterFactory } from "./node_utils";
|
|
1459
|
-
import {
|
|
1520
|
+
import { DOMStandardFontDataFactory } from "./standard_fontdata_factory";
|
|
1460
1521
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1461
1522
|
import { Metadata } from "./metadata.js";
|
|
1462
1523
|
import { StatTimer } from "./display_utils.js";
|
|
@@ -1478,12 +1539,17 @@ declare class PDFObjects {
|
|
|
1478
1539
|
* @param {function} [callback]
|
|
1479
1540
|
* @returns {any}
|
|
1480
1541
|
*/
|
|
1481
|
-
get(objId: string, callback?: Function
|
|
1542
|
+
get(objId: string, callback?: Function): any;
|
|
1482
1543
|
/**
|
|
1483
1544
|
* @param {string} objId
|
|
1484
1545
|
* @returns {boolean}
|
|
1485
1546
|
*/
|
|
1486
1547
|
has(objId: string): boolean;
|
|
1548
|
+
/**
|
|
1549
|
+
* @param {string} objId
|
|
1550
|
+
* @returns {boolean}
|
|
1551
|
+
*/
|
|
1552
|
+
delete(objId: string): boolean;
|
|
1487
1553
|
/**
|
|
1488
1554
|
* Resolves the object `objId` with optional `data`.
|
|
1489
1555
|
*
|
|
@@ -110,7 +110,7 @@ export class CanvasGraphics {
|
|
|
110
110
|
setLeadingMoveText(x: any, y: any): void;
|
|
111
111
|
setTextMatrix(a: any, b: any, c: any, d: any, e: any, f: any): void;
|
|
112
112
|
nextLine(): void;
|
|
113
|
-
paintChar(character: any, x: any, y: any,
|
|
113
|
+
paintChar(character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void;
|
|
114
114
|
get isFontSubpixelAAEnabled(): any;
|
|
115
115
|
showText(glyphs: any): void;
|
|
116
116
|
showType3Text(glyphs: any): void;
|
|
@@ -120,7 +120,9 @@ export class CanvasGraphics {
|
|
|
120
120
|
setStrokeColorN(...args: any[]): void;
|
|
121
121
|
setFillColorN(...args: any[]): void;
|
|
122
122
|
setStrokeRGBColor(r: any, g: any, b: any): void;
|
|
123
|
+
setStrokeTransparent(): void;
|
|
123
124
|
setFillRGBColor(r: any, g: any, b: any): void;
|
|
125
|
+
setFillTransparent(): void;
|
|
124
126
|
_getPattern(objId: any, matrix?: null): any;
|
|
125
127
|
shadingFill(objId: any): void;
|
|
126
128
|
beginInlineImage(): void;
|
|
@@ -177,6 +179,7 @@ declare class CanvasExtraState {
|
|
|
177
179
|
fillColor: string;
|
|
178
180
|
strokeColor: string;
|
|
179
181
|
patternFill: boolean;
|
|
182
|
+
patternStroke: boolean;
|
|
180
183
|
fillAlpha: number;
|
|
181
184
|
strokeAlpha: number;
|
|
182
185
|
lineWidth: number;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class BaseCanvasFactory {
|
|
2
|
+
constructor({ enableHWA }: {
|
|
3
|
+
enableHWA?: boolean | undefined;
|
|
4
|
+
});
|
|
5
|
+
create(width: any, height: any): {
|
|
6
|
+
canvas: void;
|
|
7
|
+
context: any;
|
|
8
|
+
};
|
|
9
|
+
reset(canvasAndContext: any, width: any, height: any): void;
|
|
10
|
+
destroy(canvasAndContext: any): void;
|
|
11
|
+
/**
|
|
12
|
+
* @ignore
|
|
13
|
+
*/
|
|
14
|
+
_createCanvas(width: any, height: any): void;
|
|
15
|
+
#private;
|
|
16
|
+
}
|
|
17
|
+
export class DOMCanvasFactory extends BaseCanvasFactory {
|
|
18
|
+
constructor({ ownerDocument, enableHWA }: {
|
|
19
|
+
ownerDocument?: Document | undefined;
|
|
20
|
+
enableHWA?: boolean | undefined;
|
|
21
|
+
});
|
|
22
|
+
_document: Document;
|
|
23
|
+
/**
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
_createCanvas(width: any, height: any): HTMLCanvasElement;
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class BaseCMapReaderFactory {
|
|
2
|
+
constructor({ baseUrl, isCompressed }: {
|
|
3
|
+
baseUrl?: null | undefined;
|
|
4
|
+
isCompressed?: boolean | undefined;
|
|
5
|
+
});
|
|
6
|
+
baseUrl: any;
|
|
7
|
+
isCompressed: boolean;
|
|
8
|
+
fetch({ name }: {
|
|
9
|
+
name: any;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
cMapData: Uint8Array<ArrayBufferLike>;
|
|
12
|
+
isCompressed: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
* @returns {Promise<Uint8Array>}
|
|
17
|
+
*/
|
|
18
|
+
_fetch(url: any): Promise<Uint8Array>;
|
|
19
|
+
}
|
|
20
|
+
export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
|
|
21
|
+
/**
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
_fetch(url: any): Promise<Uint8Array<any>>;
|
|
25
|
+
}
|