unpdf 0.10.1 → 0.12.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 +12 -8
- package/dist/index.cjs +15 -15
- package/dist/index.d.cts +32 -13
- package/dist/index.d.mts +32 -13
- package/dist/index.d.ts +32 -13
- package/dist/index.mjs +15 -15
- package/dist/pdfjs.d.mts +1 -0
- package/dist/pdfjs.d.ts +1 -0
- package/dist/pdfjs.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +12 -5
- package/dist/types/src/display/annotation_storage.d.ts +10 -0
- package/dist/types/src/display/api.d.ts +95 -45
- package/dist/types/src/display/base_factory.d.ts +7 -1
- package/dist/types/src/display/canvas.d.ts +4 -0
- package/dist/types/src/display/display_utils.d.ts +6 -4
- package/dist/types/src/display/draw_layer.d.ts +12 -14
- package/dist/types/src/display/editor/alt_text.d.ts +33 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +26 -2
- package/dist/types/src/display/editor/color_picker.d.ts +19 -0
- package/dist/types/src/display/editor/editor.d.ts +85 -16
- package/dist/types/src/display/editor/freetext.d.ts +6 -1
- package/dist/types/src/display/editor/highlight.d.ts +88 -0
- package/dist/types/src/display/editor/ink.d.ts +5 -4
- package/dist/types/src/display/editor/outliner.d.ts +53 -9
- package/dist/types/src/display/editor/stamp.d.ts +22 -1
- package/dist/types/src/display/editor/toolbar.d.ts +10 -1
- package/dist/types/src/display/editor/tools.d.ts +56 -6
- package/dist/types/src/display/fetch_stream.d.ts +3 -4
- package/dist/types/src/display/font_loader.d.ts +1 -5
- package/dist/types/src/display/network.d.ts +2 -3
- package/dist/types/src/display/node_stream.d.ts +5 -6
- package/dist/types/src/display/node_utils.d.ts +6 -5
- package/dist/types/src/display/optional_content_config.d.ts +6 -1
- package/dist/types/src/display/text_layer.d.ts +37 -106
- package/dist/types/src/display/transport_stream.d.ts +3 -7
- package/dist/types/src/display/worker_options.d.ts +20 -22
- package/dist/types/src/pdf.d.ts +3 -6
- package/dist/types/src/shared/util.d.ts +24 -22
- package/dist/types/web/annotation_editor_layer_builder.d.ts +10 -13
- package/dist/types/web/annotation_layer_builder.d.ts +8 -4
- package/dist/types/web/app_options.d.ts +5 -4
- package/dist/types/web/download_manager.d.ts +1 -2
- package/dist/types/web/draw_layer_builder.d.ts +23 -0
- package/dist/types/web/event_utils.d.ts +8 -6
- package/dist/types/web/genericl10n.d.ts +5 -3
- package/dist/types/web/interfaces.d.ts +10 -14
- package/dist/types/web/l10n.d.ts +7 -2
- package/dist/types/web/pdf_find_controller.d.ts +25 -2
- package/dist/types/web/pdf_history.d.ts +1 -53
- package/dist/types/web/pdf_link_service.d.ts +4 -107
- package/dist/types/web/pdf_page_view.d.ts +16 -21
- package/dist/types/web/pdf_scripting_manager.d.ts +6 -10
- package/dist/types/web/pdf_thumbnail_view.d.ts +11 -15
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -17
- package/dist/types/web/pdf_viewer.component.d.ts +1 -2
- package/dist/types/web/pdf_viewer.d.ts +67 -35
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_highlighter.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +17 -29
- package/dist/types/web/ui_utils.d.ts +7 -2
- package/package.json +24 -23
- package/dist/types/web/l10n_utils.d.ts +0 -9
|
@@ -3,6 +3,7 @@ export type PageViewport = import("./display_utils").PageViewport;
|
|
|
3
3
|
export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
|
|
4
4
|
export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
|
|
5
5
|
export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
|
|
6
|
+
export type AnnotationEditorUIManager = any;
|
|
6
7
|
export type AnnotationElementParameters = {
|
|
7
8
|
data: Object;
|
|
8
9
|
layer: HTMLDivElement;
|
|
@@ -26,7 +27,7 @@ export type AnnotationLayerParameters = {
|
|
|
26
27
|
annotations: any[];
|
|
27
28
|
page: PDFPageProxy;
|
|
28
29
|
linkService: IPDFLinkService;
|
|
29
|
-
downloadManager
|
|
30
|
+
downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
|
|
30
31
|
annotationStorage?: AnnotationStorage | undefined;
|
|
31
32
|
/**
|
|
32
33
|
* - Path for image resources, mainly
|
|
@@ -48,6 +49,7 @@ export type AnnotationLayerParameters = {
|
|
|
48
49
|
} | null | undefined;
|
|
49
50
|
annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
|
|
50
51
|
accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
|
|
52
|
+
annotationEditorUIManager?: AnnotationEditorUIManager;
|
|
51
53
|
};
|
|
52
54
|
/**
|
|
53
55
|
* @typedef {Object} AnnotationLayerParameters
|
|
@@ -56,7 +58,7 @@ export type AnnotationLayerParameters = {
|
|
|
56
58
|
* @property {Array} annotations
|
|
57
59
|
* @property {PDFPageProxy} page
|
|
58
60
|
* @property {IPDFLinkService} linkService
|
|
59
|
-
* @property {IDownloadManager} downloadManager
|
|
61
|
+
* @property {IDownloadManager} [downloadManager]
|
|
60
62
|
* @property {AnnotationStorage} [annotationStorage]
|
|
61
63
|
* @property {string} [imageResourcesPath] - Path for image resources, mainly
|
|
62
64
|
* for annotation icons. Include trailing slash.
|
|
@@ -67,15 +69,17 @@ export type AnnotationLayerParameters = {
|
|
|
67
69
|
* @property {Object<string, Array<Object>> | null} [fieldObjects]
|
|
68
70
|
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
|
|
69
71
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
72
|
+
* @property {AnnotationEditorUIManager} [annotationEditorUIManager]
|
|
70
73
|
*/
|
|
71
74
|
/**
|
|
72
75
|
* Manage the layer containing all the annotations.
|
|
73
76
|
*/
|
|
74
77
|
export class AnnotationLayer {
|
|
75
|
-
constructor({ div, accessibilityManager, annotationCanvasMap, page, viewport, }: {
|
|
78
|
+
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, }: {
|
|
76
79
|
div: any;
|
|
77
80
|
accessibilityManager: any;
|
|
78
81
|
annotationCanvasMap: any;
|
|
82
|
+
annotationEditorUIManager: any;
|
|
79
83
|
page: any;
|
|
80
84
|
viewport: any;
|
|
81
85
|
});
|
|
@@ -83,7 +87,9 @@ export class AnnotationLayer {
|
|
|
83
87
|
page: any;
|
|
84
88
|
viewport: any;
|
|
85
89
|
zIndex: number;
|
|
90
|
+
_annotationEditorUIManager: any;
|
|
86
91
|
popupShow: any[] | undefined;
|
|
92
|
+
hasEditableAnnotations(): boolean;
|
|
87
93
|
/**
|
|
88
94
|
* Render a new annotation layer with all annotation elements.
|
|
89
95
|
*
|
|
@@ -108,7 +114,6 @@ export class FreeTextAnnotationElement extends AnnotationElement {
|
|
|
108
114
|
textPosition: any;
|
|
109
115
|
annotationEditorType: number;
|
|
110
116
|
render(): HTMLElement | undefined;
|
|
111
|
-
get _isEditable(): any;
|
|
112
117
|
}
|
|
113
118
|
export class InkAnnotationElement extends AnnotationElement {
|
|
114
119
|
constructor(parameters: any);
|
|
@@ -149,7 +154,10 @@ declare class AnnotationElement {
|
|
|
149
154
|
_fieldObjects: any;
|
|
150
155
|
parent: any;
|
|
151
156
|
container: HTMLElement | undefined;
|
|
157
|
+
get _isEditable(): any;
|
|
152
158
|
get hasPopupData(): boolean;
|
|
159
|
+
updateEdited(params: any): void;
|
|
160
|
+
resetEdited(): void;
|
|
153
161
|
/**
|
|
154
162
|
* Create an empty container for the annotation's HTML element.
|
|
155
163
|
*
|
|
@@ -203,7 +211,6 @@ declare class AnnotationElement {
|
|
|
203
211
|
*/
|
|
204
212
|
public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
|
|
205
213
|
addHighlightArea(): void;
|
|
206
|
-
get _isEditable(): boolean;
|
|
207
214
|
_editOnDoubleClick(): void;
|
|
208
215
|
#private;
|
|
209
216
|
}
|
|
@@ -62,6 +62,15 @@ export class AnnotationStorage {
|
|
|
62
62
|
hash: string;
|
|
63
63
|
transfer: any[];
|
|
64
64
|
};
|
|
65
|
+
get editorStats(): any;
|
|
66
|
+
resetModifiedIds(): void;
|
|
67
|
+
/**
|
|
68
|
+
* @returns {{ids: Set<string>, hash: string}}
|
|
69
|
+
*/
|
|
70
|
+
get modifiedIds(): {
|
|
71
|
+
ids: Set<string>;
|
|
72
|
+
hash: string;
|
|
73
|
+
};
|
|
65
74
|
#private;
|
|
66
75
|
}
|
|
67
76
|
/**
|
|
@@ -80,6 +89,7 @@ export class PrintAnnotationStorage extends AnnotationStorage {
|
|
|
80
89
|
hash: any;
|
|
81
90
|
transfer: any;
|
|
82
91
|
};
|
|
92
|
+
get modifiedIds(): any;
|
|
83
93
|
#private;
|
|
84
94
|
}
|
|
85
95
|
export const SerializableEmpty: Readonly<{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
2
|
-
export type BinaryData = TypedArray | ArrayBuffer | Array<number> | string;
|
|
3
2
|
export type RefProxy = {
|
|
4
3
|
num: number;
|
|
5
4
|
gen: number;
|
|
@@ -13,7 +12,8 @@ export type DocumentInitParameters = {
|
|
|
13
12
|
*/
|
|
14
13
|
url?: string | URL | undefined;
|
|
15
14
|
/**
|
|
16
|
-
* -
|
|
15
|
+
* -
|
|
16
|
+
* Binary PDF data.
|
|
17
17
|
* Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
|
|
18
18
|
* BASE64-encoded, use `atob()` to convert it to a binary string first.
|
|
19
19
|
*
|
|
@@ -21,7 +21,7 @@ export type DocumentInitParameters = {
|
|
|
21
21
|
* worker-thread. This will help reduce main-thread memory usage, however
|
|
22
22
|
* it will take ownership of the TypedArrays.
|
|
23
23
|
*/
|
|
24
|
-
data?:
|
|
24
|
+
data?: string | number[] | ArrayBuffer | TypedArray | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* - Basic authentication headers.
|
|
27
27
|
*/
|
|
@@ -48,7 +48,7 @@ export type DocumentInitParameters = {
|
|
|
48
48
|
range?: PDFDataRangeTransport | undefined;
|
|
49
49
|
/**
|
|
50
50
|
* - Specify maximum number of bytes fetched
|
|
51
|
-
* per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE
|
|
51
|
+
* per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
|
|
52
52
|
*/
|
|
53
53
|
rangeChunkSize?: number | undefined;
|
|
54
54
|
/**
|
|
@@ -58,7 +58,7 @@ export type DocumentInitParameters = {
|
|
|
58
58
|
worker?: PDFWorker | undefined;
|
|
59
59
|
/**
|
|
60
60
|
* - Controls the logging level; the constants
|
|
61
|
-
* from {@link VerbosityLevel
|
|
61
|
+
* from {@link VerbosityLevel} should be used.
|
|
62
62
|
*/
|
|
63
63
|
verbosity?: number | undefined;
|
|
64
64
|
/**
|
|
@@ -126,8 +126,8 @@ export type DocumentInitParameters = {
|
|
|
126
126
|
maxImageSize?: number | undefined;
|
|
127
127
|
/**
|
|
128
128
|
* - Determines if we can evaluate strings
|
|
129
|
-
* as JavaScript. Primarily used to improve performance of
|
|
130
|
-
*
|
|
129
|
+
* as JavaScript. Primarily used to improve performance of PDF functions.
|
|
130
|
+
* The default value is `true`.
|
|
131
131
|
*/
|
|
132
132
|
isEvalSupported?: boolean | undefined;
|
|
133
133
|
/**
|
|
@@ -207,6 +207,11 @@ export type DocumentInitParameters = {
|
|
|
207
207
|
* to create SVG filters when rendering some images on the main canvas.
|
|
208
208
|
*/
|
|
209
209
|
filterFactory?: Object | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* - Enables hardware acceleration for
|
|
212
|
+
* rendering. The default value is `false`.
|
|
213
|
+
*/
|
|
214
|
+
enableHWA?: boolean | undefined;
|
|
210
215
|
};
|
|
211
216
|
export type OnProgressParameters = {
|
|
212
217
|
/**
|
|
@@ -268,17 +273,21 @@ export type getTextContentParameters = {
|
|
|
268
273
|
export type TextContent = {
|
|
269
274
|
/**
|
|
270
275
|
* - Array of
|
|
271
|
-
* {@link TextItem
|
|
276
|
+
* {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent
|
|
272
277
|
* items are included when includeMarkedContent is true.
|
|
273
278
|
*/
|
|
274
279
|
items: Array<TextItem | TextMarkedContent>;
|
|
275
280
|
/**
|
|
276
|
-
* - {@link TextStyle
|
|
281
|
+
* - {@link TextStyle} objects,
|
|
277
282
|
* indexed by font name.
|
|
278
283
|
*/
|
|
279
284
|
styles: {
|
|
280
285
|
[x: string]: TextStyle;
|
|
281
286
|
};
|
|
287
|
+
/**
|
|
288
|
+
* - The document /Lang attribute.
|
|
289
|
+
*/
|
|
290
|
+
lang: string | null;
|
|
282
291
|
};
|
|
283
292
|
/**
|
|
284
293
|
* Page text content part.
|
|
@@ -383,7 +392,7 @@ export type RenderParameters = {
|
|
|
383
392
|
/**
|
|
384
393
|
* Controls which annotations are rendered
|
|
385
394
|
* onto the canvas, for annotations with appearance-data; the values from
|
|
386
|
-
* {@link AnnotationMode
|
|
395
|
+
* {@link AnnotationMode} should be used. The following values are supported:
|
|
387
396
|
* - `AnnotationMode.DISABLE`, which disables all annotations.
|
|
388
397
|
* - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
|
|
389
398
|
* it also depends on the `intent`-option, see above).
|
|
@@ -391,7 +400,7 @@ export type RenderParameters = {
|
|
|
391
400
|
* interactive form elements (those will be rendered in the display layer).
|
|
392
401
|
* - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
|
|
393
402
|
* (as above) but where interactive form elements are updated with data
|
|
394
|
-
* from the {@link AnnotationStorage
|
|
403
|
+
* from the {@link AnnotationStorage}-instance; useful e.g. for printing.
|
|
395
404
|
* The default value is `AnnotationMode.ENABLE`.
|
|
396
405
|
*/
|
|
397
406
|
annotationMode?: number | undefined;
|
|
@@ -420,7 +429,7 @@ export type RenderParameters = {
|
|
|
420
429
|
pageColors?: Object | undefined;
|
|
421
430
|
/**
|
|
422
431
|
* -
|
|
423
|
-
* A promise that should resolve with an {@link OptionalContentConfig
|
|
432
|
+
* A promise that should resolve with an {@link OptionalContentConfig}created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`,
|
|
424
433
|
* the configuration will be fetched automatically with the default visibility
|
|
425
434
|
* states set.
|
|
426
435
|
*/
|
|
@@ -431,6 +440,10 @@ export type RenderParameters = {
|
|
|
431
440
|
*/
|
|
432
441
|
annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
|
|
433
442
|
printAnnotationStorage?: PrintAnnotationStorage | undefined;
|
|
443
|
+
/**
|
|
444
|
+
* - Render the page in editing mode.
|
|
445
|
+
*/
|
|
446
|
+
isEditing?: boolean | undefined;
|
|
434
447
|
};
|
|
435
448
|
/**
|
|
436
449
|
* Page getOperatorList parameters.
|
|
@@ -444,7 +457,7 @@ export type GetOperatorListParameters = {
|
|
|
444
457
|
/**
|
|
445
458
|
* Controls which annotations are included
|
|
446
459
|
* in the operatorList, for annotations with appearance-data; the values from
|
|
447
|
-
* {@link AnnotationMode
|
|
460
|
+
* {@link AnnotationMode} should be used. The following values are supported:
|
|
448
461
|
* - `AnnotationMode.DISABLE`, which disables all annotations.
|
|
449
462
|
* - `AnnotationMode.ENABLE`, which includes all possible annotations (thus
|
|
450
463
|
* it also depends on the `intent`-option, see above).
|
|
@@ -452,11 +465,15 @@ export type GetOperatorListParameters = {
|
|
|
452
465
|
* interactive form elements (those will be rendered in the display layer).
|
|
453
466
|
* - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations
|
|
454
467
|
* (as above) but where interactive form elements are updated with data
|
|
455
|
-
* from the {@link AnnotationStorage
|
|
468
|
+
* from the {@link AnnotationStorage}-instance; useful e.g. for printing.
|
|
456
469
|
* The default value is `AnnotationMode.ENABLE`.
|
|
457
470
|
*/
|
|
458
471
|
annotationMode?: number | undefined;
|
|
459
472
|
printAnnotationStorage?: PrintAnnotationStorage | undefined;
|
|
473
|
+
/**
|
|
474
|
+
* - Render the page in editing mode.
|
|
475
|
+
*/
|
|
476
|
+
isEditing?: boolean | undefined;
|
|
460
477
|
};
|
|
461
478
|
/**
|
|
462
479
|
* Structure tree node. The root node will have a role "Root".
|
|
@@ -464,7 +481,7 @@ export type GetOperatorListParameters = {
|
|
|
464
481
|
export type StructTreeNode = {
|
|
465
482
|
/**
|
|
466
483
|
* - Array of
|
|
467
|
-
* {@link StructTreeNode
|
|
484
|
+
* {@link StructTreeNode} and {@link StructTreeContent} objects.
|
|
468
485
|
*/
|
|
469
486
|
children: Array<StructTreeNode | StructTreeContent>;
|
|
470
487
|
/**
|
|
@@ -512,13 +529,13 @@ export type PDFWorkerParameters = {
|
|
|
512
529
|
port?: Worker | undefined;
|
|
513
530
|
/**
|
|
514
531
|
* - Controls the logging level;
|
|
515
|
-
* the constants from {@link VerbosityLevel
|
|
532
|
+
* the constants from {@link VerbosityLevel} should be used.
|
|
516
533
|
*/
|
|
517
534
|
verbosity?: number | undefined;
|
|
518
535
|
};
|
|
519
536
|
/** @type {string} */
|
|
520
537
|
export const build: string;
|
|
521
|
-
export const DefaultCanvasFactory: typeof
|
|
538
|
+
export const DefaultCanvasFactory: typeof NodeCanvasFactory;
|
|
522
539
|
export const DefaultCMapReaderFactory: typeof NodeCMapReaderFactory;
|
|
523
540
|
export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
|
|
524
541
|
export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
@@ -529,9 +546,6 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
529
546
|
* Float64Array
|
|
530
547
|
* } TypedArray
|
|
531
548
|
*/
|
|
532
|
-
/**
|
|
533
|
-
* @typedef { TypedArray | ArrayBuffer | Array<number> | string } BinaryData
|
|
534
|
-
*/
|
|
535
549
|
/**
|
|
536
550
|
* @typedef {Object} RefProxy
|
|
537
551
|
* @property {number} num
|
|
@@ -542,7 +556,8 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
542
556
|
*
|
|
543
557
|
* @typedef {Object} DocumentInitParameters
|
|
544
558
|
* @property {string | URL} [url] - The URL of the PDF.
|
|
545
|
-
* @property {
|
|
559
|
+
* @property {TypedArray | ArrayBuffer | Array<number> | string} [data] -
|
|
560
|
+
* Binary PDF data.
|
|
546
561
|
* Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
|
|
547
562
|
* BASE64-encoded, use `atob()` to convert it to a binary string first.
|
|
548
563
|
*
|
|
@@ -598,8 +613,8 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
598
613
|
* pixels, i.e. width * height. Images above this value will not be rendered.
|
|
599
614
|
* Use -1 for no limit, which is also the default value.
|
|
600
615
|
* @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
|
|
601
|
-
* as JavaScript. Primarily used to improve performance of
|
|
602
|
-
*
|
|
616
|
+
* as JavaScript. Primarily used to improve performance of PDF functions.
|
|
617
|
+
* The default value is `true`.
|
|
603
618
|
* @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use
|
|
604
619
|
* `OffscreenCanvas` in the worker. Primarily used to improve performance of
|
|
605
620
|
* image conversion/rendering.
|
|
@@ -641,6 +656,8 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
641
656
|
* when creating canvases. The default value is {new DOMCanvasFactory()}.
|
|
642
657
|
* @property {Object} [filterFactory] - A factory instance that will be used
|
|
643
658
|
* to create SVG filters when rendering some images on the main canvas.
|
|
659
|
+
* @property {boolean} [enableHWA] - Enables hardware acceleration for
|
|
660
|
+
* rendering. The default value is `false`.
|
|
644
661
|
*/
|
|
645
662
|
/**
|
|
646
663
|
* This is the main entry point for loading a PDF and interacting with it.
|
|
@@ -654,7 +671,7 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
|
654
671
|
* already populated with data, or a parameter object.
|
|
655
672
|
* @returns {PDFDocumentLoadingTask}
|
|
656
673
|
*/
|
|
657
|
-
export function getDocument(src
|
|
674
|
+
export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
|
|
658
675
|
export class LoopbackPort {
|
|
659
676
|
postMessage(obj: any, transfer: any): void;
|
|
660
677
|
addEventListener(name: any, listener: any): void;
|
|
@@ -685,7 +702,7 @@ export class PDFDataRangeTransport {
|
|
|
685
702
|
_progressListeners: any[];
|
|
686
703
|
_progressiveReadListeners: any[];
|
|
687
704
|
_progressiveDoneListeners: any[];
|
|
688
|
-
_readyCapability:
|
|
705
|
+
_readyCapability: any;
|
|
689
706
|
/**
|
|
690
707
|
* @param {function} listener
|
|
691
708
|
*/
|
|
@@ -736,8 +753,8 @@ export class PDFDataRangeTransport {
|
|
|
736
753
|
* after which individual pages can be rendered.
|
|
737
754
|
*/
|
|
738
755
|
export class PDFDocumentLoadingTask {
|
|
739
|
-
static "__#
|
|
740
|
-
_capability:
|
|
756
|
+
static "__#46@#docId": number;
|
|
757
|
+
_capability: any;
|
|
741
758
|
_transport: any;
|
|
742
759
|
_worker: any;
|
|
743
760
|
/**
|
|
@@ -900,7 +917,7 @@ export class PDFDocumentProxy {
|
|
|
900
917
|
* @returns {Promise<Array<OutlineNode>>} A promise that is resolved with an
|
|
901
918
|
* {Array} that is a tree outline (if it has one) of the PDF file.
|
|
902
919
|
*/
|
|
903
|
-
getOutline(): Promise<{
|
|
920
|
+
getOutline(): Promise<Array<{
|
|
904
921
|
title: string;
|
|
905
922
|
bold: boolean;
|
|
906
923
|
italic: boolean;
|
|
@@ -914,14 +931,35 @@ export class PDFDocumentProxy {
|
|
|
914
931
|
unsafeUrl: string | undefined;
|
|
915
932
|
newWindow: boolean | undefined;
|
|
916
933
|
count: number | undefined;
|
|
917
|
-
items: any
|
|
918
|
-
}
|
|
934
|
+
items: Array<any>;
|
|
935
|
+
}>>;
|
|
919
936
|
/**
|
|
937
|
+
* @typedef {Object} GetOptionalContentConfigParameters
|
|
938
|
+
* @property {string} [intent] - Determines the optional content groups that
|
|
939
|
+
* are visible by default; valid values are:
|
|
940
|
+
* - 'display' (viewable groups).
|
|
941
|
+
* - 'print' (printable groups).
|
|
942
|
+
* - 'any' (all groups).
|
|
943
|
+
* The default value is 'display'.
|
|
944
|
+
*/
|
|
945
|
+
/**
|
|
946
|
+
* @param {GetOptionalContentConfigParameters} [params] - Optional content
|
|
947
|
+
* config parameters.
|
|
920
948
|
* @returns {Promise<OptionalContentConfig>} A promise that is resolved with
|
|
921
949
|
* an {@link OptionalContentConfig} that contains all the optional content
|
|
922
950
|
* groups (assuming that the document has any).
|
|
923
951
|
*/
|
|
924
|
-
getOptionalContentConfig(
|
|
952
|
+
getOptionalContentConfig({ intent }?: {
|
|
953
|
+
/**
|
|
954
|
+
* - Determines the optional content groups that
|
|
955
|
+
* are visible by default; valid values are:
|
|
956
|
+
* - 'display' (viewable groups).
|
|
957
|
+
* - 'print' (printable groups).
|
|
958
|
+
* - 'any' (all groups).
|
|
959
|
+
* The default value is 'display'.
|
|
960
|
+
*/
|
|
961
|
+
intent?: string | undefined;
|
|
962
|
+
} | undefined): Promise<OptionalContentConfig>;
|
|
925
963
|
/**
|
|
926
964
|
* @returns {Promise<Array<number> | null>} A promise that is resolved with
|
|
927
965
|
* an {Array} that contains the permission flags for the PDF document, or
|
|
@@ -991,6 +1029,11 @@ export class PDFDocumentProxy {
|
|
|
991
1029
|
* Destroys the current document instance and terminates the worker.
|
|
992
1030
|
*/
|
|
993
1031
|
destroy(): Promise<void>;
|
|
1032
|
+
/**
|
|
1033
|
+
* @param {RefProxy} ref - The page reference.
|
|
1034
|
+
* @returns {number | null} The page number, if it's cached.
|
|
1035
|
+
*/
|
|
1036
|
+
cachedPageNumber(ref: RefProxy): number | null;
|
|
994
1037
|
/**
|
|
995
1038
|
* @type {DocumentInitParameters} A subset of the current
|
|
996
1039
|
* {DocumentInitParameters}, which are needed in the viewer.
|
|
@@ -1052,6 +1095,7 @@ export class PDFDocumentProxy {
|
|
|
1052
1095
|
* items are included when includeMarkedContent is true.
|
|
1053
1096
|
* @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
|
|
1054
1097
|
* indexed by font name.
|
|
1098
|
+
* @property {string | null} lang - The document /Lang attribute.
|
|
1055
1099
|
*/
|
|
1056
1100
|
/**
|
|
1057
1101
|
* Page text content part.
|
|
@@ -1136,6 +1180,7 @@ export class PDFDocumentProxy {
|
|
|
1136
1180
|
* @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some
|
|
1137
1181
|
* annotation ids with canvases used to render them.
|
|
1138
1182
|
* @property {PrintAnnotationStorage} [printAnnotationStorage]
|
|
1183
|
+
* @property {boolean} [isEditing] - Render the page in editing mode.
|
|
1139
1184
|
*/
|
|
1140
1185
|
/**
|
|
1141
1186
|
* Page getOperatorList parameters.
|
|
@@ -1156,6 +1201,7 @@ export class PDFDocumentProxy {
|
|
|
1156
1201
|
* from the {@link AnnotationStorage}-instance; useful e.g. for printing.
|
|
1157
1202
|
* The default value is `AnnotationMode.ENABLE`.
|
|
1158
1203
|
* @property {PrintAnnotationStorage} [printAnnotationStorage]
|
|
1204
|
+
* @property {boolean} [isEditing] - Render the page in editing mode.
|
|
1159
1205
|
*/
|
|
1160
1206
|
/**
|
|
1161
1207
|
* Structure tree node. The root node will have a role "Root".
|
|
@@ -1226,11 +1272,11 @@ export class PDFPageProxy {
|
|
|
1226
1272
|
*/
|
|
1227
1273
|
getViewport({ scale, rotation, offsetX, offsetY, dontFlip, }?: GetViewportParameters): PageViewport;
|
|
1228
1274
|
/**
|
|
1229
|
-
* @param {GetAnnotationsParameters} params - Annotation parameters.
|
|
1275
|
+
* @param {GetAnnotationsParameters} [params] - Annotation parameters.
|
|
1230
1276
|
* @returns {Promise<Array<any>>} A promise that is resolved with an
|
|
1231
1277
|
* {Array} of the annotation objects.
|
|
1232
1278
|
*/
|
|
1233
|
-
getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
|
|
1279
|
+
getAnnotations({ intent }?: GetAnnotationsParameters | undefined): Promise<Array<any>>;
|
|
1234
1280
|
/**
|
|
1235
1281
|
* @returns {Promise<Object>} A promise that is resolved with an
|
|
1236
1282
|
* {Object} with JS actions.
|
|
@@ -1258,14 +1304,14 @@ export class PDFPageProxy {
|
|
|
1258
1304
|
* @returns {RenderTask} An object that contains a promise that is
|
|
1259
1305
|
* resolved when the page finishes rendering.
|
|
1260
1306
|
*/
|
|
1261
|
-
render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, }: RenderParameters): RenderTask;
|
|
1307
|
+
render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
|
|
1262
1308
|
/**
|
|
1263
1309
|
* @param {GetOperatorListParameters} params - Page getOperatorList
|
|
1264
1310
|
* parameters.
|
|
1265
1311
|
* @returns {Promise<PDFOperatorList>} A promise resolved with an
|
|
1266
1312
|
* {@link PDFOperatorList} object that represents the page's operator list.
|
|
1267
1313
|
*/
|
|
1268
|
-
getOperatorList({ intent, annotationMode, printAnnotationStorage, }?: GetOperatorListParameters): Promise<PDFOperatorList>;
|
|
1314
|
+
getOperatorList({ intent, annotationMode, printAnnotationStorage, isEditing, }?: GetOperatorListParameters): Promise<PDFOperatorList>;
|
|
1269
1315
|
/**
|
|
1270
1316
|
* NOTE: All occurrences of whitespace will be replaced by
|
|
1271
1317
|
* standard spaces (0x20).
|
|
@@ -1325,6 +1371,13 @@ export class PDFPageProxy {
|
|
|
1325
1371
|
get stats(): StatTimer | null;
|
|
1326
1372
|
#private;
|
|
1327
1373
|
}
|
|
1374
|
+
/**
|
|
1375
|
+
* @typedef {Object} PDFWorkerParameters
|
|
1376
|
+
* @property {string} [name] - The name of the worker.
|
|
1377
|
+
* @property {Worker} [port] - The `workerPort` object.
|
|
1378
|
+
* @property {number} [verbosity] - Controls the logging level;
|
|
1379
|
+
* the constants from {@link VerbosityLevel} should be used.
|
|
1380
|
+
*/
|
|
1328
1381
|
/**
|
|
1329
1382
|
* PDF.js web worker abstraction that controls the instantiation of PDF
|
|
1330
1383
|
* documents. Message handlers are used to pass information from the main
|
|
@@ -1334,7 +1387,9 @@ export class PDFPageProxy {
|
|
|
1334
1387
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1335
1388
|
*/
|
|
1336
1389
|
export class PDFWorker {
|
|
1337
|
-
static "__#
|
|
1390
|
+
static "__#49@#fakeWorkerId": number;
|
|
1391
|
+
static "__#49@#isWorkerDisabled": boolean;
|
|
1392
|
+
static "__#49@#workerPorts": any;
|
|
1338
1393
|
/**
|
|
1339
1394
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1340
1395
|
*/
|
|
@@ -1344,7 +1399,7 @@ export class PDFWorker {
|
|
|
1344
1399
|
* @type {string}
|
|
1345
1400
|
*/
|
|
1346
1401
|
static get workerSrc(): string;
|
|
1347
|
-
static get "__#
|
|
1402
|
+
static get "__#49@#mainThreadWorkerMessageHandler"(): any;
|
|
1348
1403
|
static get _setupFakeWorkerGlobal(): any;
|
|
1349
1404
|
constructor({ name, port, verbosity, }?: {
|
|
1350
1405
|
name?: null | undefined;
|
|
@@ -1354,7 +1409,7 @@ export class PDFWorker {
|
|
|
1354
1409
|
name: any;
|
|
1355
1410
|
destroyed: boolean;
|
|
1356
1411
|
verbosity: number;
|
|
1357
|
-
_readyCapability:
|
|
1412
|
+
_readyCapability: any;
|
|
1358
1413
|
_port: any;
|
|
1359
1414
|
_webWorker: Worker | null;
|
|
1360
1415
|
_messageHandler: MessageHandler | null;
|
|
@@ -1380,10 +1435,7 @@ export class PDFWorker {
|
|
|
1380
1435
|
* Destroys the worker instance.
|
|
1381
1436
|
*/
|
|
1382
1437
|
destroy(): void;
|
|
1383
|
-
|
|
1384
|
-
export namespace PDFWorkerUtil {
|
|
1385
|
-
let isWorkerDisabled: boolean;
|
|
1386
|
-
let fakeWorkerId: number;
|
|
1438
|
+
#private;
|
|
1387
1439
|
}
|
|
1388
1440
|
/**
|
|
1389
1441
|
* Allows controlling of the rendering tasks.
|
|
@@ -1422,15 +1474,12 @@ export const version: string;
|
|
|
1422
1474
|
import { PageViewport } from "./display_utils.js";
|
|
1423
1475
|
import { OptionalContentConfig } from "./optional_content_config.js";
|
|
1424
1476
|
import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
1425
|
-
import { DOMCanvasFactory } from "./display_utils.js";
|
|
1426
1477
|
import { NodeCanvasFactory } from "./node_utils";
|
|
1427
1478
|
import { NodeCMapReaderFactory } from "./node_utils";
|
|
1428
1479
|
import { DOMFilterFactory } from "./display_utils.js";
|
|
1429
1480
|
import { NodeFilterFactory } from "./node_utils";
|
|
1430
1481
|
import { NodeStandardFontDataFactory } from "./node_utils";
|
|
1431
|
-
import { PromiseCapability } from "../shared/util.js";
|
|
1432
1482
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1433
|
-
import { info } from "../shared/util.js";
|
|
1434
1483
|
import { Metadata } from "./metadata.js";
|
|
1435
1484
|
import { StatTimer } from "./display_utils.js";
|
|
1436
1485
|
/**
|
|
@@ -1465,6 +1514,7 @@ declare class PDFObjects {
|
|
|
1465
1514
|
*/
|
|
1466
1515
|
resolve(objId: string, data?: any): void;
|
|
1467
1516
|
clear(): void;
|
|
1517
|
+
[Symbol.iterator](): Generator<any[], void, unknown>;
|
|
1468
1518
|
#private;
|
|
1469
1519
|
}
|
|
1470
1520
|
import { MessageHandler } from "../shared/message_handler.js";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export class BaseCanvasFactory {
|
|
2
|
+
constructor({ enableHWA }?: {
|
|
3
|
+
enableHWA?: boolean | undefined;
|
|
4
|
+
});
|
|
2
5
|
create(width: any, height: any): {
|
|
3
6
|
canvas: void;
|
|
4
7
|
context: any;
|
|
@@ -9,6 +12,7 @@ export class BaseCanvasFactory {
|
|
|
9
12
|
* @ignore
|
|
10
13
|
*/
|
|
11
14
|
_createCanvas(width: any, height: any): void;
|
|
15
|
+
#private;
|
|
12
16
|
}
|
|
13
17
|
export class BaseCMapReaderFactory {
|
|
14
18
|
constructor({ baseUrl, isCompressed }: {
|
|
@@ -28,7 +32,9 @@ export class BaseCMapReaderFactory {
|
|
|
28
32
|
export class BaseFilterFactory {
|
|
29
33
|
addFilter(maps: any): string;
|
|
30
34
|
addHCMFilter(fgColor: any, bgColor: any): string;
|
|
31
|
-
|
|
35
|
+
addAlphaFilter(map: any): string;
|
|
36
|
+
addLuminosityFilter(map: any): string;
|
|
37
|
+
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
|
|
32
38
|
destroy(keepHCM?: boolean): void;
|
|
33
39
|
}
|
|
34
40
|
export class BaseStandardFontDataFactory {
|
|
@@ -79,6 +79,8 @@ export class CanvasGraphics {
|
|
|
79
79
|
beginSMaskMode(): void;
|
|
80
80
|
endSMaskMode(): void;
|
|
81
81
|
compose(dirtyBox: any): void;
|
|
82
|
+
composeSMask(ctx: any, smask: any, layerCtx: any, layerBox: any): void;
|
|
83
|
+
genericComposeSMask(maskCtx: any, layerCtx: any, width: any, height: any, subtype: any, backdrop: any, transferMap: any, layerOffsetX: any, layerOffsetY: any, maskOffsetX: any, maskOffsetY: any): void;
|
|
82
84
|
save(): void;
|
|
83
85
|
restore(): void;
|
|
84
86
|
transform(a: any, b: any, c: any, d: any, e: any, f: any): void;
|
|
@@ -118,7 +120,9 @@ export class CanvasGraphics {
|
|
|
118
120
|
setStrokeColorN(...args: any[]): void;
|
|
119
121
|
setFillColorN(...args: any[]): void;
|
|
120
122
|
setStrokeRGBColor(r: any, g: any, b: any): void;
|
|
123
|
+
setStrokeTransparent(): void;
|
|
121
124
|
setFillRGBColor(r: any, g: any, b: any): void;
|
|
125
|
+
setFillTransparent(): void;
|
|
122
126
|
_getPattern(objId: any, matrix?: null): any;
|
|
123
127
|
shadingFill(objId: any): void;
|
|
124
128
|
beginInlineImage(): void;
|
|
@@ -57,8 +57,9 @@ export type PageViewportCloneParameters = {
|
|
|
57
57
|
};
|
|
58
58
|
export function deprecated(details: any): void;
|
|
59
59
|
export class DOMCanvasFactory extends BaseCanvasFactory {
|
|
60
|
-
constructor({ ownerDocument }?: {
|
|
60
|
+
constructor({ ownerDocument, enableHWA }?: {
|
|
61
61
|
ownerDocument?: Document | undefined;
|
|
62
|
+
enableHWA?: boolean | undefined;
|
|
62
63
|
});
|
|
63
64
|
_document: Document;
|
|
64
65
|
/**
|
|
@@ -91,7 +92,9 @@ export class DOMFilterFactory extends BaseFilterFactory {
|
|
|
91
92
|
});
|
|
92
93
|
addFilter(maps: any): any;
|
|
93
94
|
addHCMFilter(fgColor: any, bgColor: any): any;
|
|
94
|
-
|
|
95
|
+
addAlphaFilter(map: any): any;
|
|
96
|
+
addLuminosityFilter(map: any): any;
|
|
97
|
+
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
|
|
95
98
|
#private;
|
|
96
99
|
}
|
|
97
100
|
export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
|
|
@@ -113,10 +116,9 @@ export function getCurrentTransformInverse(ctx: any): any[];
|
|
|
113
116
|
/**
|
|
114
117
|
* Gets the filename from a given URL.
|
|
115
118
|
* @param {string} url
|
|
116
|
-
* @param {boolean} [onlyStripPath]
|
|
117
119
|
* @returns {string}
|
|
118
120
|
*/
|
|
119
|
-
export function getFilenameFromUrl(url: string
|
|
121
|
+
export function getFilenameFromUrl(url: string): string;
|
|
120
122
|
/**
|
|
121
123
|
* Returns the filename or guessed filename from the url (see issue 3455).
|
|
122
124
|
* @param {string} url - The original PDF location.
|
|
@@ -5,30 +5,28 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export class DrawLayer {
|
|
7
7
|
static get _svgFactory(): any;
|
|
8
|
-
static "__#
|
|
9
|
-
x
|
|
10
|
-
y
|
|
11
|
-
width
|
|
12
|
-
height
|
|
8
|
+
static "__#27@#setBox"(element: any, { x, y, width, height }?: {
|
|
9
|
+
x?: number | undefined;
|
|
10
|
+
y?: number | undefined;
|
|
11
|
+
width?: number | undefined;
|
|
12
|
+
height?: number | undefined;
|
|
13
13
|
}): void;
|
|
14
|
-
static "__#42@#extractPathFromHighlightOutlines"(polygons: any): string;
|
|
15
14
|
constructor({ pageIndex }: {
|
|
16
15
|
pageIndex: any;
|
|
17
16
|
});
|
|
18
17
|
pageIndex: any;
|
|
19
18
|
setParent(parent: any): void;
|
|
20
|
-
highlight(
|
|
21
|
-
outlines: any;
|
|
22
|
-
box: any;
|
|
23
|
-
}, color: any, opacity: any): {
|
|
19
|
+
highlight(outlines: any, color: any, opacity: any, isPathUpdatable?: boolean): {
|
|
24
20
|
id: number;
|
|
25
21
|
clipPathId: string;
|
|
26
22
|
};
|
|
27
|
-
highlightOutline(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
highlightOutline(outlines: any): number;
|
|
24
|
+
finalizeLine(id: any, line: any): void;
|
|
25
|
+
updateLine(id: any, line: any): void;
|
|
26
|
+
removeFreeHighlight(id: any): void;
|
|
27
|
+
updatePath(id: any, line: any): void;
|
|
31
28
|
updateBox(id: any, box: any): void;
|
|
29
|
+
show(id: any, visible: any): void;
|
|
32
30
|
rotate(id: any, angle: any): void;
|
|
33
31
|
changeColor(id: any, color: any): void;
|
|
34
32
|
changeOpacity(id: any, opacity: any): void;
|