pdfjs-serverless 1.0.1 → 1.2.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 +14 -44
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +49 -16
- package/dist/types/src/display/annotation_storage.d.ts +10 -8
- package/dist/types/src/display/api.d.ts +134 -126
- package/dist/types/src/display/api_utils.d.ts +13 -0
- package/dist/types/src/display/binary_data_factory.d.ts +26 -0
- package/dist/types/src/display/canvas.d.ts +97 -92
- package/dist/types/src/display/canvas_dependency_tracker.d.ts +216 -0
- package/dist/types/src/display/canvas_factory.d.ts +3 -1
- package/dist/types/src/display/display_utils.d.ts +27 -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 +16 -19
- package/dist/types/src/display/editor/color_picker.d.ts +20 -1
- package/dist/types/src/display/editor/comment.d.ts +59 -0
- package/dist/types/src/display/editor/draw.d.ts +4 -8
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +4 -3
- package/dist/types/src/display/editor/drawers/highlight.d.ts +2 -1
- package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/types/src/display/editor/editor.d.ts +119 -15
- package/dist/types/src/display/editor/freetext.d.ts +11 -7
- package/dist/types/src/display/editor/highlight.d.ts +8 -3
- package/dist/types/src/display/editor/ink.d.ts +5 -0
- package/dist/types/src/display/editor/signature.d.ts +2 -5
- package/dist/types/src/display/editor/stamp.d.ts +3 -1
- package/dist/types/src/display/editor/toolbar.d.ts +8 -3
- package/dist/types/src/display/editor/tools.d.ts +72 -6
- package/dist/types/src/display/fetch_stream.d.ts +3 -56
- package/dist/types/src/display/font_loader.d.ts +28 -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/display/obj_bin_transform_display.d.ts +67 -0
- package/dist/types/src/display/pages_mapper.d.ts +72 -0
- package/dist/types/src/display/pattern_helper.d.ts +9 -4
- package/dist/types/src/display/pdf_objects.d.ts +40 -0
- 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 +11 -2
- 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/scripting_utils.d.ts +2 -0
- package/dist/types/src/shared/util.d.ts +21 -8
- package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
- package/dist/types/web/annotation_layer_builder.d.ts +18 -23
- 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 +7 -6
- package/dist/types/web/comment_manager.d.ts +20 -0
- 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/event_utils.d.ts +1 -1
- 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 +10 -12
- package/dist/types/web/pdf_history.d.ts +3 -3
- package/dist/types/web/pdf_link_service.d.ts +10 -7
- package/dist/types/web/pdf_page_detail_view.d.ts +2 -7
- package/dist/types/web/pdf_page_view.d.ts +39 -17
- package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
- package/dist/types/web/pdf_thumbnail_view.d.ts +18 -50
- 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 +95 -29
- 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 +18 -15
- 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 -167
|
@@ -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.
|
|
@@ -48,7 +43,7 @@ export type DocumentInitParameters = {
|
|
|
48
43
|
range?: PDFDataRangeTransport | undefined;
|
|
49
44
|
/**
|
|
50
45
|
* - Specify maximum number of bytes fetched
|
|
51
|
-
* per range request. The default value is
|
|
46
|
+
* per range request. The default value is 65536 (= 2^16).
|
|
52
47
|
*/
|
|
53
48
|
rangeChunkSize?: number | undefined;
|
|
54
49
|
/**
|
|
@@ -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.
|
|
@@ -414,15 +408,24 @@ export type GetAnnotationsParameters = {
|
|
|
414
408
|
*/
|
|
415
409
|
export type RenderParameters = {
|
|
416
410
|
/**
|
|
417
|
-
* - A
|
|
418
|
-
*
|
|
411
|
+
* - A DOM Canvas object. The default
|
|
412
|
+
* value is the canvas associated with the `canvasContext` parameter if no
|
|
413
|
+
* value is provided explicitly.
|
|
419
414
|
*/
|
|
420
|
-
|
|
415
|
+
canvas: HTMLCanvasElement | null;
|
|
421
416
|
/**
|
|
422
417
|
* - Rendering viewport obtained by calling
|
|
423
418
|
* the `PDFPageProxy.getViewport` method.
|
|
424
419
|
*/
|
|
425
420
|
viewport: PageViewport;
|
|
421
|
+
/**
|
|
422
|
+
* - 2D context of a DOM
|
|
423
|
+
* Canvas object for backwards compatibility; it is recommended to use the
|
|
424
|
+
* `canvas` parameter instead.
|
|
425
|
+
* If the context must absolutely be used to render the page, the canvas must
|
|
426
|
+
* be null.
|
|
427
|
+
*/
|
|
428
|
+
canvasContext?: CanvasRenderingContext2D | undefined;
|
|
426
429
|
/**
|
|
427
430
|
* - Rendering intent, can be 'display', 'print',
|
|
428
431
|
* or 'any'. The default value is 'display'.
|
|
@@ -483,7 +486,22 @@ export type RenderParameters = {
|
|
|
483
486
|
* - Render the page in editing mode.
|
|
484
487
|
*/
|
|
485
488
|
isEditing?: boolean | undefined;
|
|
489
|
+
/**
|
|
490
|
+
* - Record the location of images in the PDF
|
|
491
|
+
*/
|
|
492
|
+
recordImages?: boolean | undefined;
|
|
493
|
+
/**
|
|
494
|
+
* - Record the dependencies and bounding
|
|
495
|
+
* boxes of all PDF operations that render onto the canvas.
|
|
496
|
+
*/
|
|
497
|
+
recordOperations?: boolean | undefined;
|
|
498
|
+
/**
|
|
499
|
+
* - If provided, only
|
|
500
|
+
* run for which this function returns `true`.
|
|
501
|
+
*/
|
|
502
|
+
operationsFilter?: OperationsFilter | undefined;
|
|
486
503
|
};
|
|
504
|
+
export type OperationsFilter = (index: number) => boolean;
|
|
487
505
|
/**
|
|
488
506
|
* Page getOperatorList parameters.
|
|
489
507
|
*/
|
|
@@ -604,12 +622,10 @@ export const build: string;
|
|
|
604
622
|
* cross-site Access-Control requests should be made using credentials such
|
|
605
623
|
* as cookies or authorization headers. The default is `false`.
|
|
606
624
|
* @property {string} [password] - For decrypting password-protected PDFs.
|
|
607
|
-
* @property {number} [length] - The PDF file length. It's used for progress
|
|
608
|
-
* reports and range requests operations.
|
|
609
625
|
* @property {PDFDataRangeTransport} [range] - Allows for using a custom range
|
|
610
626
|
* transport implementation.
|
|
611
627
|
* @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
|
|
612
|
-
* per range request. The default value is
|
|
628
|
+
* per range request. The default value is 65536 (= 2^16).
|
|
613
629
|
* @property {PDFWorker} [worker] - The worker that will be used for loading and
|
|
614
630
|
* parsing the PDF data.
|
|
615
631
|
* @property {number} [verbosity] - Controls the logging level; the constants
|
|
@@ -621,9 +637,6 @@ export const build: string;
|
|
|
621
637
|
* located. Include the trailing slash.
|
|
622
638
|
* @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
|
|
623
639
|
* packed or not. The default value is `true`.
|
|
624
|
-
* @property {Object} [CMapReaderFactory] - The factory that will be used when
|
|
625
|
-
* reading built-in CMap files.
|
|
626
|
-
* The default value is {DOMCMapReaderFactory}.
|
|
627
640
|
* @property {string} [iccUrl] - The URL where the predefined ICC profiles are
|
|
628
641
|
* located. Include the trailing slash.
|
|
629
642
|
* @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
|
|
@@ -633,18 +646,11 @@ export const build: string;
|
|
|
633
646
|
* regardless of the environment (to prevent completely broken fonts).
|
|
634
647
|
* @property {string} [standardFontDataUrl] - The URL where the standard font
|
|
635
648
|
* files are located. Include the trailing slash.
|
|
636
|
-
* @property {Object} [StandardFontDataFactory] - The factory that will be used
|
|
637
|
-
* when reading the standard font files.
|
|
638
|
-
* The default value is {DOMStandardFontDataFactory}.
|
|
639
649
|
* @property {string} [wasmUrl] - The URL where the wasm files are located.
|
|
640
650
|
* 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}.
|
|
644
651
|
* @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the
|
|
645
|
-
* worker-thread when reading CMap
|
|
646
|
-
*
|
|
647
|
-
* 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.
|
|
648
654
|
* The default value is `true` in web environments and `false` in Node.js.
|
|
649
655
|
* @property {boolean} [useWasm] - Attempt to use WebAssembly in order to
|
|
650
656
|
* improve e.g. image decoding performance.
|
|
@@ -716,8 +722,15 @@ export const build: string;
|
|
|
716
722
|
* @property {Object} [FilterFactory] - The factory that will be used to
|
|
717
723
|
* create SVG filters when rendering some images on the main canvas.
|
|
718
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}.
|
|
719
729
|
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
720
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.
|
|
721
734
|
*/
|
|
722
735
|
/**
|
|
723
736
|
* This is the main entry point for loading a PDF and interacting with it.
|
|
@@ -732,14 +745,6 @@ export const build: string;
|
|
|
732
745
|
* @returns {PDFDocumentLoadingTask}
|
|
733
746
|
*/
|
|
734
747
|
export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
|
|
735
|
-
export const isValidExplicitDest: (dest?: any) => boolean;
|
|
736
|
-
export class LoopbackPort {
|
|
737
|
-
postMessage(obj: any, transfer: any): void;
|
|
738
|
-
addEventListener(name: any, listener: any, options?: null): void;
|
|
739
|
-
removeEventListener(name: any, listener: any): void;
|
|
740
|
-
terminate(): void;
|
|
741
|
-
#private;
|
|
742
|
-
}
|
|
743
748
|
/**
|
|
744
749
|
* Abstract class to support range requests file loading.
|
|
745
750
|
*
|
|
@@ -759,19 +764,10 @@ export class PDFDataRangeTransport {
|
|
|
759
764
|
initialData: Uint8Array<ArrayBufferLike> | null;
|
|
760
765
|
progressiveDone: boolean;
|
|
761
766
|
contentDispositionFilename: string;
|
|
762
|
-
_rangeListeners: any[];
|
|
763
|
-
_progressListeners: any[];
|
|
764
|
-
_progressiveReadListeners: any[];
|
|
765
|
-
_progressiveDoneListeners: any[];
|
|
766
|
-
_readyCapability: any;
|
|
767
767
|
/**
|
|
768
768
|
* @param {function} listener
|
|
769
769
|
*/
|
|
770
770
|
addRangeListener(listener: Function): void;
|
|
771
|
-
/**
|
|
772
|
-
* @param {function} listener
|
|
773
|
-
*/
|
|
774
|
-
addProgressListener(listener: Function): void;
|
|
775
771
|
/**
|
|
776
772
|
* @param {function} listener
|
|
777
773
|
*/
|
|
@@ -785,11 +781,6 @@ export class PDFDataRangeTransport {
|
|
|
785
781
|
* @param {Uint8Array|null} chunk
|
|
786
782
|
*/
|
|
787
783
|
onDataRange(begin: number, chunk: Uint8Array | null): void;
|
|
788
|
-
/**
|
|
789
|
-
* @param {number} loaded
|
|
790
|
-
* @param {number|undefined} total
|
|
791
|
-
*/
|
|
792
|
-
onDataProgress(loaded: number, total: number | undefined): void;
|
|
793
784
|
/**
|
|
794
785
|
* @param {Uint8Array|null} chunk
|
|
795
786
|
*/
|
|
@@ -802,11 +793,14 @@ export class PDFDataRangeTransport {
|
|
|
802
793
|
*/
|
|
803
794
|
requestDataRange(begin: number, end: number): void;
|
|
804
795
|
abort(): void;
|
|
796
|
+
#private;
|
|
805
797
|
}
|
|
806
798
|
/**
|
|
807
799
|
* @typedef {Object} OnProgressParameters
|
|
808
800
|
* @property {number} loaded - Currently loaded number of bytes.
|
|
809
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`.
|
|
810
804
|
*/
|
|
811
805
|
/**
|
|
812
806
|
* The loading task controls the operations required to load a PDF document
|
|
@@ -814,7 +808,7 @@ export class PDFDataRangeTransport {
|
|
|
814
808
|
* after which individual pages can be rendered.
|
|
815
809
|
*/
|
|
816
810
|
export class PDFDocumentLoadingTask {
|
|
817
|
-
static "__#
|
|
811
|
+
static "__#private@#docId": number;
|
|
818
812
|
/**
|
|
819
813
|
* @private
|
|
820
814
|
*/
|
|
@@ -877,6 +871,10 @@ export class PDFDocumentProxy {
|
|
|
877
871
|
constructor(pdfInfo: any, transport: any);
|
|
878
872
|
_pdfInfo: any;
|
|
879
873
|
_transport: any;
|
|
874
|
+
/**
|
|
875
|
+
* @type {PagesMapper} The pages mapper instance.
|
|
876
|
+
*/
|
|
877
|
+
get pagesMapper(): PagesMapper;
|
|
880
878
|
/**
|
|
881
879
|
* @type {AnnotationStorage} Storage for annotation data in forms.
|
|
882
880
|
*/
|
|
@@ -972,6 +970,13 @@ export class PDFDocumentProxy {
|
|
|
972
970
|
* for mapping named attachments to their content.
|
|
973
971
|
*/
|
|
974
972
|
getAttachments(): Promise<any>;
|
|
973
|
+
/**
|
|
974
|
+
* @param {Set<number>} types - The annotation types to retrieve.
|
|
975
|
+
* @param {Set<number>} pageIndexesToSkip
|
|
976
|
+
* @returns {Promise<Array<Object>>} A promise that is resolved with a list of
|
|
977
|
+
* annotations data.
|
|
978
|
+
*/
|
|
979
|
+
getAnnotationsByType(types: Set<number>, pageIndexesToSkip: Set<number>): Promise<Array<Object>>;
|
|
975
980
|
/**
|
|
976
981
|
* @returns {Promise<Object | null>} A promise that is resolved with
|
|
977
982
|
* an {Object} with the JavaScript actions:
|
|
@@ -1085,6 +1090,30 @@ export class PDFDocumentProxy {
|
|
|
1085
1090
|
* {Uint8Array} containing the full data of the saved document.
|
|
1086
1091
|
*/
|
|
1087
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>;
|
|
1088
1117
|
/**
|
|
1089
1118
|
* @returns {Promise<{ length: number }>} A promise that is resolved when the
|
|
1090
1119
|
* document's data is loaded. It is resolved with an {Object} that contains
|
|
@@ -1093,6 +1122,7 @@ export class PDFDocumentProxy {
|
|
|
1093
1122
|
getDownloadInfo(): Promise<{
|
|
1094
1123
|
length: number;
|
|
1095
1124
|
}>;
|
|
1125
|
+
getRawData(data: any): any;
|
|
1096
1126
|
/**
|
|
1097
1127
|
* Cleans up resources allocated by the document on both the main and worker
|
|
1098
1128
|
* threads.
|
|
@@ -1221,10 +1251,16 @@ export class PDFDocumentProxy {
|
|
|
1221
1251
|
* Page render parameters.
|
|
1222
1252
|
*
|
|
1223
1253
|
* @typedef {Object} RenderParameters
|
|
1224
|
-
* @property {
|
|
1225
|
-
*
|
|
1254
|
+
* @property {HTMLCanvasElement|null} canvas - A DOM Canvas object. The default
|
|
1255
|
+
* value is the canvas associated with the `canvasContext` parameter if no
|
|
1256
|
+
* value is provided explicitly.
|
|
1226
1257
|
* @property {PageViewport} viewport - Rendering viewport obtained by calling
|
|
1227
1258
|
* the `PDFPageProxy.getViewport` method.
|
|
1259
|
+
* @property {CanvasRenderingContext2D} [canvasContext] - 2D context of a DOM
|
|
1260
|
+
* Canvas object for backwards compatibility; it is recommended to use the
|
|
1261
|
+
* `canvas` parameter instead.
|
|
1262
|
+
* If the context must absolutely be used to render the page, the canvas must
|
|
1263
|
+
* be null.
|
|
1228
1264
|
* @property {string} [intent] - Rendering intent, can be 'display', 'print',
|
|
1229
1265
|
* or 'any'. The default value is 'display'.
|
|
1230
1266
|
* @property {number} [annotationMode] Controls which annotations are rendered
|
|
@@ -1262,6 +1298,16 @@ export class PDFDocumentProxy {
|
|
|
1262
1298
|
* annotation ids with canvases used to render them.
|
|
1263
1299
|
* @property {PrintAnnotationStorage} [printAnnotationStorage]
|
|
1264
1300
|
* @property {boolean} [isEditing] - Render the page in editing mode.
|
|
1301
|
+
* @property {boolean} [recordImages] - Record the location of images in the PDF
|
|
1302
|
+
* @property {boolean} [recordOperations] - Record the dependencies and bounding
|
|
1303
|
+
* boxes of all PDF operations that render onto the canvas.
|
|
1304
|
+
* @property {OperationsFilter} [operationsFilter] - If provided, only
|
|
1305
|
+
* run for which this function returns `true`.
|
|
1306
|
+
*/
|
|
1307
|
+
/**
|
|
1308
|
+
* @callback OperationsFilter
|
|
1309
|
+
* @param {number} index - The index of the operation.
|
|
1310
|
+
* @returns {boolean} If false, the operation is ignored.
|
|
1265
1311
|
*/
|
|
1266
1312
|
/**
|
|
1267
1313
|
* Page getOperatorList parameters.
|
|
@@ -1313,7 +1359,7 @@ export class PDFDocumentProxy {
|
|
|
1313
1359
|
* Proxy to a `PDFPage` in the worker thread.
|
|
1314
1360
|
*/
|
|
1315
1361
|
export class PDFPageProxy {
|
|
1316
|
-
constructor(pageIndex: any, pageInfo: any, transport: any, pdfBug?: boolean);
|
|
1362
|
+
constructor(pageIndex: any, pageInfo: any, transport: any, pagesMapper: any, pdfBug?: boolean);
|
|
1317
1363
|
_pageIndex: any;
|
|
1318
1364
|
_pageInfo: any;
|
|
1319
1365
|
_transport: any;
|
|
@@ -1324,6 +1370,13 @@ export class PDFPageProxy {
|
|
|
1324
1370
|
objs: PDFObjects;
|
|
1325
1371
|
_intentStates: Map<any, any>;
|
|
1326
1372
|
destroyed: boolean;
|
|
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);
|
|
1327
1380
|
/**
|
|
1328
1381
|
* @type {number} Page number of the page. First page is 1.
|
|
1329
1382
|
*/
|
|
@@ -1384,7 +1437,7 @@ export class PDFPageProxy {
|
|
|
1384
1437
|
* @returns {RenderTask} An object that contains a promise that is
|
|
1385
1438
|
* resolved when the page finishes rendering.
|
|
1386
1439
|
*/
|
|
1387
|
-
render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
|
|
1440
|
+
render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordImages, recordOperations, operationsFilter, }: RenderParameters): RenderTask;
|
|
1388
1441
|
/**
|
|
1389
1442
|
* @param {GetOperatorListParameters} params - Page getOperatorList
|
|
1390
1443
|
* parameters.
|
|
@@ -1467,20 +1520,20 @@ export class PDFPageProxy {
|
|
|
1467
1520
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1468
1521
|
*/
|
|
1469
1522
|
export class PDFWorker {
|
|
1470
|
-
static "__#
|
|
1471
|
-
static "__#
|
|
1472
|
-
static "__#
|
|
1523
|
+
static "__#private@#fakeWorkerId": number;
|
|
1524
|
+
static "__#private@#isWorkerDisabled": boolean;
|
|
1525
|
+
static "__#private@#workerPorts": WeakMap<object, any>;
|
|
1473
1526
|
/**
|
|
1474
1527
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1475
1528
|
* @returns {PDFWorker}
|
|
1476
1529
|
*/
|
|
1477
|
-
static
|
|
1530
|
+
static create(params: PDFWorkerParameters): PDFWorker;
|
|
1478
1531
|
/**
|
|
1479
1532
|
* The current `workerSrc`, when it exists.
|
|
1480
1533
|
* @type {string}
|
|
1481
1534
|
*/
|
|
1482
1535
|
static get workerSrc(): string;
|
|
1483
|
-
static get "__#
|
|
1536
|
+
static get "__#private@#mainThreadWorkerMessageHandler"(): any;
|
|
1484
1537
|
static get _setupFakeWorkerGlobal(): any;
|
|
1485
1538
|
constructor({ name, port, verbosity, }?: {
|
|
1486
1539
|
name?: null | undefined;
|
|
@@ -1490,10 +1543,6 @@ export class PDFWorker {
|
|
|
1490
1543
|
name: any;
|
|
1491
1544
|
destroyed: boolean;
|
|
1492
1545
|
verbosity: number;
|
|
1493
|
-
_readyCapability: any;
|
|
1494
|
-
_port: any;
|
|
1495
|
-
_webWorker: Worker | null;
|
|
1496
|
-
_messageHandler: MessageHandler | null;
|
|
1497
1546
|
/**
|
|
1498
1547
|
* Promise for worker initialization completion.
|
|
1499
1548
|
* @type {Promise<void>}
|
|
@@ -1509,9 +1558,6 @@ export class PDFWorker {
|
|
|
1509
1558
|
* @type {MessageHandler}
|
|
1510
1559
|
*/
|
|
1511
1560
|
get messageHandler(): MessageHandler;
|
|
1512
|
-
_initializeFromPort(port: any): void;
|
|
1513
|
-
_initialize(): void;
|
|
1514
|
-
_setupFakeWorker(): void;
|
|
1515
1561
|
/**
|
|
1516
1562
|
* Destroys the worker instance.
|
|
1517
1563
|
*/
|
|
@@ -1523,6 +1569,7 @@ export class PDFWorker {
|
|
|
1523
1569
|
*/
|
|
1524
1570
|
export class RenderTask {
|
|
1525
1571
|
constructor(internalRenderTask: any);
|
|
1572
|
+
_internalRenderTask: null;
|
|
1526
1573
|
/**
|
|
1527
1574
|
* Callback for incremental rendering -- a function that will be called
|
|
1528
1575
|
* each time the rendering is paused. To continue rendering call the
|
|
@@ -1557,55 +1604,16 @@ export class RenderTask {
|
|
|
1557
1604
|
* @type {boolean}
|
|
1558
1605
|
*/
|
|
1559
1606
|
get separateAnnots(): boolean;
|
|
1560
|
-
|
|
1607
|
+
get imageCoordinates(): any;
|
|
1561
1608
|
}
|
|
1562
1609
|
/** @type {string} */
|
|
1563
1610
|
export const version: string;
|
|
1564
1611
|
import { PageViewport } from "./display_utils.js";
|
|
1565
1612
|
import { OptionalContentConfig } from "./optional_content_config.js";
|
|
1566
1613
|
import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
1614
|
+
import { PagesMapper } from "./pages_mapper.js";
|
|
1567
1615
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1568
1616
|
import { Metadata } from "./metadata.js";
|
|
1569
1617
|
import { StatTimer } from "./display_utils.js";
|
|
1570
|
-
|
|
1571
|
-
* A PDF document and page is built of many objects. E.g. there are objects for
|
|
1572
|
-
* fonts, images, rendering code, etc. These objects may get processed inside of
|
|
1573
|
-
* a worker. This class implements some basic methods to manage these objects.
|
|
1574
|
-
*/
|
|
1575
|
-
declare class PDFObjects {
|
|
1576
|
-
/**
|
|
1577
|
-
* If called *without* callback, this returns the data of `objId` but the
|
|
1578
|
-
* object needs to be resolved. If it isn't, this method throws.
|
|
1579
|
-
*
|
|
1580
|
-
* If called *with* a callback, the callback is called with the data of the
|
|
1581
|
-
* object once the object is resolved. That means, if you call this method
|
|
1582
|
-
* and the object is already resolved, the callback gets called right away.
|
|
1583
|
-
*
|
|
1584
|
-
* @param {string} objId
|
|
1585
|
-
* @param {function} [callback]
|
|
1586
|
-
* @returns {any}
|
|
1587
|
-
*/
|
|
1588
|
-
get(objId: string, callback?: Function): any;
|
|
1589
|
-
/**
|
|
1590
|
-
* @param {string} objId
|
|
1591
|
-
* @returns {boolean}
|
|
1592
|
-
*/
|
|
1593
|
-
has(objId: string): boolean;
|
|
1594
|
-
/**
|
|
1595
|
-
* @param {string} objId
|
|
1596
|
-
* @returns {boolean}
|
|
1597
|
-
*/
|
|
1598
|
-
delete(objId: string): boolean;
|
|
1599
|
-
/**
|
|
1600
|
-
* Resolves the object `objId` with optional `data`.
|
|
1601
|
-
*
|
|
1602
|
-
* @param {string} objId
|
|
1603
|
-
* @param {any} [data]
|
|
1604
|
-
*/
|
|
1605
|
-
resolve(objId: string, data?: any): void;
|
|
1606
|
-
clear(): void;
|
|
1607
|
-
[Symbol.iterator](): Generator<any[], void, unknown>;
|
|
1608
|
-
#private;
|
|
1609
|
-
}
|
|
1618
|
+
import { PDFObjects } from "./pdf_objects.js";
|
|
1610
1619
|
import { MessageHandler } from "../shared/message_handler.js";
|
|
1611
|
-
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getDataProp(val: any): Uint8Array<any>;
|
|
2
|
+
export function getFactoryUrlProp(val: any): string | null;
|
|
3
|
+
export function getUrlProp(val: any): URL | null;
|
|
4
|
+
export function isNameProxy(v: any): boolean;
|
|
5
|
+
export function isRefProxy(v: any): boolean;
|
|
6
|
+
export const isValidExplicitDest: (dest?: any) => boolean;
|
|
7
|
+
export class LoopbackPort {
|
|
8
|
+
postMessage(obj: any, transfer: any): void;
|
|
9
|
+
addEventListener(name: any, listener: any, options?: null): void;
|
|
10
|
+
removeEventListener(name: any, listener: any): void;
|
|
11
|
+
terminate(): void;
|
|
12
|
+
#private;
|
|
13
|
+
}
|
|
@@ -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
|
+
}
|