unpdf 1.4.0 → 1.5.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 +22 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/pdfjs.mjs +107 -1
- package/dist/types/src/display/annotation_layer.d.ts +14 -11
- package/dist/types/src/display/annotation_storage.d.ts +8 -8
- package/dist/types/src/display/api.d.ts +81 -57
- package/dist/types/src/display/api_utils.d.ts +1 -1
- package/dist/types/src/display/binary_data_factory.d.ts +26 -0
- package/dist/types/src/display/canvas.d.ts +19 -16
- package/dist/types/src/display/canvas_dependency_tracker.d.ts +66 -10
- package/dist/types/src/display/canvas_factory.d.ts +3 -1
- package/dist/types/src/display/display_utils.d.ts +4 -3
- package/dist/types/src/display/draw_layer.d.ts +2 -6
- package/dist/types/src/display/editor/alt_text.d.ts +1 -1
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +7 -12
- package/dist/types/src/display/editor/color_picker.d.ts +2 -2
- package/dist/types/src/display/editor/comment.d.ts +12 -0
- package/dist/types/src/display/editor/draw.d.ts +3 -7
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
- package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/types/src/display/editor/editor.d.ts +16 -13
- package/dist/types/src/display/editor/freetext.d.ts +2 -2
- package/dist/types/src/display/editor/highlight.d.ts +3 -3
- package/dist/types/src/display/editor/toolbar.d.ts +2 -2
- package/dist/types/src/display/editor/tools.d.ts +37 -1
- package/dist/types/src/display/fetch_stream.d.ts +3 -56
- package/dist/types/src/display/font_loader.d.ts +2 -1
- package/dist/types/src/display/network.d.ts +14 -80
- package/dist/types/src/display/network_stream.d.ts +2 -0
- package/dist/types/src/display/network_utils.d.ts +3 -3
- package/dist/types/src/display/node_stream.d.ts +2 -52
- package/dist/types/src/display/node_utils.d.ts +5 -19
- package/dist/types/src/{shared/obj-bin-transform.d.ts → display/obj_bin_transform_display.d.ts} +21 -18
- package/dist/types/src/display/pages_mapper.d.ts +72 -0
- package/dist/types/src/display/pattern_helper.d.ts +7 -2
- package/dist/types/src/display/text_layer.d.ts +16 -10
- package/dist/types/src/display/text_layer_images.d.ts +10 -0
- package/dist/types/src/display/transport_stream.d.ts +8 -64
- package/dist/types/src/display/webgpu_mesh.d.ts +3 -0
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/display/xfa_layer.d.ts +3 -3
- package/dist/types/src/pdf.d.ts +5 -1
- package/dist/types/src/{interfaces.d.ts → shared/base_pdf_stream.d.ts} +26 -27
- package/dist/types/src/shared/obj_bin_transform_utils.d.ts +26 -0
- package/dist/types/src/shared/util.d.ts +14 -5
- package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
- package/dist/types/web/annotation_layer_builder.d.ts +9 -9
- package/dist/types/web/app_options.d.ts +1 -1
- package/dist/types/web/autolinker.d.ts +3 -2
- package/dist/types/web/base_download_manager.d.ts +24 -0
- package/dist/types/web/base_pdf_page_view.d.ts +5 -5
- package/dist/types/web/comment_manager.d.ts +2 -2
- package/dist/types/web/download_manager.d.ts +3 -12
- package/dist/types/web/draw_layer_builder.d.ts +0 -12
- package/dist/types/web/genericl10n.d.ts +6 -10
- package/dist/types/web/l10n.d.ts +3 -6
- package/dist/types/web/menu.d.ts +11 -0
- package/dist/types/web/pdf_find_controller.d.ts +9 -11
- package/dist/types/web/pdf_history.d.ts +3 -3
- package/dist/types/web/pdf_link_service.d.ts +2 -7
- package/dist/types/web/pdf_page_detail_view.d.ts +1 -7
- package/dist/types/web/pdf_page_view.d.ts +17 -11
- package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
- package/dist/types/web/pdf_thumbnail_view.d.ts +18 -42
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
- package/dist/types/web/pdf_viewer.component.d.ts +1 -1
- package/dist/types/web/pdf_viewer.d.ts +30 -27
- package/dist/types/web/renderable_view.d.ts +33 -0
- package/dist/types/web/sidebar.d.ts +65 -0
- package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +11 -6
- package/dist/types/web/ui_utils.d.ts +3 -11
- package/dist/types/web/xfa_layer_builder.d.ts +4 -4
- package/package.json +22 -17
- package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
- package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
- package/dist/types/src/display/wasm_factory.d.ts +0 -20
- package/dist/types/web/interfaces.d.ts +0 -174
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export type PDFPageProxy = import("./api").PDFPageProxy;
|
|
2
2
|
export type PageViewport = import("./display_utils").PageViewport;
|
|
3
3
|
export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
|
|
4
|
-
export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
|
|
5
|
-
export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
|
|
6
4
|
export type AnnotationEditorUIManager = any;
|
|
7
5
|
export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
|
|
8
6
|
export type CommentManager = import("../../web/comment_manager.js").CommentManager;
|
|
7
|
+
export type PDFLinkService = import("../../web/pdf_link_service.js").PDFLinkService;
|
|
8
|
+
export type BaseDownloadManager = import("../../web/base_download_manager.js").BaseDownloadManager;
|
|
9
9
|
export type AnnotationElementParameters = {
|
|
10
10
|
data: Object;
|
|
11
11
|
layer: HTMLDivElement;
|
|
12
|
-
linkService:
|
|
13
|
-
downloadManager?: import("../../web/
|
|
12
|
+
linkService: PDFLinkService;
|
|
13
|
+
downloadManager?: import("../../web/base_download_manager.js").BaseDownloadManager | undefined;
|
|
14
14
|
annotationStorage?: AnnotationStorage | undefined;
|
|
15
15
|
/**
|
|
16
16
|
* - Path for image resources, mainly
|
|
@@ -28,8 +28,8 @@ export type AnnotationLayerParameters = {
|
|
|
28
28
|
div: HTMLDivElement;
|
|
29
29
|
annotations: any[];
|
|
30
30
|
page: PDFPageProxy;
|
|
31
|
-
linkService:
|
|
32
|
-
downloadManager?: import("../../web/
|
|
31
|
+
linkService: PDFLinkService;
|
|
32
|
+
downloadManager?: import("../../web/base_download_manager.js").BaseDownloadManager | undefined;
|
|
33
33
|
annotationStorage?: AnnotationStorage | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* - Path for image resources, mainly
|
|
@@ -64,8 +64,8 @@ export type AnnotationLayerParameters = {
|
|
|
64
64
|
* @property {HTMLDivElement} div
|
|
65
65
|
* @property {Array} annotations
|
|
66
66
|
* @property {PDFPageProxy} page
|
|
67
|
-
* @property {
|
|
68
|
-
* @property {
|
|
67
|
+
* @property {PDFLinkService} linkService
|
|
68
|
+
* @property {BaseDownloadManager} [downloadManager]
|
|
69
69
|
* @property {AnnotationStorage} [annotationStorage]
|
|
70
70
|
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
|
71
71
|
* for annotation icons. Include trailing slash.
|
|
@@ -119,8 +119,6 @@ export class AnnotationLayer {
|
|
|
119
119
|
* Add link annotations to the annotation layer.
|
|
120
120
|
*
|
|
121
121
|
* @param {Array<Object>} annotations
|
|
122
|
-
* @param {IPDFLinkService} linkService
|
|
123
|
-
* @memberof AnnotationLayer
|
|
124
122
|
*/
|
|
125
123
|
addLinkAnnotations(annotations: Array<Object>): Promise<void>;
|
|
126
124
|
/**
|
|
@@ -130,9 +128,12 @@ export class AnnotationLayer {
|
|
|
130
128
|
* @memberof AnnotationLayer
|
|
131
129
|
*/
|
|
132
130
|
update({ viewport }: AnnotationLayerParameters): void;
|
|
133
|
-
getEditableAnnotations(): any
|
|
131
|
+
getEditableAnnotations(): MapIterator<any>;
|
|
134
132
|
getEditableAnnotation(id: any): any;
|
|
135
133
|
addFakeAnnotation(editor: any): EditorAnnotationElement;
|
|
134
|
+
removeAnnotation(id: any): void;
|
|
135
|
+
updateFakeAnnotations(editors: any): void;
|
|
136
|
+
togglePointerEvents(enabled?: boolean): void;
|
|
136
137
|
#private;
|
|
137
138
|
}
|
|
138
139
|
export class FreeTextAnnotationElement extends AnnotationElement {
|
|
@@ -193,6 +194,8 @@ declare class AnnotationElement {
|
|
|
193
194
|
hasJSActions: any;
|
|
194
195
|
_fieldObjects: any;
|
|
195
196
|
parent: any;
|
|
197
|
+
hasOwnCommentButton: boolean;
|
|
198
|
+
contentElement: HTMLElement | undefined;
|
|
196
199
|
container: HTMLElement | undefined;
|
|
197
200
|
get _isEditable(): any;
|
|
198
201
|
get hasPopupData(): any;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Key/value storage for annotation data in forms.
|
|
3
3
|
*/
|
|
4
4
|
export class AnnotationStorage {
|
|
5
|
-
onSetModified:
|
|
6
|
-
onResetModified:
|
|
7
|
-
onAnnotationEditor:
|
|
5
|
+
onSetModified: null;
|
|
6
|
+
onResetModified: null;
|
|
7
|
+
onAnnotationEditor: null;
|
|
8
8
|
/**
|
|
9
9
|
* Get the value for a given key if it exists, or return the default value.
|
|
10
10
|
* @param {string} key
|
|
@@ -79,11 +79,11 @@ export class PrintAnnotationStorage extends AnnotationStorage {
|
|
|
79
79
|
* PLEASE NOTE: Only intended for usage within the API itself.
|
|
80
80
|
* @ignore
|
|
81
81
|
*/
|
|
82
|
-
get serializable(): {
|
|
83
|
-
map:
|
|
84
|
-
hash:
|
|
85
|
-
transfer:
|
|
86
|
-
}
|
|
82
|
+
get serializable(): Readonly<{
|
|
83
|
+
map: null;
|
|
84
|
+
hash: "";
|
|
85
|
+
transfer: undefined;
|
|
86
|
+
}>;
|
|
87
87
|
get modifiedIds(): any;
|
|
88
88
|
#private;
|
|
89
89
|
}
|
|
@@ -36,11 +36,6 @@ export type DocumentInitParameters = {
|
|
|
36
36
|
* - For decrypting password-protected PDFs.
|
|
37
37
|
*/
|
|
38
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
39
|
/**
|
|
45
40
|
* - Allows for using a custom range
|
|
46
41
|
* transport implementation.
|
|
@@ -77,12 +72,6 @@ export type DocumentInitParameters = {
|
|
|
77
72
|
* packed or not. The default value is `true`.
|
|
78
73
|
*/
|
|
79
74
|
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
75
|
/**
|
|
87
76
|
* - The URL where the predefined ICC profiles are
|
|
88
77
|
* located. Include the trailing slash.
|
|
@@ -101,28 +90,15 @@ export type DocumentInitParameters = {
|
|
|
101
90
|
* files are located. Include the trailing slash.
|
|
102
91
|
*/
|
|
103
92
|
standardFontDataUrl?: string | undefined;
|
|
104
|
-
/**
|
|
105
|
-
* - The factory that will be used
|
|
106
|
-
* when reading the standard font files.
|
|
107
|
-
* The default value is {DOMStandardFontDataFactory}.
|
|
108
|
-
*/
|
|
109
|
-
StandardFontDataFactory?: Object | undefined;
|
|
110
93
|
/**
|
|
111
94
|
* - The URL where the wasm files are located.
|
|
112
95
|
* Include the trailing slash.
|
|
113
96
|
*/
|
|
114
97
|
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;
|
|
121
98
|
/**
|
|
122
99
|
* - Enable using the Fetch API in the
|
|
123
|
-
* worker-thread when reading CMap
|
|
124
|
-
*
|
|
125
|
-
* options are ignored.
|
|
100
|
+
* worker-thread when reading built-in CMap files, standard font files,
|
|
101
|
+
* and wasm files. If `true`, the `BinaryDataFactory` option is ignored.
|
|
126
102
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
127
103
|
*/
|
|
128
104
|
useWorkerFetch?: boolean | undefined;
|
|
@@ -246,11 +222,24 @@ export type DocumentInitParameters = {
|
|
|
246
222
|
* The default value is {DOMFilterFactory}.
|
|
247
223
|
*/
|
|
248
224
|
FilterFactory?: Object | undefined;
|
|
225
|
+
/**
|
|
226
|
+
* - The factory that will be used when
|
|
227
|
+
* falling back to reading built-in CMap files, standard font files,
|
|
228
|
+
* and wasm files in the main-thread.
|
|
229
|
+
* The default value is {DOMBinaryDataFactory}.
|
|
230
|
+
*/
|
|
231
|
+
BinaryDataFactory?: Object | undefined;
|
|
249
232
|
/**
|
|
250
233
|
* - Enables hardware acceleration for
|
|
251
234
|
* rendering. The default value is `false`.
|
|
252
235
|
*/
|
|
253
236
|
enableHWA?: boolean | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* - The pages mapper that will be used to map
|
|
239
|
+
* page ids and page numbers. It's used when the page order is changed or some
|
|
240
|
+
* pages are removed, cloned, etc.
|
|
241
|
+
*/
|
|
242
|
+
pagesMapper?: Object | undefined;
|
|
254
243
|
};
|
|
255
244
|
export type OnProgressParameters = {
|
|
256
245
|
/**
|
|
@@ -261,6 +250,11 @@ export type OnProgressParameters = {
|
|
|
261
250
|
* - Total number of bytes in the PDF file.
|
|
262
251
|
*/
|
|
263
252
|
total: number;
|
|
253
|
+
/**
|
|
254
|
+
* - Currently loaded percentage, as an integer value
|
|
255
|
+
* in the [0, 100] range. If `total` is undefined, the percentage is `NaN`.
|
|
256
|
+
*/
|
|
257
|
+
percent: number;
|
|
264
258
|
};
|
|
265
259
|
/**
|
|
266
260
|
* Page getViewport parameters.
|
|
@@ -492,6 +486,10 @@ export type RenderParameters = {
|
|
|
492
486
|
* - Render the page in editing mode.
|
|
493
487
|
*/
|
|
494
488
|
isEditing?: boolean | undefined;
|
|
489
|
+
/**
|
|
490
|
+
* - Record the location of images in the PDF
|
|
491
|
+
*/
|
|
492
|
+
recordImages?: boolean | undefined;
|
|
495
493
|
/**
|
|
496
494
|
* - Record the dependencies and bounding
|
|
497
495
|
* boxes of all PDF operations that render onto the canvas.
|
|
@@ -624,8 +622,6 @@ export const build: string;
|
|
|
624
622
|
* cross-site Access-Control requests should be made using credentials such
|
|
625
623
|
* as cookies or authorization headers. The default is `false`.
|
|
626
624
|
* @property {string} [password] - For decrypting password-protected PDFs.
|
|
627
|
-
* @property {number} [length] - The PDF file length. It's used for progress
|
|
628
|
-
* reports and range requests operations.
|
|
629
625
|
* @property {PDFDataRangeTransport} [range] - Allows for using a custom range
|
|
630
626
|
* transport implementation.
|
|
631
627
|
* @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
|
|
@@ -641,9 +637,6 @@ export const build: string;
|
|
|
641
637
|
* located. Include the trailing slash.
|
|
642
638
|
* @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
|
|
643
639
|
* packed or not. The default value is `true`.
|
|
644
|
-
* @property {Object} [CMapReaderFactory] - The factory that will be used when
|
|
645
|
-
* reading built-in CMap files.
|
|
646
|
-
* The default value is {DOMCMapReaderFactory}.
|
|
647
640
|
* @property {string} [iccUrl] - The URL where the predefined ICC profiles are
|
|
648
641
|
* located. Include the trailing slash.
|
|
649
642
|
* @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
|
|
@@ -653,18 +646,11 @@ export const build: string;
|
|
|
653
646
|
* regardless of the environment (to prevent completely broken fonts).
|
|
654
647
|
* @property {string} [standardFontDataUrl] - The URL where the standard font
|
|
655
648
|
* files are located. Include the trailing slash.
|
|
656
|
-
* @property {Object} [StandardFontDataFactory] - The factory that will be used
|
|
657
|
-
* when reading the standard font files.
|
|
658
|
-
* The default value is {DOMStandardFontDataFactory}.
|
|
659
649
|
* @property {string} [wasmUrl] - The URL where the wasm files are located.
|
|
660
650
|
* Include the trailing slash.
|
|
661
|
-
* @property {Object} [WasmFactory] - The factory that will be used
|
|
662
|
-
* when reading the wasm files.
|
|
663
|
-
* The default value is {DOMWasmFactory}.
|
|
664
651
|
* @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the
|
|
665
|
-
* worker-thread when reading CMap
|
|
666
|
-
*
|
|
667
|
-
* options are ignored.
|
|
652
|
+
* worker-thread when reading built-in CMap files, standard font files,
|
|
653
|
+
* and wasm files. If `true`, the `BinaryDataFactory` option is ignored.
|
|
668
654
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
669
655
|
* @property {boolean} [useWasm] - Attempt to use WebAssembly in order to
|
|
670
656
|
* improve e.g. image decoding performance.
|
|
@@ -736,8 +722,15 @@ export const build: string;
|
|
|
736
722
|
* @property {Object} [FilterFactory] - The factory that will be used to
|
|
737
723
|
* create SVG filters when rendering some images on the main canvas.
|
|
738
724
|
* The default value is {DOMFilterFactory}.
|
|
725
|
+
* @property {Object} [BinaryDataFactory] - The factory that will be used when
|
|
726
|
+
* falling back to reading built-in CMap files, standard font files,
|
|
727
|
+
* and wasm files in the main-thread.
|
|
728
|
+
* The default value is {DOMBinaryDataFactory}.
|
|
739
729
|
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
740
730
|
* rendering. The default value is `false`.
|
|
731
|
+
* @property {Object} [pagesMapper] - The pages mapper that will be used to map
|
|
732
|
+
* page ids and page numbers. It's used when the page order is changed or some
|
|
733
|
+
* pages are removed, cloned, etc.
|
|
741
734
|
*/
|
|
742
735
|
/**
|
|
743
736
|
* This is the main entry point for loading a PDF and interacting with it.
|
|
@@ -775,10 +768,6 @@ export class PDFDataRangeTransport {
|
|
|
775
768
|
* @param {function} listener
|
|
776
769
|
*/
|
|
777
770
|
addRangeListener(listener: Function): void;
|
|
778
|
-
/**
|
|
779
|
-
* @param {function} listener
|
|
780
|
-
*/
|
|
781
|
-
addProgressListener(listener: Function): void;
|
|
782
771
|
/**
|
|
783
772
|
* @param {function} listener
|
|
784
773
|
*/
|
|
@@ -792,11 +781,6 @@ export class PDFDataRangeTransport {
|
|
|
792
781
|
* @param {Uint8Array|null} chunk
|
|
793
782
|
*/
|
|
794
783
|
onDataRange(begin: number, chunk: Uint8Array | null): void;
|
|
795
|
-
/**
|
|
796
|
-
* @param {number} loaded
|
|
797
|
-
* @param {number|undefined} total
|
|
798
|
-
*/
|
|
799
|
-
onDataProgress(loaded: number, total: number | undefined): void;
|
|
800
784
|
/**
|
|
801
785
|
* @param {Uint8Array|null} chunk
|
|
802
786
|
*/
|
|
@@ -815,6 +799,8 @@ export class PDFDataRangeTransport {
|
|
|
815
799
|
* @typedef {Object} OnProgressParameters
|
|
816
800
|
* @property {number} loaded - Currently loaded number of bytes.
|
|
817
801
|
* @property {number} total - Total number of bytes in the PDF file.
|
|
802
|
+
* @property {number} percent - Currently loaded percentage, as an integer value
|
|
803
|
+
* in the [0, 100] range. If `total` is undefined, the percentage is `NaN`.
|
|
818
804
|
*/
|
|
819
805
|
/**
|
|
820
806
|
* The loading task controls the operations required to load a PDF document
|
|
@@ -822,7 +808,7 @@ export class PDFDataRangeTransport {
|
|
|
822
808
|
* after which individual pages can be rendered.
|
|
823
809
|
*/
|
|
824
810
|
export class PDFDocumentLoadingTask {
|
|
825
|
-
static #docId: number;
|
|
811
|
+
static "__#private@#docId": number;
|
|
826
812
|
/**
|
|
827
813
|
* @private
|
|
828
814
|
*/
|
|
@@ -885,6 +871,10 @@ export class PDFDocumentProxy {
|
|
|
885
871
|
constructor(pdfInfo: any, transport: any);
|
|
886
872
|
_pdfInfo: any;
|
|
887
873
|
_transport: any;
|
|
874
|
+
/**
|
|
875
|
+
* @type {PagesMapper} The pages mapper instance.
|
|
876
|
+
*/
|
|
877
|
+
get pagesMapper(): PagesMapper;
|
|
888
878
|
/**
|
|
889
879
|
* @type {AnnotationStorage} Storage for annotation data in forms.
|
|
890
880
|
*/
|
|
@@ -1100,6 +1090,30 @@ export class PDFDocumentProxy {
|
|
|
1100
1090
|
* {Uint8Array} containing the full data of the saved document.
|
|
1101
1091
|
*/
|
|
1102
1092
|
saveDocument(): Promise<Uint8Array>;
|
|
1093
|
+
/**
|
|
1094
|
+
* @typedef {Object} PageInfo
|
|
1095
|
+
* @property {null|Uint8Array} document
|
|
1096
|
+
* @property {Array<Array<number>|number>} [includePages]
|
|
1097
|
+
* included ranges or indices.
|
|
1098
|
+
* @property {Array<Array<number>|number>} [excludePages]
|
|
1099
|
+
* excluded ranges or indices.
|
|
1100
|
+
*/
|
|
1101
|
+
/**
|
|
1102
|
+
* @param {Array<PageInfo>} pageInfos - The pages to extract.
|
|
1103
|
+
* @returns {Promise<Uint8Array>} A promise that is resolved with a
|
|
1104
|
+
* {Uint8Array} containing the full data of the saved document.
|
|
1105
|
+
*/
|
|
1106
|
+
extractPages(pageInfos: Array<{
|
|
1107
|
+
document: null | Uint8Array;
|
|
1108
|
+
/**
|
|
1109
|
+
* included ranges or indices.
|
|
1110
|
+
*/
|
|
1111
|
+
includePages?: (number | number[])[] | undefined;
|
|
1112
|
+
/**
|
|
1113
|
+
* excluded ranges or indices.
|
|
1114
|
+
*/
|
|
1115
|
+
excludePages?: (number | number[])[] | undefined;
|
|
1116
|
+
}>): Promise<Uint8Array>;
|
|
1103
1117
|
/**
|
|
1104
1118
|
* @returns {Promise<{ length: number }>} A promise that is resolved when the
|
|
1105
1119
|
* document's data is loaded. It is resolved with an {Object} that contains
|
|
@@ -1108,6 +1122,7 @@ export class PDFDocumentProxy {
|
|
|
1108
1122
|
getDownloadInfo(): Promise<{
|
|
1109
1123
|
length: number;
|
|
1110
1124
|
}>;
|
|
1125
|
+
getRawData(data: any): any;
|
|
1111
1126
|
/**
|
|
1112
1127
|
* Cleans up resources allocated by the document on both the main and worker
|
|
1113
1128
|
* threads.
|
|
@@ -1283,6 +1298,7 @@ export class PDFDocumentProxy {
|
|
|
1283
1298
|
* annotation ids with canvases used to render them.
|
|
1284
1299
|
* @property {PrintAnnotationStorage} [printAnnotationStorage]
|
|
1285
1300
|
* @property {boolean} [isEditing] - Render the page in editing mode.
|
|
1301
|
+
* @property {boolean} [recordImages] - Record the location of images in the PDF
|
|
1286
1302
|
* @property {boolean} [recordOperations] - Record the dependencies and bounding
|
|
1287
1303
|
* boxes of all PDF operations that render onto the canvas.
|
|
1288
1304
|
* @property {OperationsFilter} [operationsFilter] - If provided, only
|
|
@@ -1343,7 +1359,7 @@ export class PDFDocumentProxy {
|
|
|
1343
1359
|
* Proxy to a `PDFPage` in the worker thread.
|
|
1344
1360
|
*/
|
|
1345
1361
|
export class PDFPageProxy {
|
|
1346
|
-
constructor(pageIndex: any, pageInfo: any, transport: any, pdfBug?: boolean);
|
|
1362
|
+
constructor(pageIndex: any, pageInfo: any, transport: any, pagesMapper: any, pdfBug?: boolean);
|
|
1347
1363
|
_pageIndex: any;
|
|
1348
1364
|
_pageInfo: any;
|
|
1349
1365
|
_transport: any;
|
|
@@ -1355,6 +1371,12 @@ export class PDFPageProxy {
|
|
|
1355
1371
|
_intentStates: Map<any, any>;
|
|
1356
1372
|
destroyed: boolean;
|
|
1357
1373
|
recordedBBoxes: any;
|
|
1374
|
+
imageCoordinates: any;
|
|
1375
|
+
clone(id: any): PDFPageProxy;
|
|
1376
|
+
/**
|
|
1377
|
+
* @param {number} value - The page number to set. First page is 1.
|
|
1378
|
+
*/
|
|
1379
|
+
set pageNumber(value: number);
|
|
1358
1380
|
/**
|
|
1359
1381
|
* @type {number} Page number of the page. First page is 1.
|
|
1360
1382
|
*/
|
|
@@ -1415,7 +1437,7 @@ export class PDFPageProxy {
|
|
|
1415
1437
|
* @returns {RenderTask} An object that contains a promise that is
|
|
1416
1438
|
* resolved when the page finishes rendering.
|
|
1417
1439
|
*/
|
|
1418
|
-
render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordOperations, operationsFilter, }: RenderParameters): RenderTask;
|
|
1440
|
+
render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordImages, recordOperations, operationsFilter, }: RenderParameters): RenderTask;
|
|
1419
1441
|
/**
|
|
1420
1442
|
* @param {GetOperatorListParameters} params - Page getOperatorList
|
|
1421
1443
|
* parameters.
|
|
@@ -1498,9 +1520,9 @@ export class PDFPageProxy {
|
|
|
1498
1520
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1499
1521
|
*/
|
|
1500
1522
|
export class PDFWorker {
|
|
1501
|
-
static #fakeWorkerId: number;
|
|
1502
|
-
static #isWorkerDisabled: boolean;
|
|
1503
|
-
static #workerPorts: WeakMap<object, any>;
|
|
1523
|
+
static "__#private@#fakeWorkerId": number;
|
|
1524
|
+
static "__#private@#isWorkerDisabled": boolean;
|
|
1525
|
+
static "__#private@#workerPorts": WeakMap<object, any>;
|
|
1504
1526
|
/**
|
|
1505
1527
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1506
1528
|
* @returns {PDFWorker}
|
|
@@ -1511,7 +1533,7 @@ export class PDFWorker {
|
|
|
1511
1533
|
* @type {string}
|
|
1512
1534
|
*/
|
|
1513
1535
|
static get workerSrc(): string;
|
|
1514
|
-
static get #mainThreadWorkerMessageHandler(): any;
|
|
1536
|
+
static get "__#private@#mainThreadWorkerMessageHandler"(): any;
|
|
1515
1537
|
static get _setupFakeWorkerGlobal(): any;
|
|
1516
1538
|
constructor({ name, port, verbosity, }?: {
|
|
1517
1539
|
name?: null | undefined;
|
|
@@ -1547,6 +1569,7 @@ export class PDFWorker {
|
|
|
1547
1569
|
*/
|
|
1548
1570
|
export class RenderTask {
|
|
1549
1571
|
constructor(internalRenderTask: any);
|
|
1572
|
+
_internalRenderTask: null;
|
|
1550
1573
|
/**
|
|
1551
1574
|
* Callback for incremental rendering -- a function that will be called
|
|
1552
1575
|
* each time the rendering is paused. To continue rendering call the
|
|
@@ -1581,13 +1604,14 @@ export class RenderTask {
|
|
|
1581
1604
|
* @type {boolean}
|
|
1582
1605
|
*/
|
|
1583
1606
|
get separateAnnots(): boolean;
|
|
1584
|
-
|
|
1607
|
+
get imageCoordinates(): any;
|
|
1585
1608
|
}
|
|
1586
1609
|
/** @type {string} */
|
|
1587
1610
|
export const version: string;
|
|
1588
1611
|
import { PageViewport } from "./display_utils.js";
|
|
1589
1612
|
import { OptionalContentConfig } from "./optional_content_config.js";
|
|
1590
1613
|
import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
1614
|
+
import { PagesMapper } from "./pages_mapper.js";
|
|
1591
1615
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1592
1616
|
import { Metadata } from "./metadata.js";
|
|
1593
1617
|
import { StatTimer } from "./display_utils.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function getDataProp(val: any): Uint8Array<any>;
|
|
2
2
|
export function getFactoryUrlProp(val: any): string | null;
|
|
3
|
-
export function getUrlProp(val: any):
|
|
3
|
+
export function getUrlProp(val: any): URL | null;
|
|
4
4
|
export function isNameProxy(v: any): boolean;
|
|
5
5
|
export function isRefProxy(v: any): boolean;
|
|
6
6
|
export const isValidExplicitDest: (dest?: any) => boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class BaseBinaryDataFactory {
|
|
2
|
+
constructor({ cMapUrl, standardFontDataUrl, wasmUrl }: {
|
|
3
|
+
cMapUrl?: null | undefined;
|
|
4
|
+
standardFontDataUrl?: null | undefined;
|
|
5
|
+
wasmUrl?: null | undefined;
|
|
6
|
+
});
|
|
7
|
+
cMapUrl: any;
|
|
8
|
+
standardFontDataUrl: any;
|
|
9
|
+
wasmUrl: any;
|
|
10
|
+
fetch({ kind, filename }: {
|
|
11
|
+
kind: any;
|
|
12
|
+
filename: any;
|
|
13
|
+
}): Promise<Uint8Array<ArrayBufferLike>>;
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
* @returns {Promise<Uint8Array>}
|
|
17
|
+
*/
|
|
18
|
+
_fetch(url: any, kind: any): Promise<Uint8Array>;
|
|
19
|
+
#private;
|
|
20
|
+
}
|
|
21
|
+
export class DOMBinaryDataFactory extends BaseBinaryDataFactory {
|
|
22
|
+
/**
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
_fetch(url: any, kind: any): Promise<Uint8Array<any>>;
|
|
26
|
+
}
|
|
@@ -2,14 +2,12 @@ export class CanvasGraphics {
|
|
|
2
2
|
constructor(canvasCtx: any, commonObjs: any, objs: any, canvasFactory: any, filterFactory: any, { optionalContentConfig, markedContentStack }: {
|
|
3
3
|
optionalContentConfig: any;
|
|
4
4
|
markedContentStack?: null | undefined;
|
|
5
|
-
}, annotationCanvasMap: any, pageColors: any, dependencyTracker: any);
|
|
5
|
+
}, annotationCanvasMap: any, pageColors: any, dependencyTracker: any, imagesTracker: any);
|
|
6
6
|
ctx: any;
|
|
7
7
|
current: CanvasExtraState;
|
|
8
8
|
stateStack: any[];
|
|
9
9
|
pendingClip: {} | {} | null;
|
|
10
10
|
pendingEOFill: boolean;
|
|
11
|
-
res: any;
|
|
12
|
-
xobjs: any;
|
|
13
11
|
commonObjs: any;
|
|
14
12
|
objs: any;
|
|
15
13
|
canvasFactory: any;
|
|
@@ -21,11 +19,11 @@ export class CanvasGraphics {
|
|
|
21
19
|
smaskStack: any[];
|
|
22
20
|
smaskCounter: number;
|
|
23
21
|
tempSMask: any;
|
|
22
|
+
smaskGroupCanvases: any[];
|
|
24
23
|
suspendedCtx: any;
|
|
25
24
|
contentVisible: boolean;
|
|
26
25
|
markedContentStack: never[];
|
|
27
26
|
optionalContentConfig: any;
|
|
28
|
-
cachedCanvases: CachedCanvases;
|
|
29
27
|
cachedPatterns: Map<any, any>;
|
|
30
28
|
annotationCanvasMap: any;
|
|
31
29
|
viewportScale: number;
|
|
@@ -36,6 +34,7 @@ export class CanvasGraphics {
|
|
|
36
34
|
_cachedGetSinglePixelWidth: number | null;
|
|
37
35
|
_cachedBitmapsMap: Map<any, any>;
|
|
38
36
|
dependencyTracker: any;
|
|
37
|
+
imagesTracker: any;
|
|
39
38
|
getObject(opIdx: any, data: any, fallback?: null): any;
|
|
40
39
|
beginDrawing({ transform, viewport, transparency, background, }: {
|
|
41
40
|
transform: any;
|
|
@@ -43,19 +42,27 @@ export class CanvasGraphics {
|
|
|
43
42
|
transparency?: boolean | undefined;
|
|
44
43
|
background?: null | undefined;
|
|
45
44
|
}): void;
|
|
45
|
+
transparentCanvasEntry: any;
|
|
46
46
|
compositeCtx: any;
|
|
47
|
-
transparentCanvas: any;
|
|
48
47
|
executeOperatorList(operatorList: any, executionStartIdx: any, continueCallback: any, stepper: any, operationsFilter: any): any;
|
|
48
|
+
transparentCanvas: any;
|
|
49
49
|
endDrawing(): void;
|
|
50
50
|
_scaleImage(img: any, inverseTransform: any): {
|
|
51
51
|
img: any;
|
|
52
52
|
paintWidth: any;
|
|
53
53
|
paintHeight: any;
|
|
54
|
+
tmpCanvas: any;
|
|
54
55
|
};
|
|
55
56
|
_createMaskCanvas(opIdx: any, img: any): {
|
|
56
57
|
canvas: any;
|
|
57
58
|
offsetX: number;
|
|
58
59
|
offsetY: number;
|
|
60
|
+
canvasEntry?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
canvas: any;
|
|
63
|
+
canvasEntry: any;
|
|
64
|
+
offsetX: number;
|
|
65
|
+
offsetY: number;
|
|
59
66
|
};
|
|
60
67
|
setLineWidth(opIdx: any, width: any): void;
|
|
61
68
|
setLineCap(opIdx: any, style: any): void;
|
|
@@ -77,6 +84,7 @@ export class CanvasGraphics {
|
|
|
77
84
|
* the right order on the canvas' graphics state stack.
|
|
78
85
|
*/
|
|
79
86
|
beginSMaskMode(opIdx: any): void;
|
|
87
|
+
smaskScratchCanvas: any;
|
|
80
88
|
endSMaskMode(): void;
|
|
81
89
|
compose(dirtyBox: any): void;
|
|
82
90
|
composeSMask(ctx: any, smask: any, layerCtx: any, layerBox: any): void;
|
|
@@ -142,7 +150,10 @@ export class CanvasGraphics {
|
|
|
142
150
|
paintImageXObject(opIdx: any, objId: any): void;
|
|
143
151
|
paintImageXObjectRepeat(opIdx: any, objId: any, scaleX: any, scaleY: any, positions: any): void;
|
|
144
152
|
applyTransferMapsToCanvas(ctx: any): any;
|
|
145
|
-
applyTransferMapsToBitmap(imgData: any):
|
|
153
|
+
applyTransferMapsToBitmap(imgData: any): {
|
|
154
|
+
img: any;
|
|
155
|
+
canvasEntry: any;
|
|
156
|
+
};
|
|
146
157
|
paintInlineImageXObject(opIdx: any, imgData: any): void;
|
|
147
158
|
paintInlineImageXObjectGroup(opIdx: any, imgData: any, map: any): void;
|
|
148
159
|
paintSolidColorImageMask(opIdx: any): void;
|
|
@@ -161,7 +172,7 @@ export class CanvasGraphics {
|
|
|
161
172
|
#private;
|
|
162
173
|
}
|
|
163
174
|
declare class CanvasExtraState {
|
|
164
|
-
constructor(width: any, height: any
|
|
175
|
+
constructor(width: any, height: any);
|
|
165
176
|
alphaIsShape: boolean;
|
|
166
177
|
fontSize: number;
|
|
167
178
|
fontSizeScale: number;
|
|
@@ -187,8 +198,8 @@ declare class CanvasExtraState {
|
|
|
187
198
|
lineWidth: number;
|
|
188
199
|
activeSMask: null;
|
|
189
200
|
transferMaps: string;
|
|
190
|
-
clipBox: Float32Array<ArrayBuffer>;
|
|
191
201
|
minMax: Float32Array<ArrayBuffer>;
|
|
202
|
+
clipBox: Float32Array<ArrayBuffer>;
|
|
192
203
|
clone(): any;
|
|
193
204
|
getPathBoundingBox(pathType?: string, transform?: null): Float32Array<ArrayBuffer>;
|
|
194
205
|
updateClipFromPath(): void;
|
|
@@ -196,12 +207,4 @@ declare class CanvasExtraState {
|
|
|
196
207
|
startNewPathAndClipBox(box: any): void;
|
|
197
208
|
getClippedPathBoundingBox(pathType?: string, transform?: null): number[] | null;
|
|
198
209
|
}
|
|
199
|
-
declare class CachedCanvases {
|
|
200
|
-
constructor(canvasFactory: any);
|
|
201
|
-
canvasFactory: any;
|
|
202
|
-
cache: any;
|
|
203
|
-
getCanvas(id: any, width: any, height: any): any;
|
|
204
|
-
delete(id: any): void;
|
|
205
|
-
clear(): void;
|
|
206
|
-
}
|
|
207
210
|
export {};
|