unpdf 0.12.2 → 1.0.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 +147 -79
- package/dist/index.cjs +118 -73
- package/dist/index.d.cts +24 -41
- package/dist/index.d.mts +24 -41
- package/dist/index.d.ts +24 -41
- package/dist/index.mjs +117 -72
- package/dist/pdfjs.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +25 -1
- package/dist/types/src/display/annotation_storage.d.ts +1 -8
- package/dist/types/src/display/api.d.ts +147 -57
- package/dist/types/src/display/canvas.d.ts +21 -28
- 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 +40 -60
- package/dist/types/src/display/draw_layer.d.ts +7 -19
- package/dist/types/src/display/editor/alt_text.d.ts +3 -2
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -11
- package/dist/types/src/display/editor/color_picker.d.ts +1 -0
- package/dist/types/src/display/editor/draw.d.ts +121 -0
- package/dist/types/src/display/editor/drawers/contour.d.ts +3 -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 +129 -0
- package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
- package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +79 -0
- package/dist/types/src/display/editor/editor.d.ts +55 -13
- package/dist/types/src/display/editor/freetext.d.ts +5 -16
- package/dist/types/src/display/editor/highlight.d.ts +8 -25
- package/dist/types/src/display/editor/ink.d.ts +21 -74
- package/dist/types/src/display/editor/signature.d.ts +80 -0
- package/dist/types/src/display/editor/stamp.d.ts +16 -22
- package/dist/types/src/display/editor/toolbar.d.ts +5 -2
- package/dist/types/src/display/editor/tools.d.ts +17 -9
- 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 -6
- package/dist/types/src/display/metadata.d.ts +1 -2
- package/dist/types/src/display/network.d.ts +11 -7
- package/dist/types/src/display/network_utils.d.ts +7 -6
- package/dist/types/src/display/node_stream.d.ts +6 -22
- package/dist/types/src/display/node_utils.d.ts +15 -11
- package/dist/types/src/display/optional_content_config.d.ts +2 -2
- package/dist/types/src/display/pattern_helper.d.ts +4 -2
- 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 +12 -9
- package/dist/types/src/display/touch_manager.d.ts +18 -0
- package/dist/types/src/display/transport_stream.d.ts +1 -1
- package/dist/types/src/display/wasm_factory.d.ts +20 -0
- 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 +13 -5
- package/dist/types/src/shared/message_handler.d.ts +9 -4
- package/dist/types/src/shared/util.d.ts +137 -129
- package/dist/types/web/annotation_editor_layer_builder.d.ts +20 -5
- package/dist/types/web/annotation_layer_builder.d.ts +35 -4
- package/dist/types/web/app_options.d.ts +1 -1
- package/dist/types/web/autolinker.d.ts +28 -0
- package/dist/types/web/base_pdf_page_view.d.ts +27 -0
- package/dist/types/web/draw_layer_builder.d.ts +13 -2
- package/dist/types/web/event_utils.d.ts +2 -2
- package/dist/types/web/genericl10n.d.ts +5 -5
- package/dist/types/web/interfaces.d.ts +5 -5
- package/dist/types/web/l10n.d.ts +2 -2
- package/dist/types/web/pdf_find_controller.d.ts +2 -0
- package/dist/types/web/pdf_link_service.d.ts +1 -2
- package/dist/types/web/pdf_page_detail_view.d.ts +32 -0
- package/dist/types/web/pdf_page_view.d.ts +44 -23
- package/dist/types/web/pdf_rendering_queue.d.ts +2 -1
- package/dist/types/web/pdf_thumbnail_view.d.ts +23 -3
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +21 -1
- package/dist/types/web/pdf_viewer.d.ts +44 -16
- package/dist/types/web/struct_tree_layer_builder.d.ts +20 -2
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +25 -17
- package/dist/types/web/ui_utils.d.ts +3 -19
- package/dist/types/web/xfa_layer_builder.d.ts +14 -3
- package/package.json +31 -28
- package/dist/types/src/display/base_factory.d.ts +0 -60
- 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;
|
|
@@ -50,6 +51,7 @@ export type AnnotationLayerParameters = {
|
|
|
50
51
|
annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
|
|
51
52
|
accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
|
|
52
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,24 @@ 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
|
-
|
|
81
|
+
/**
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
private static get _defaultBorderStyle();
|
|
85
|
+
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: {
|
|
79
86
|
div: any;
|
|
80
87
|
accessibilityManager: any;
|
|
81
88
|
annotationCanvasMap: any;
|
|
82
89
|
annotationEditorUIManager: any;
|
|
83
90
|
page: any;
|
|
84
91
|
viewport: any;
|
|
92
|
+
structTreeLayer: any;
|
|
85
93
|
});
|
|
86
94
|
div: any;
|
|
87
95
|
page: any;
|
|
@@ -97,6 +105,14 @@ export class AnnotationLayer {
|
|
|
97
105
|
* @memberof AnnotationLayer
|
|
98
106
|
*/
|
|
99
107
|
render(params: AnnotationLayerParameters): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Add link annotations to the annotation layer.
|
|
110
|
+
*
|
|
111
|
+
* @param {Array<Object>} annotations
|
|
112
|
+
* @param {IPDFLinkService} linkService
|
|
113
|
+
* @memberof AnnotationLayer
|
|
114
|
+
*/
|
|
115
|
+
addLinkAnnotations(annotations: Array<Object>, linkService: IPDFLinkService): Promise<void>;
|
|
100
116
|
/**
|
|
101
117
|
* Update the annotation elements on existing annotation layer.
|
|
102
118
|
*
|
|
@@ -115,6 +131,11 @@ export class FreeTextAnnotationElement extends AnnotationElement {
|
|
|
115
131
|
annotationEditorType: number;
|
|
116
132
|
render(): HTMLElement | undefined;
|
|
117
133
|
}
|
|
134
|
+
export class HighlightAnnotationElement extends AnnotationElement {
|
|
135
|
+
constructor(parameters: any);
|
|
136
|
+
annotationEditorType: number;
|
|
137
|
+
render(): HTMLElement | undefined;
|
|
138
|
+
}
|
|
118
139
|
export class InkAnnotationElement extends AnnotationElement {
|
|
119
140
|
constructor(parameters: any);
|
|
120
141
|
containerClassName: string;
|
|
@@ -126,6 +147,7 @@ export class InkAnnotationElement extends AnnotationElement {
|
|
|
126
147
|
}
|
|
127
148
|
export class StampAnnotationElement extends AnnotationElement {
|
|
128
149
|
constructor(parameters: any);
|
|
150
|
+
annotationEditorType: number;
|
|
129
151
|
render(): HTMLElement | undefined;
|
|
130
152
|
}
|
|
131
153
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
@@ -212,6 +234,8 @@ declare class AnnotationElement {
|
|
|
212
234
|
public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
|
|
213
235
|
addHighlightArea(): void;
|
|
214
236
|
_editOnDoubleClick(): void;
|
|
237
|
+
get width(): number;
|
|
238
|
+
get height(): number;
|
|
215
239
|
#private;
|
|
216
240
|
}
|
|
217
241
|
export {};
|
|
@@ -35,14 +35,6 @@ export class AnnotationStorage {
|
|
|
35
35
|
* @returns {boolean}
|
|
36
36
|
*/
|
|
37
37
|
has(key: string): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* @returns {Object | null}
|
|
40
|
-
*/
|
|
41
|
-
getAll(): Object | null;
|
|
42
|
-
/**
|
|
43
|
-
* @param {Object} obj
|
|
44
|
-
*/
|
|
45
|
-
setAll(obj: Object): void;
|
|
46
38
|
get size(): number;
|
|
47
39
|
resetModified(): void;
|
|
48
40
|
/**
|
|
@@ -71,6 +63,7 @@ export class AnnotationStorage {
|
|
|
71
63
|
ids: Set<string>;
|
|
72
64
|
hash: string;
|
|
73
65
|
};
|
|
66
|
+
[Symbol.iterator](): MapIterator<[any, any]>;
|
|
74
67
|
#private;
|
|
75
68
|
}
|
|
76
69
|
/**
|
|
@@ -79,11 +79,15 @@ export type DocumentInitParameters = {
|
|
|
79
79
|
cMapPacked?: boolean | undefined;
|
|
80
80
|
/**
|
|
81
81
|
* - The factory that will be used when
|
|
82
|
-
* reading built-in CMap files.
|
|
83
|
-
*
|
|
84
|
-
* Node.js. The default value is {DOMCMapReaderFactory}.
|
|
82
|
+
* reading built-in CMap files.
|
|
83
|
+
* The default value is {DOMCMapReaderFactory}.
|
|
85
84
|
*/
|
|
86
85
|
CMapReaderFactory?: Object | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* - The URL where the predefined ICC profiles are
|
|
88
|
+
* located. Include the trailing slash.
|
|
89
|
+
*/
|
|
90
|
+
iccUrl?: string | undefined;
|
|
87
91
|
/**
|
|
88
92
|
* - When `true`, fonts that aren't
|
|
89
93
|
* embedded in the PDF document will fallback to a system font.
|
|
@@ -99,18 +103,35 @@ export type DocumentInitParameters = {
|
|
|
99
103
|
standardFontDataUrl?: string | undefined;
|
|
100
104
|
/**
|
|
101
105
|
* - The factory that will be used
|
|
102
|
-
* when reading the standard font files.
|
|
103
|
-
*
|
|
104
|
-
* Node.js. The default value is {DOMStandardFontDataFactory}.
|
|
106
|
+
* when reading the standard font files.
|
|
107
|
+
* The default value is {DOMStandardFontDataFactory}.
|
|
105
108
|
*/
|
|
106
109
|
StandardFontDataFactory?: Object | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* - The URL where the wasm files are located.
|
|
112
|
+
* Include the trailing slash.
|
|
113
|
+
*/
|
|
114
|
+
wasmUrl?: string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* - The factory that will be used
|
|
117
|
+
* when reading the wasm files.
|
|
118
|
+
* The default value is {DOMWasmFactory}.
|
|
119
|
+
*/
|
|
120
|
+
WasmFactory?: Object | undefined;
|
|
107
121
|
/**
|
|
108
122
|
* - Enable using the Fetch API in the
|
|
109
123
|
* worker-thread when reading CMap and standard font files. When `true`,
|
|
110
|
-
* the `CMapReaderFactory` and `
|
|
124
|
+
* the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory`
|
|
125
|
+
* options are ignored.
|
|
111
126
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
112
127
|
*/
|
|
113
128
|
useWorkerFetch?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* - Attempt to use WebAssembly in order to
|
|
131
|
+
* improve e.g. image decoding performance.
|
|
132
|
+
* The default value is `true`.
|
|
133
|
+
*/
|
|
134
|
+
useWasm?: boolean | undefined;
|
|
114
135
|
/**
|
|
115
136
|
* - Reject certain promises, e.g.
|
|
116
137
|
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
|
|
@@ -137,6 +158,23 @@ export type DocumentInitParameters = {
|
|
|
137
158
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
138
159
|
*/
|
|
139
160
|
isOffscreenCanvasSupported?: boolean | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* - Determines if we can use
|
|
163
|
+
* `ImageDecoder` in the worker. Primarily used to improve performance of
|
|
164
|
+
* image conversion/rendering.
|
|
165
|
+
* The default value is `true` in web environments and `false` in Node.js.
|
|
166
|
+
*
|
|
167
|
+
* NOTE: Also temporarily disabled in Chromium browsers, until we no longer
|
|
168
|
+
* support the affected browser versions, because of various bugs:
|
|
169
|
+
*
|
|
170
|
+
* - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
|
|
171
|
+
* see https://issues.chromium.org/issues/374807001
|
|
172
|
+
*
|
|
173
|
+
* - Broken images when using the JPEG decoder with images that have custom
|
|
174
|
+
* colour profiles, e.g. GitHub discussion 19030;
|
|
175
|
+
* see https://issues.chromium.org/issues/378869810
|
|
176
|
+
*/
|
|
177
|
+
isImageDecoderSupported?: boolean | undefined;
|
|
140
178
|
/**
|
|
141
179
|
* - The integer value is used to
|
|
142
180
|
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
|
@@ -198,15 +236,16 @@ export type DocumentInitParameters = {
|
|
|
198
236
|
*/
|
|
199
237
|
pdfBug?: boolean | undefined;
|
|
200
238
|
/**
|
|
201
|
-
* - The factory
|
|
202
|
-
*
|
|
239
|
+
* - The factory that will be used when
|
|
240
|
+
* creating canvases. The default value is {DOMCanvasFactory}.
|
|
203
241
|
*/
|
|
204
|
-
|
|
242
|
+
CanvasFactory?: Object | undefined;
|
|
205
243
|
/**
|
|
206
|
-
* -
|
|
207
|
-
*
|
|
244
|
+
* - The factory that will be used to
|
|
245
|
+
* create SVG filters when rendering some images on the main canvas.
|
|
246
|
+
* The default value is {DOMFilterFactory}.
|
|
208
247
|
*/
|
|
209
|
-
|
|
248
|
+
FilterFactory?: Object | undefined;
|
|
210
249
|
/**
|
|
211
250
|
* - Enables hardware acceleration for
|
|
212
251
|
* rendering. The default value is `false`.
|
|
@@ -535,10 +574,6 @@ export type PDFWorkerParameters = {
|
|
|
535
574
|
};
|
|
536
575
|
/** @type {string} */
|
|
537
576
|
export const build: string;
|
|
538
|
-
export const DefaultCanvasFactory: typeof NodeCanvasFactory;
|
|
539
|
-
export const DefaultCMapReaderFactory: typeof NodeCMapReaderFactory;
|
|
540
|
-
export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
|
|
541
|
-
export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
542
577
|
/**
|
|
543
578
|
* @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
|
|
544
579
|
* Int16Array | Uint16Array |
|
|
@@ -587,9 +622,10 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
587
622
|
* @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
|
|
588
623
|
* packed or not. The default value is `true`.
|
|
589
624
|
* @property {Object} [CMapReaderFactory] - The factory that will be used when
|
|
590
|
-
* reading built-in CMap files.
|
|
591
|
-
*
|
|
592
|
-
*
|
|
625
|
+
* reading built-in CMap files.
|
|
626
|
+
* The default value is {DOMCMapReaderFactory}.
|
|
627
|
+
* @property {string} [iccUrl] - The URL where the predefined ICC profiles are
|
|
628
|
+
* located. Include the trailing slash.
|
|
593
629
|
* @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
|
|
594
630
|
* embedded in the PDF document will fallback to a system font.
|
|
595
631
|
* The default value is `true` in web environments and `false` in Node.js;
|
|
@@ -598,13 +634,21 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
598
634
|
* @property {string} [standardFontDataUrl] - The URL where the standard font
|
|
599
635
|
* files are located. Include the trailing slash.
|
|
600
636
|
* @property {Object} [StandardFontDataFactory] - The factory that will be used
|
|
601
|
-
* when reading the standard font files.
|
|
602
|
-
*
|
|
603
|
-
*
|
|
637
|
+
* when reading the standard font files.
|
|
638
|
+
* The default value is {DOMStandardFontDataFactory}.
|
|
639
|
+
* @property {string} [wasmUrl] - The URL where the wasm files are located.
|
|
640
|
+
* Include the trailing slash.
|
|
641
|
+
* @property {Object} [WasmFactory] - The factory that will be used
|
|
642
|
+
* when reading the wasm files.
|
|
643
|
+
* The default value is {DOMWasmFactory}.
|
|
604
644
|
* @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the
|
|
605
645
|
* worker-thread when reading CMap and standard font files. When `true`,
|
|
606
|
-
* the `CMapReaderFactory` and `
|
|
646
|
+
* the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory`
|
|
647
|
+
* options are ignored.
|
|
607
648
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
649
|
+
* @property {boolean} [useWasm] - Attempt to use WebAssembly in order to
|
|
650
|
+
* improve e.g. image decoding performance.
|
|
651
|
+
* The default value is `true`.
|
|
608
652
|
* @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
|
|
609
653
|
* `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
|
|
610
654
|
* PDF data cannot be successfully parsed, instead of attempting to recover
|
|
@@ -619,6 +663,21 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
619
663
|
* `OffscreenCanvas` in the worker. Primarily used to improve performance of
|
|
620
664
|
* image conversion/rendering.
|
|
621
665
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
666
|
+
* @property {boolean} [isImageDecoderSupported] - Determines if we can use
|
|
667
|
+
* `ImageDecoder` in the worker. Primarily used to improve performance of
|
|
668
|
+
* image conversion/rendering.
|
|
669
|
+
* The default value is `true` in web environments and `false` in Node.js.
|
|
670
|
+
*
|
|
671
|
+
* NOTE: Also temporarily disabled in Chromium browsers, until we no longer
|
|
672
|
+
* support the affected browser versions, because of various bugs:
|
|
673
|
+
*
|
|
674
|
+
* - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
|
|
675
|
+
* see https://issues.chromium.org/issues/374807001
|
|
676
|
+
*
|
|
677
|
+
* - Broken images when using the JPEG decoder with images that have custom
|
|
678
|
+
* colour profiles, e.g. GitHub discussion 19030;
|
|
679
|
+
* see https://issues.chromium.org/issues/378869810
|
|
680
|
+
*
|
|
622
681
|
* @property {number} [canvasMaxAreaInBytes] - The integer value is used to
|
|
623
682
|
* know when an image must be resized (uses `OffscreenCanvas` in the worker).
|
|
624
683
|
* If it's -1 then a possibly slow algorithm is used to guess the max value.
|
|
@@ -652,10 +711,11 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
652
711
|
* disabling of pre-fetching to work correctly.
|
|
653
712
|
* @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
|
|
654
713
|
* (see `web/debugger.js`). The default value is `false`.
|
|
655
|
-
* @property {Object} [
|
|
656
|
-
*
|
|
657
|
-
* @property {Object} [
|
|
658
|
-
*
|
|
714
|
+
* @property {Object} [CanvasFactory] - The factory that will be used when
|
|
715
|
+
* creating canvases. The default value is {DOMCanvasFactory}.
|
|
716
|
+
* @property {Object} [FilterFactory] - The factory that will be used to
|
|
717
|
+
* create SVG filters when rendering some images on the main canvas.
|
|
718
|
+
* The default value is {DOMFilterFactory}.
|
|
659
719
|
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
660
720
|
* rendering. The default value is `false`.
|
|
661
721
|
*/
|
|
@@ -672,9 +732,10 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
672
732
|
* @returns {PDFDocumentLoadingTask}
|
|
673
733
|
*/
|
|
674
734
|
export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
|
|
735
|
+
export const isValidExplicitDest: (dest?: any) => boolean;
|
|
675
736
|
export class LoopbackPort {
|
|
676
737
|
postMessage(obj: any, transfer: any): void;
|
|
677
|
-
addEventListener(name: any, listener: any): void;
|
|
738
|
+
addEventListener(name: any, listener: any, options?: null): void;
|
|
678
739
|
removeEventListener(name: any, listener: any): void;
|
|
679
740
|
terminate(): void;
|
|
680
741
|
#private;
|
|
@@ -693,9 +754,9 @@ export class PDFDataRangeTransport {
|
|
|
693
754
|
* @param {boolean} [progressiveDone]
|
|
694
755
|
* @param {string} [contentDispositionFilename]
|
|
695
756
|
*/
|
|
696
|
-
constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean
|
|
757
|
+
constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean, contentDispositionFilename?: string);
|
|
697
758
|
length: number;
|
|
698
|
-
initialData: Uint8Array | null;
|
|
759
|
+
initialData: Uint8Array<ArrayBufferLike> | null;
|
|
699
760
|
progressiveDone: boolean;
|
|
700
761
|
contentDispositionFilename: string;
|
|
701
762
|
_rangeListeners: any[];
|
|
@@ -753,10 +814,19 @@ export class PDFDataRangeTransport {
|
|
|
753
814
|
* after which individual pages can be rendered.
|
|
754
815
|
*/
|
|
755
816
|
export class PDFDocumentLoadingTask {
|
|
756
|
-
static "__#
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
817
|
+
static "__#55@#docId": number;
|
|
818
|
+
/**
|
|
819
|
+
* @private
|
|
820
|
+
*/
|
|
821
|
+
private _capability;
|
|
822
|
+
/**
|
|
823
|
+
* @private
|
|
824
|
+
*/
|
|
825
|
+
private _transport;
|
|
826
|
+
/**
|
|
827
|
+
* @private
|
|
828
|
+
*/
|
|
829
|
+
private _worker;
|
|
760
830
|
/**
|
|
761
831
|
* Unique identifier for the document loading task.
|
|
762
832
|
* @type {string}
|
|
@@ -792,6 +862,13 @@ export class PDFDocumentLoadingTask {
|
|
|
792
862
|
* completed.
|
|
793
863
|
*/
|
|
794
864
|
destroy(): Promise<void>;
|
|
865
|
+
/**
|
|
866
|
+
* Attempt to fetch the raw data of the PDF document, when e.g.
|
|
867
|
+
* - An exception was thrown during document initialization.
|
|
868
|
+
* - An `onPassword` callback is delaying initialization.
|
|
869
|
+
* @returns {Promise<Uint8Array>}
|
|
870
|
+
*/
|
|
871
|
+
getData(): Promise<Uint8Array>;
|
|
795
872
|
}
|
|
796
873
|
/**
|
|
797
874
|
* Proxy to a `PDFDocument` in the worker thread.
|
|
@@ -804,6 +881,10 @@ export class PDFDocumentProxy {
|
|
|
804
881
|
* @type {AnnotationStorage} Storage for annotation data in forms.
|
|
805
882
|
*/
|
|
806
883
|
get annotationStorage(): AnnotationStorage;
|
|
884
|
+
/**
|
|
885
|
+
* @type {Object} The canvas factory instance.
|
|
886
|
+
*/
|
|
887
|
+
get canvasFactory(): Object;
|
|
807
888
|
/**
|
|
808
889
|
* @type {Object} The filter factory instance.
|
|
809
890
|
*/
|
|
@@ -813,12 +894,12 @@ export class PDFDocumentProxy {
|
|
|
813
894
|
*/
|
|
814
895
|
get numPages(): number;
|
|
815
896
|
/**
|
|
816
|
-
* @type {Array<string
|
|
817
|
-
*
|
|
897
|
+
* @type {Array<string | null>} A (not guaranteed to be) unique ID to identify
|
|
898
|
+
* the PDF document.
|
|
818
899
|
* NOTE: The first element will always be defined for all PDF documents,
|
|
819
900
|
* whereas the second element is only defined for *modified* PDF documents.
|
|
820
901
|
*/
|
|
821
|
-
get fingerprints(): string
|
|
902
|
+
get fingerprints(): Array<string | null>;
|
|
822
903
|
/**
|
|
823
904
|
* @type {boolean} True if only XFA form.
|
|
824
905
|
*/
|
|
@@ -931,7 +1012,7 @@ export class PDFDocumentProxy {
|
|
|
931
1012
|
unsafeUrl: string | undefined;
|
|
932
1013
|
newWindow: boolean | undefined;
|
|
933
1014
|
count: number | undefined;
|
|
934
|
-
items: Array
|
|
1015
|
+
items: Array</*elided*/ any>;
|
|
935
1016
|
}>>;
|
|
936
1017
|
/**
|
|
937
1018
|
* @typedef {Object} GetOptionalContentConfigParameters
|
|
@@ -959,7 +1040,7 @@ export class PDFDocumentProxy {
|
|
|
959
1040
|
* The default value is 'display'.
|
|
960
1041
|
*/
|
|
961
1042
|
intent?: string | undefined;
|
|
962
|
-
}
|
|
1043
|
+
}): Promise<OptionalContentConfig>;
|
|
963
1044
|
/**
|
|
964
1045
|
* @returns {Promise<Array<number> | null>} A promise that is resolved with
|
|
965
1046
|
* an {Array} that contains the permission flags for the PDF document, or
|
|
@@ -1024,7 +1105,7 @@ export class PDFDocumentProxy {
|
|
|
1024
1105
|
* option unless absolutely necessary. The default value is `false`.
|
|
1025
1106
|
* @returns {Promise} A promise that is resolved when clean-up has finished.
|
|
1026
1107
|
*/
|
|
1027
|
-
cleanup(keepLoadedFonts?: boolean
|
|
1108
|
+
cleanup(keepLoadedFonts?: boolean): Promise<any>;
|
|
1028
1109
|
/**
|
|
1029
1110
|
* Destroys the current document instance and terminates the worker.
|
|
1030
1111
|
*/
|
|
@@ -1241,7 +1322,6 @@ export class PDFPageProxy {
|
|
|
1241
1322
|
/** @type {PDFObjects} */
|
|
1242
1323
|
commonObjs: PDFObjects;
|
|
1243
1324
|
objs: PDFObjects;
|
|
1244
|
-
_maybeCleanupAfterRender: boolean;
|
|
1245
1325
|
_intentStates: Map<any, any>;
|
|
1246
1326
|
destroyed: boolean;
|
|
1247
1327
|
/**
|
|
@@ -1264,7 +1344,7 @@ export class PDFPageProxy {
|
|
|
1264
1344
|
* @type {Array<number>} An array of the visible portion of the PDF page in
|
|
1265
1345
|
* user space units [x1, y1, x2, y2].
|
|
1266
1346
|
*/
|
|
1267
|
-
get view(): number
|
|
1347
|
+
get view(): Array<number>;
|
|
1268
1348
|
/**
|
|
1269
1349
|
* @param {GetViewportParameters} params - Viewport parameters.
|
|
1270
1350
|
* @returns {PageViewport} Contains 'width' and 'height' properties
|
|
@@ -1276,7 +1356,7 @@ export class PDFPageProxy {
|
|
|
1276
1356
|
* @returns {Promise<Array<any>>} A promise that is resolved with an
|
|
1277
1357
|
* {Array} of the annotation objects.
|
|
1278
1358
|
*/
|
|
1279
|
-
getAnnotations({ intent }?: GetAnnotationsParameters
|
|
1359
|
+
getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
|
|
1280
1360
|
/**
|
|
1281
1361
|
* @returns {Promise<Object>} A promise that is resolved with an
|
|
1282
1362
|
* {Object} with JS actions.
|
|
@@ -1347,7 +1427,7 @@ export class PDFPageProxy {
|
|
|
1347
1427
|
* The default value is `false`.
|
|
1348
1428
|
* @returns {boolean} Indicates if clean-up was successfully run.
|
|
1349
1429
|
*/
|
|
1350
|
-
cleanup(resetStats?: boolean
|
|
1430
|
+
cleanup(resetStats?: boolean): boolean;
|
|
1351
1431
|
/**
|
|
1352
1432
|
* @private
|
|
1353
1433
|
*/
|
|
@@ -1387,19 +1467,20 @@ export class PDFPageProxy {
|
|
|
1387
1467
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1388
1468
|
*/
|
|
1389
1469
|
export class PDFWorker {
|
|
1390
|
-
static "__#
|
|
1391
|
-
static "__#
|
|
1392
|
-
static "__#
|
|
1470
|
+
static "__#58@#fakeWorkerId": number;
|
|
1471
|
+
static "__#58@#isWorkerDisabled": boolean;
|
|
1472
|
+
static "__#58@#workerPorts": any;
|
|
1393
1473
|
/**
|
|
1394
1474
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1475
|
+
* @returns {PDFWorker}
|
|
1395
1476
|
*/
|
|
1396
|
-
static fromPort(params: PDFWorkerParameters):
|
|
1477
|
+
static fromPort(params: PDFWorkerParameters): PDFWorker;
|
|
1397
1478
|
/**
|
|
1398
1479
|
* The current `workerSrc`, when it exists.
|
|
1399
1480
|
* @type {string}
|
|
1400
1481
|
*/
|
|
1401
1482
|
static get workerSrc(): string;
|
|
1402
|
-
static get "__#
|
|
1483
|
+
static get "__#58@#mainThreadWorkerMessageHandler"(): any;
|
|
1403
1484
|
static get _setupFakeWorkerGlobal(): any;
|
|
1404
1485
|
constructor({ name, port, verbosity, }?: {
|
|
1405
1486
|
name?: null | undefined;
|
|
@@ -1449,6 +1530,15 @@ export class RenderTask {
|
|
|
1449
1530
|
* @type {function}
|
|
1450
1531
|
*/
|
|
1451
1532
|
onContinue: Function;
|
|
1533
|
+
/**
|
|
1534
|
+
* A function that will be synchronously called when the rendering tasks
|
|
1535
|
+
* finishes with an error (either because of an actual error, or because the
|
|
1536
|
+
* rendering is cancelled).
|
|
1537
|
+
*
|
|
1538
|
+
* @type {function}
|
|
1539
|
+
* @param {Error} error
|
|
1540
|
+
*/
|
|
1541
|
+
onError: Function;
|
|
1452
1542
|
/**
|
|
1453
1543
|
* Promise for rendering task completion.
|
|
1454
1544
|
* @type {Promise<void>}
|
|
@@ -1461,7 +1551,7 @@ export class RenderTask {
|
|
|
1461
1551
|
*
|
|
1462
1552
|
* @param {number} [extraDelay]
|
|
1463
1553
|
*/
|
|
1464
|
-
cancel(extraDelay?: number
|
|
1554
|
+
cancel(extraDelay?: number): void;
|
|
1465
1555
|
/**
|
|
1466
1556
|
* Whether form fields are rendered separately from the main operatorList.
|
|
1467
1557
|
* @type {boolean}
|
|
@@ -1474,11 +1564,6 @@ export const version: string;
|
|
|
1474
1564
|
import { PageViewport } from "./display_utils.js";
|
|
1475
1565
|
import { OptionalContentConfig } from "./optional_content_config.js";
|
|
1476
1566
|
import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
1477
|
-
import { NodeCanvasFactory } from "./node_utils";
|
|
1478
|
-
import { NodeCMapReaderFactory } from "./node_utils";
|
|
1479
|
-
import { DOMFilterFactory } from "./display_utils.js";
|
|
1480
|
-
import { NodeFilterFactory } from "./node_utils";
|
|
1481
|
-
import { NodeStandardFontDataFactory } from "./node_utils";
|
|
1482
1567
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1483
1568
|
import { Metadata } from "./metadata.js";
|
|
1484
1569
|
import { StatTimer } from "./display_utils.js";
|
|
@@ -1500,12 +1585,17 @@ declare class PDFObjects {
|
|
|
1500
1585
|
* @param {function} [callback]
|
|
1501
1586
|
* @returns {any}
|
|
1502
1587
|
*/
|
|
1503
|
-
get(objId: string, callback?: Function
|
|
1588
|
+
get(objId: string, callback?: Function): any;
|
|
1504
1589
|
/**
|
|
1505
1590
|
* @param {string} objId
|
|
1506
1591
|
* @returns {boolean}
|
|
1507
1592
|
*/
|
|
1508
1593
|
has(objId: string): boolean;
|
|
1594
|
+
/**
|
|
1595
|
+
* @param {string} objId
|
|
1596
|
+
* @returns {boolean}
|
|
1597
|
+
*/
|
|
1598
|
+
delete(objId: string): boolean;
|
|
1509
1599
|
/**
|
|
1510
1600
|
* Resolves the object `objId` with optional `data`.
|
|
1511
1601
|
*
|
|
@@ -15,7 +15,6 @@ export class CanvasGraphics {
|
|
|
15
15
|
canvasFactory: any;
|
|
16
16
|
filterFactory: any;
|
|
17
17
|
groupStack: any[];
|
|
18
|
-
processingType3: any;
|
|
19
18
|
baseTransform: any;
|
|
20
19
|
baseTransformStack: any[];
|
|
21
20
|
groupLevel: number;
|
|
@@ -84,17 +83,18 @@ export class CanvasGraphics {
|
|
|
84
83
|
save(): void;
|
|
85
84
|
restore(): void;
|
|
86
85
|
transform(a: any, b: any, c: any, d: any, e: any, f: any): void;
|
|
87
|
-
constructPath(
|
|
86
|
+
constructPath(op: any, data: any, minMax: any): void;
|
|
88
87
|
closePath(): void;
|
|
89
|
-
stroke(consumePath?: boolean): void;
|
|
90
|
-
closeStroke(): void;
|
|
91
|
-
fill(consumePath?: boolean): void;
|
|
92
|
-
eoFill(): void;
|
|
93
|
-
fillStroke(): void;
|
|
94
|
-
eoFillStroke(): void;
|
|
95
|
-
closeFillStroke(): void;
|
|
96
|
-
closeEOFillStroke(): void;
|
|
97
|
-
endPath(): void;
|
|
88
|
+
stroke(path: any, consumePath?: boolean): void;
|
|
89
|
+
closeStroke(path: any): void;
|
|
90
|
+
fill(path: any, consumePath?: boolean): void;
|
|
91
|
+
eoFill(path: any): void;
|
|
92
|
+
fillStroke(path: any): void;
|
|
93
|
+
eoFillStroke(path: any): void;
|
|
94
|
+
closeFillStroke(path: any): void;
|
|
95
|
+
closeEOFillStroke(path: any): void;
|
|
96
|
+
endPath(path: any): void;
|
|
97
|
+
rawFillPath(path: any): void;
|
|
98
98
|
clip(): void;
|
|
99
99
|
eoClip(): void;
|
|
100
100
|
beginText(): void;
|
|
@@ -108,9 +108,9 @@ export class CanvasGraphics {
|
|
|
108
108
|
setTextRise(rise: any): void;
|
|
109
109
|
moveText(x: any, y: any): void;
|
|
110
110
|
setLeadingMoveText(x: any, y: any): void;
|
|
111
|
-
setTextMatrix(
|
|
111
|
+
setTextMatrix(matrix: 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;
|
|
@@ -151,10 +151,10 @@ export class CanvasGraphics {
|
|
|
151
151
|
endMarkedContent(): void;
|
|
152
152
|
beginCompat(): void;
|
|
153
153
|
endCompat(): void;
|
|
154
|
-
consumePath(clipBox: any): void;
|
|
154
|
+
consumePath(path: any, clipBox: any): void;
|
|
155
155
|
getSinglePixelWidth(): number;
|
|
156
156
|
getScaleForStroking(): number[];
|
|
157
|
-
rescaleAndStroke(saveRestore: any): void;
|
|
157
|
+
rescaleAndStroke(path: any, saveRestore: any): void;
|
|
158
158
|
isContentVisible(): boolean;
|
|
159
159
|
#private;
|
|
160
160
|
}
|
|
@@ -163,7 +163,7 @@ declare class CanvasExtraState {
|
|
|
163
163
|
alphaIsShape: boolean;
|
|
164
164
|
fontSize: number;
|
|
165
165
|
fontSizeScale: number;
|
|
166
|
-
textMatrix:
|
|
166
|
+
textMatrix: null;
|
|
167
167
|
textMatrixScale: number;
|
|
168
168
|
fontMatrix: number[];
|
|
169
169
|
leading: number;
|
|
@@ -179,26 +179,19 @@ declare class CanvasExtraState {
|
|
|
179
179
|
fillColor: string;
|
|
180
180
|
strokeColor: string;
|
|
181
181
|
patternFill: boolean;
|
|
182
|
+
patternStroke: boolean;
|
|
182
183
|
fillAlpha: number;
|
|
183
184
|
strokeAlpha: number;
|
|
184
185
|
lineWidth: number;
|
|
185
|
-
activeSMask:
|
|
186
|
+
activeSMask: null;
|
|
186
187
|
transferMaps: string;
|
|
188
|
+
clipBox: Float32Array<ArrayBuffer>;
|
|
189
|
+
minMax: Float32Array<ArrayBuffer>;
|
|
187
190
|
clone(): any;
|
|
188
|
-
|
|
189
|
-
updatePathMinMax(transform: any, x: any, y: any): void;
|
|
190
|
-
minX: any;
|
|
191
|
-
minY: any;
|
|
192
|
-
maxX: any;
|
|
193
|
-
maxY: any;
|
|
194
|
-
updateRectMinMax(transform: any, rect: any): void;
|
|
195
|
-
updateScalingPathMinMax(transform: any, minMax: any): void;
|
|
196
|
-
updateCurvePathMinMax(transform: any, x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void;
|
|
197
|
-
getPathBoundingBox(pathType?: string, transform?: null): any[];
|
|
191
|
+
getPathBoundingBox(pathType?: string, transform?: null): Float32Array<ArrayBuffer>;
|
|
198
192
|
updateClipFromPath(): void;
|
|
199
193
|
isEmptyClip(): boolean;
|
|
200
194
|
startNewPathAndClipBox(box: any): void;
|
|
201
|
-
clipBox: any;
|
|
202
195
|
getClippedPathBoundingBox(pathType?: string, transform?: null): number[] | null;
|
|
203
196
|
}
|
|
204
197
|
declare class CachedCanvases {
|
|
@@ -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
|
+
}
|