pdfjs-serverless 0.3.2 → 0.4.1
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 +90 -12
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.mjs +1 -1
- package/dist/types/src/display/api.d.ts +8 -7
- package/dist/types/src/display/display_utils.d.ts +3 -2
- package/dist/types/src/display/draw_layer.d.ts +40 -0
- package/dist/types/src/display/editor/alt_text.d.ts +21 -0
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +23 -2
- package/dist/types/src/display/editor/color_picker.d.ts +19 -0
- package/dist/types/src/display/editor/editor.d.ts +29 -15
- package/dist/types/src/display/editor/highlight.d.ts +54 -0
- package/dist/types/src/display/editor/ink.d.ts +3 -3
- package/dist/types/src/display/editor/outliner.d.ts +26 -0
- package/dist/types/src/display/editor/toolbar.d.ts +11 -0
- package/dist/types/src/display/editor/tools.d.ts +3 -1
- package/dist/types/src/pdf.d.ts +5 -1
- package/dist/types/src/shared/util.d.ts +5 -1
- package/dist/types/web/annotation_editor_layer_builder.d.ts +4 -0
- package/dist/types/web/draw_layer_builder.d.ts +23 -0
- package/dist/types/web/genericl10n.d.ts +3 -3
- package/dist/types/web/interfaces.d.ts +3 -3
- package/dist/types/web/l10n.d.ts +4 -2
- package/dist/types/web/pdf_link_service.d.ts +5 -5
- package/dist/types/web/pdf_page_view.d.ts +2 -1
- package/dist/types/web/pdf_scripting_manager.d.ts +6 -6
- package/dist/types/web/pdf_single_page_viewer.d.ts +2 -2
- package/dist/types/web/pdf_thumbnail_view.d.ts +1 -1
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +1 -1
- package/dist/types/web/pdf_viewer.d.ts +52 -13
- package/dist/types/web/ui_utils.d.ts +1 -1
- package/package.json +16 -11
|
@@ -519,9 +519,9 @@ export type PDFWorkerParameters = {
|
|
|
519
519
|
/** @type {string} */
|
|
520
520
|
export const build: string;
|
|
521
521
|
export const DefaultCanvasFactory: typeof DOMCanvasFactory | typeof NodeCanvasFactory;
|
|
522
|
-
export const DefaultCMapReaderFactory: typeof
|
|
522
|
+
export const DefaultCMapReaderFactory: typeof NodeCMapReaderFactory;
|
|
523
523
|
export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
|
|
524
|
-
export const DefaultStandardFontDataFactory: typeof
|
|
524
|
+
export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
|
|
525
525
|
/**
|
|
526
526
|
* @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
|
|
527
527
|
* Int16Array | Uint16Array |
|
|
@@ -736,7 +736,7 @@ export class PDFDataRangeTransport {
|
|
|
736
736
|
* after which individual pages can be rendered.
|
|
737
737
|
*/
|
|
738
738
|
export class PDFDocumentLoadingTask {
|
|
739
|
-
static "__#
|
|
739
|
+
static "__#39@#docId": number;
|
|
740
740
|
_capability: PromiseCapability;
|
|
741
741
|
_transport: any;
|
|
742
742
|
_worker: any;
|
|
@@ -1334,7 +1334,7 @@ export class PDFPageProxy {
|
|
|
1334
1334
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1335
1335
|
*/
|
|
1336
1336
|
export class PDFWorker {
|
|
1337
|
-
static "__#
|
|
1337
|
+
static "__#42@#workerPorts": any;
|
|
1338
1338
|
/**
|
|
1339
1339
|
* @param {PDFWorkerParameters} params - The worker initialization parameters.
|
|
1340
1340
|
*/
|
|
@@ -1344,7 +1344,7 @@ export class PDFWorker {
|
|
|
1344
1344
|
* @type {string}
|
|
1345
1345
|
*/
|
|
1346
1346
|
static get workerSrc(): string;
|
|
1347
|
-
static get "__#
|
|
1347
|
+
static get "__#42@#mainThreadWorkerMessageHandler"(): any;
|
|
1348
1348
|
static get _setupFakeWorkerGlobal(): any;
|
|
1349
1349
|
constructor({ name, port, verbosity, }?: {
|
|
1350
1350
|
name?: null | undefined;
|
|
@@ -1424,10 +1424,10 @@ import { OptionalContentConfig } from "./optional_content_config.js";
|
|
|
1424
1424
|
import { PrintAnnotationStorage } from "./annotation_storage.js";
|
|
1425
1425
|
import { DOMCanvasFactory } from "./display_utils.js";
|
|
1426
1426
|
import { NodeCanvasFactory } from "./node_utils";
|
|
1427
|
-
import {
|
|
1427
|
+
import { NodeCMapReaderFactory } from "./node_utils";
|
|
1428
1428
|
import { DOMFilterFactory } from "./display_utils.js";
|
|
1429
1429
|
import { NodeFilterFactory } from "./node_utils";
|
|
1430
|
-
import {
|
|
1430
|
+
import { NodeStandardFontDataFactory } from "./node_utils";
|
|
1431
1431
|
import { PromiseCapability } from "../shared/util.js";
|
|
1432
1432
|
import { AnnotationStorage } from "./annotation_storage.js";
|
|
1433
1433
|
import { info } from "../shared/util.js";
|
|
@@ -1465,6 +1465,7 @@ declare class PDFObjects {
|
|
|
1465
1465
|
*/
|
|
1466
1466
|
resolve(objId: string, data?: any): void;
|
|
1467
1467
|
clear(): void;
|
|
1468
|
+
[Symbol.iterator](): Generator<any[], void, unknown>;
|
|
1468
1469
|
#private;
|
|
1469
1470
|
}
|
|
1470
1471
|
import { MessageHandler } from "../shared/message_handler.js";
|
|
@@ -71,7 +71,7 @@ export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
|
|
|
71
71
|
* @ignore
|
|
72
72
|
*/
|
|
73
73
|
_fetchData(url: any, compressionType: any): Promise<{
|
|
74
|
-
cMapData:
|
|
74
|
+
cMapData: Uint8Array;
|
|
75
75
|
compressionType: any;
|
|
76
76
|
}>;
|
|
77
77
|
}
|
|
@@ -98,7 +98,7 @@ export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
|
|
|
98
98
|
/**
|
|
99
99
|
* @ignore
|
|
100
100
|
*/
|
|
101
|
-
_fetchData(url: any): Promise<
|
|
101
|
+
_fetchData(url: any): Promise<Uint8Array>;
|
|
102
102
|
}
|
|
103
103
|
export class DOMSVGFactory extends BaseSVGFactory {
|
|
104
104
|
/**
|
|
@@ -106,6 +106,7 @@ export class DOMSVGFactory extends BaseSVGFactory {
|
|
|
106
106
|
*/
|
|
107
107
|
_createSVG(type: any): any;
|
|
108
108
|
}
|
|
109
|
+
export function fetchData(url: any, type?: string): Promise<any>;
|
|
109
110
|
export function getColorValues(colors: any): void;
|
|
110
111
|
export function getCurrentTransform(ctx: any): any[];
|
|
111
112
|
export function getCurrentTransformInverse(ctx: any): any[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manage the SVGs drawn on top of the page canvas.
|
|
3
|
+
* It's important to have them directly on top of the canvas because we want to
|
|
4
|
+
* be able to use mix-blend-mode for some of them.
|
|
5
|
+
*/
|
|
6
|
+
export class DrawLayer {
|
|
7
|
+
static get _svgFactory(): any;
|
|
8
|
+
static "__#21@#setBox"(element: any, { x, y, width, height }: {
|
|
9
|
+
x: any;
|
|
10
|
+
y: any;
|
|
11
|
+
width: any;
|
|
12
|
+
height: any;
|
|
13
|
+
}): void;
|
|
14
|
+
static "__#21@#extractPathFromHighlightOutlines"(polygons: any): string;
|
|
15
|
+
constructor({ pageIndex }: {
|
|
16
|
+
pageIndex: any;
|
|
17
|
+
});
|
|
18
|
+
pageIndex: any;
|
|
19
|
+
setParent(parent: any): void;
|
|
20
|
+
highlight({ outlines, box }: {
|
|
21
|
+
outlines: any;
|
|
22
|
+
box: any;
|
|
23
|
+
}, color: any, opacity: any): {
|
|
24
|
+
id: number;
|
|
25
|
+
clipPathId: string;
|
|
26
|
+
};
|
|
27
|
+
highlightOutline({ outlines, box }: {
|
|
28
|
+
outlines: any;
|
|
29
|
+
box: any;
|
|
30
|
+
}): number;
|
|
31
|
+
updateBox(id: any, box: any): void;
|
|
32
|
+
rotate(id: any, angle: any): void;
|
|
33
|
+
changeColor(id: any, color: any): void;
|
|
34
|
+
changeOpacity(id: any, opacity: any): void;
|
|
35
|
+
addClass(id: any, className: any): void;
|
|
36
|
+
removeClass(id: any, className: any): void;
|
|
37
|
+
remove(id: any): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
#private;
|
|
40
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class AltText {
|
|
2
|
+
static _l10nPromise: null;
|
|
3
|
+
static initialize(l10nPromise: any): void;
|
|
4
|
+
constructor(editor: any);
|
|
5
|
+
render(): Promise<HTMLButtonElement>;
|
|
6
|
+
finish(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Set the alt text data.
|
|
9
|
+
*/
|
|
10
|
+
set data({ altText, decorative }: {
|
|
11
|
+
altText: string;
|
|
12
|
+
decorative: boolean;
|
|
13
|
+
});
|
|
14
|
+
get data(): {
|
|
15
|
+
altText: string;
|
|
16
|
+
decorative: boolean;
|
|
17
|
+
};
|
|
18
|
+
toggle(enabled?: boolean): void;
|
|
19
|
+
destroy(): void;
|
|
20
|
+
#private;
|
|
21
|
+
}
|
|
@@ -3,6 +3,7 @@ export type PageViewport = import("../display_utils.js").PageViewport;
|
|
|
3
3
|
export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
|
|
4
4
|
export type IL10n = import("../../../web/interfaces").IL10n;
|
|
5
5
|
export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
|
|
6
|
+
export type DrawLayer = import("../draw_layer.js").DrawLayer;
|
|
6
7
|
export type AnnotationEditorLayerOptions = {
|
|
7
8
|
mode: Object;
|
|
8
9
|
div: HTMLDivElement;
|
|
@@ -12,6 +13,8 @@ export type AnnotationEditorLayerOptions = {
|
|
|
12
13
|
pageIndex: number;
|
|
13
14
|
l10n: IL10n;
|
|
14
15
|
annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined;
|
|
16
|
+
textLayer?: HTMLDivElement | undefined;
|
|
17
|
+
drawLayer: DrawLayer;
|
|
15
18
|
viewport: PageViewport;
|
|
16
19
|
};
|
|
17
20
|
export type RenderEditorLayerOptions = {
|
|
@@ -27,6 +30,8 @@ export type RenderEditorLayerOptions = {
|
|
|
27
30
|
* @property {number} pageIndex
|
|
28
31
|
* @property {IL10n} l10n
|
|
29
32
|
* @property {AnnotationLayer} [annotationLayer]
|
|
33
|
+
* @property {HTMLDivElement} [textLayer]
|
|
34
|
+
* @property {DrawLayer} drawLayer
|
|
30
35
|
* @property {PageViewport} viewport
|
|
31
36
|
*/
|
|
32
37
|
/**
|
|
@@ -38,14 +43,15 @@ export type RenderEditorLayerOptions = {
|
|
|
38
43
|
*/
|
|
39
44
|
export class AnnotationEditorLayer {
|
|
40
45
|
static _initialized: boolean;
|
|
41
|
-
static "__#
|
|
46
|
+
static "__#22@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof StampEditor>;
|
|
42
47
|
/**
|
|
43
48
|
* @param {AnnotationEditorLayerOptions} options
|
|
44
49
|
*/
|
|
45
|
-
constructor({ uiManager, pageIndex, div, accessibilityManager, annotationLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
|
|
50
|
+
constructor({ uiManager, pageIndex, div, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
|
|
46
51
|
pageIndex: number;
|
|
47
52
|
div: HTMLDivElement;
|
|
48
53
|
viewport: import("../display_utils.js").PageViewport;
|
|
54
|
+
drawLayer: import("../draw_layer.js").DrawLayer;
|
|
49
55
|
get isEmpty(): boolean;
|
|
50
56
|
/**
|
|
51
57
|
* Update the toolbar if it's required to reflect the tool currently used.
|
|
@@ -84,6 +90,8 @@ export class AnnotationEditorLayer {
|
|
|
84
90
|
* @param {AnnotationEditor} editor
|
|
85
91
|
*/
|
|
86
92
|
setActiveEditor(editor: AnnotationEditor): void;
|
|
93
|
+
enableTextSelection(): void;
|
|
94
|
+
disableTextSelection(): void;
|
|
87
95
|
enableClick(): void;
|
|
88
96
|
disableClick(): void;
|
|
89
97
|
attach(editor: any): void;
|
|
@@ -120,6 +128,7 @@ export class AnnotationEditorLayer {
|
|
|
120
128
|
* @returns {string}
|
|
121
129
|
*/
|
|
122
130
|
getNextId(): string;
|
|
131
|
+
canCreateNewEmptyEditor(): boolean | undefined;
|
|
123
132
|
/**
|
|
124
133
|
* Paste some content into a new editor.
|
|
125
134
|
* @param {number} mode
|
|
@@ -156,6 +165,17 @@ export class AnnotationEditorLayer {
|
|
|
156
165
|
* @param {AnnotationEditor} editor
|
|
157
166
|
*/
|
|
158
167
|
unselect(editor: AnnotationEditor): void;
|
|
168
|
+
/**
|
|
169
|
+
* SelectionChange callback.
|
|
170
|
+
* @param {Event} _event
|
|
171
|
+
*/
|
|
172
|
+
selectionStart(_event: Event): void;
|
|
173
|
+
/**
|
|
174
|
+
* Called when the user releases the mouse button after having selected
|
|
175
|
+
* some text.
|
|
176
|
+
* @param {PointerEvent} event
|
|
177
|
+
*/
|
|
178
|
+
pointerUpAfterSelection(event: PointerEvent): void;
|
|
159
179
|
/**
|
|
160
180
|
* Pointerup callback.
|
|
161
181
|
* @param {PointerEvent} event
|
|
@@ -197,5 +217,6 @@ export class AnnotationEditorLayer {
|
|
|
197
217
|
}
|
|
198
218
|
import { AnnotationEditor } from "./editor.js";
|
|
199
219
|
import { FreeTextEditor } from "./freetext.js";
|
|
220
|
+
import { HighlightEditor } from "./highlight.js";
|
|
200
221
|
import { InkEditor } from "./ink.js";
|
|
201
222
|
import { StampEditor } from "./stamp.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class ColorPicker {
|
|
2
|
+
static get _keyboardManager(): any;
|
|
3
|
+
constructor({ editor, uiManager }: {
|
|
4
|
+
editor?: null | undefined;
|
|
5
|
+
uiManager?: null | undefined;
|
|
6
|
+
});
|
|
7
|
+
renderButton(): HTMLButtonElement;
|
|
8
|
+
renderMainDropdown(): HTMLDivElement;
|
|
9
|
+
_colorSelectFromKeyboard(event: any): void;
|
|
10
|
+
_moveToNext(event: any): void;
|
|
11
|
+
_moveToPrevious(event: any): void;
|
|
12
|
+
_moveToBeginning(): void;
|
|
13
|
+
_moveToEnd(): void;
|
|
14
|
+
hideDropdown(): void;
|
|
15
|
+
_hideDropdownFromKeyboard(): void;
|
|
16
|
+
updateColor(color: any): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
#private;
|
|
19
|
+
}
|
|
@@ -36,7 +36,6 @@ export class AnnotationEditor {
|
|
|
36
36
|
static _borderLineWidth: number;
|
|
37
37
|
static _colorManager: ColorManager;
|
|
38
38
|
static _zIndex: number;
|
|
39
|
-
static SMALL_EDITOR_SIZE: number;
|
|
40
39
|
static get _resizerKeyboardManager(): any;
|
|
41
40
|
static get _defaultLineColor(): any;
|
|
42
41
|
static deleteAnnotationElement(editor: any): void;
|
|
@@ -70,7 +69,7 @@ export class AnnotationEditor {
|
|
|
70
69
|
* @param {AnnotationEditorLayer} parent
|
|
71
70
|
*/
|
|
72
71
|
static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
|
|
73
|
-
static "__#
|
|
72
|
+
static "__#30@#rotatePoint"(x: any, y: any, angle: any): any[];
|
|
74
73
|
/**
|
|
75
74
|
* Deserialize the editor.
|
|
76
75
|
* The result of the deserialization is a new editor.
|
|
@@ -82,6 +81,7 @@ export class AnnotationEditor {
|
|
|
82
81
|
*/
|
|
83
82
|
static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): AnnotationEditor | null;
|
|
84
83
|
static get MIN_SIZE(): number;
|
|
84
|
+
static canCreateNewEmptyEditor(): boolean;
|
|
85
85
|
/**
|
|
86
86
|
* @param {AnnotationEditorParameters} parameters
|
|
87
87
|
*/
|
|
@@ -114,7 +114,7 @@ export class AnnotationEditor {
|
|
|
114
114
|
* @returns {Array}
|
|
115
115
|
*/
|
|
116
116
|
get propertiesToUpdate(): any[];
|
|
117
|
-
set _isDraggable(
|
|
117
|
+
set _isDraggable(value: boolean);
|
|
118
118
|
get _isDraggable(): boolean;
|
|
119
119
|
/**
|
|
120
120
|
* @returns {boolean} true if the editor handles the Enter key itself.
|
|
@@ -173,7 +173,11 @@ export class AnnotationEditor {
|
|
|
173
173
|
*/
|
|
174
174
|
translateInPage(x: number, y: number): void;
|
|
175
175
|
drag(tx: any, ty: any): void;
|
|
176
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Fix the position of the editor in order to keep it inside its parent page.
|
|
178
|
+
* @param {number} [rotation] - the rotation of the page.
|
|
179
|
+
*/
|
|
180
|
+
fixAndSetPosition(rotation?: number | undefined): void;
|
|
177
181
|
/**
|
|
178
182
|
* Convert a screen translation into a page one.
|
|
179
183
|
* @param {number} x
|
|
@@ -201,20 +205,20 @@ export class AnnotationEditor {
|
|
|
201
205
|
* @returns {Array<number>}
|
|
202
206
|
*/
|
|
203
207
|
getInitialTranslation(): Array<number>;
|
|
204
|
-
addAltTextButton(): Promise<void>;
|
|
205
208
|
altTextFinish(): void;
|
|
209
|
+
/**
|
|
210
|
+
* Add a toolbar for this editor.
|
|
211
|
+
* @returns {Promise<EditorToolbar|null>}
|
|
212
|
+
*/
|
|
213
|
+
addEditToolbar(): Promise<EditorToolbar | null>;
|
|
214
|
+
removeEditToolbar(): void;
|
|
206
215
|
getClientDimensions(): DOMRect;
|
|
216
|
+
addAltTextButton(): Promise<void>;
|
|
207
217
|
/**
|
|
208
218
|
* Set the alt text data.
|
|
209
219
|
*/
|
|
210
|
-
set altTextData(
|
|
211
|
-
|
|
212
|
-
decorative: boolean;
|
|
213
|
-
});
|
|
214
|
-
get altTextData(): {
|
|
215
|
-
altText: string;
|
|
216
|
-
decorative: boolean;
|
|
217
|
-
};
|
|
220
|
+
set altTextData(data: any);
|
|
221
|
+
get altTextData(): any;
|
|
218
222
|
/**
|
|
219
223
|
* Render this editor in a div.
|
|
220
224
|
* @returns {HTMLDivElement | null}
|
|
@@ -229,8 +233,11 @@ export class AnnotationEditor {
|
|
|
229
233
|
_setParentAndPosition(parent: any, x: any, y: any): void;
|
|
230
234
|
/**
|
|
231
235
|
* Convert the current rect into a page one.
|
|
236
|
+
* @param {number} tx - x-translation in screen coordinates.
|
|
237
|
+
* @param {number} ty - y-translation in screen coordinates.
|
|
238
|
+
* @param {number} [rotation] - the rotation of the page.
|
|
232
239
|
*/
|
|
233
|
-
getRect(tx:
|
|
240
|
+
getRect(tx: number, ty: number, rotation?: number | undefined): any[];
|
|
234
241
|
getRectInCurrentCoords(rect: any, pageHeight: any): any[];
|
|
235
242
|
/**
|
|
236
243
|
* Executed once this editor has been rendered.
|
|
@@ -271,6 +278,11 @@ export class AnnotationEditor {
|
|
|
271
278
|
* To implement in subclasses.
|
|
272
279
|
*/
|
|
273
280
|
rebuild(): void;
|
|
281
|
+
/**
|
|
282
|
+
* Rotate the editor.
|
|
283
|
+
* @param {number} angle
|
|
284
|
+
*/
|
|
285
|
+
rotate(_angle: any): void;
|
|
274
286
|
/**
|
|
275
287
|
* Serialize the editor.
|
|
276
288
|
* The result of the serialization will be used to construct a
|
|
@@ -295,6 +307,7 @@ export class AnnotationEditor {
|
|
|
295
307
|
* Add the resizers to this editor.
|
|
296
308
|
*/
|
|
297
309
|
makeResizable(): void;
|
|
310
|
+
get toolbarPosition(): null;
|
|
298
311
|
/**
|
|
299
312
|
* onkeydown callback.
|
|
300
313
|
* @param {KeyboardEvent} event
|
|
@@ -343,7 +356,7 @@ export class AnnotationEditor {
|
|
|
343
356
|
* When set to true, it means that this editor is currently edited.
|
|
344
357
|
* @param {boolean} value
|
|
345
358
|
*/
|
|
346
|
-
set isEditing(
|
|
359
|
+
set isEditing(value: boolean);
|
|
347
360
|
/**
|
|
348
361
|
* If true then the editor is currently edited.
|
|
349
362
|
* @type {boolean}
|
|
@@ -358,4 +371,5 @@ export class AnnotationEditor {
|
|
|
358
371
|
#private;
|
|
359
372
|
}
|
|
360
373
|
import { AnnotationEditorUIManager } from "./tools.js";
|
|
374
|
+
import { EditorToolbar } from "./toolbar.js";
|
|
361
375
|
import { ColorManager } from "./tools.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic draw editor in order to generate an Highlight annotation.
|
|
3
|
+
*/
|
|
4
|
+
export class HighlightEditor extends AnnotationEditor {
|
|
5
|
+
static _defaultColor: null;
|
|
6
|
+
static _defaultOpacity: number;
|
|
7
|
+
static _l10nPromise: any;
|
|
8
|
+
static _type: string;
|
|
9
|
+
static _editorType: number;
|
|
10
|
+
static initialize(l10n: any): void;
|
|
11
|
+
static updateDefaultParams(type: any, value: any): void;
|
|
12
|
+
static get defaultPropertiesToUpdate(): (number | null)[][];
|
|
13
|
+
static "__#18@#rotateBbox"({ x, y, width, height }: {
|
|
14
|
+
x: any;
|
|
15
|
+
y: any;
|
|
16
|
+
width: any;
|
|
17
|
+
height: any;
|
|
18
|
+
}, angle: any): {
|
|
19
|
+
x: any;
|
|
20
|
+
y: any;
|
|
21
|
+
width: any;
|
|
22
|
+
height: any;
|
|
23
|
+
};
|
|
24
|
+
/** @inheritdoc */
|
|
25
|
+
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
|
|
26
|
+
constructor(params: any);
|
|
27
|
+
color: any;
|
|
28
|
+
/** @inheritdoc */
|
|
29
|
+
updateParams(type: any, value: any): void;
|
|
30
|
+
/** @inheritdoc */
|
|
31
|
+
get propertiesToUpdate(): any[][];
|
|
32
|
+
/** @inheritdoc */
|
|
33
|
+
fixAndSetPosition(): void;
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
getRect(tx: any, ty: any): any[];
|
|
36
|
+
/** @inheritdoc */
|
|
37
|
+
rotate(angle: any): void;
|
|
38
|
+
pointerover(): void;
|
|
39
|
+
pointerleave(): void;
|
|
40
|
+
/** @inheritdoc */
|
|
41
|
+
serialize(isForCopying?: boolean): {
|
|
42
|
+
annotationType: number;
|
|
43
|
+
color: number[];
|
|
44
|
+
opacity: any;
|
|
45
|
+
quadPoints: any[];
|
|
46
|
+
outlines: any[][];
|
|
47
|
+
pageIndex: number;
|
|
48
|
+
rect: any[];
|
|
49
|
+
rotation: number;
|
|
50
|
+
structTreeParentId: any;
|
|
51
|
+
} | null;
|
|
52
|
+
#private;
|
|
53
|
+
}
|
|
54
|
+
import { AnnotationEditor } from "./editor.js";
|
|
@@ -18,9 +18,9 @@ export class InkEditor extends AnnotationEditor {
|
|
|
18
18
|
* @param {Array<Array<number>>} bezier
|
|
19
19
|
* @returns {Path2D}
|
|
20
20
|
*/
|
|
21
|
-
static "__#
|
|
22
|
-
static "__#
|
|
23
|
-
static "__#
|
|
21
|
+
static "__#19@#buildPath2D"(bezier: Array<Array<number>>): Path2D;
|
|
22
|
+
static "__#19@#toPDFCoordinates"(points: any, rect: any, rotation: any): any;
|
|
23
|
+
static "__#19@#fromPDFCoordinates"(points: any, rect: any, rotation: any): any;
|
|
24
24
|
/** @inheritdoc */
|
|
25
25
|
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
|
|
26
26
|
constructor(params: any);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class Outliner {
|
|
2
|
+
/**
|
|
3
|
+
* Construct an outliner.
|
|
4
|
+
* @param {Array<Object>} boxes - An array of axis-aligned rectangles.
|
|
5
|
+
* @param {number} borderWidth - The width of the border of the boxes, it
|
|
6
|
+
* allows to make the boxes bigger (or smaller).
|
|
7
|
+
* @param {number} innerMargin - The margin between the boxes and the
|
|
8
|
+
* outlines. It's important to not have a null innerMargin when we want to
|
|
9
|
+
* draw the outline else the stroked outline could be clipped because of its
|
|
10
|
+
* width.
|
|
11
|
+
* @param {boolean} isLTR - true if we're in LTR mode. It's used to determine
|
|
12
|
+
* the last point of the boxes.
|
|
13
|
+
*/
|
|
14
|
+
constructor(boxes: Array<Object>, borderWidth?: number, innerMargin?: number, isLTR?: boolean);
|
|
15
|
+
getOutlines(): {
|
|
16
|
+
outlines: any[][];
|
|
17
|
+
box: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
lastPoint: any[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
#private;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class EditorToolbar {
|
|
2
|
+
static "__#29@#pointerDown"(e: any): void;
|
|
3
|
+
constructor(editor: any);
|
|
4
|
+
render(): HTMLDivElement;
|
|
5
|
+
hide(): void;
|
|
6
|
+
show(): void;
|
|
7
|
+
addAltTextButton(button: any): void;
|
|
8
|
+
addColorPicker(colorPicker: any): void;
|
|
9
|
+
remove(): void;
|
|
10
|
+
#private;
|
|
11
|
+
}
|
|
@@ -12,7 +12,7 @@ export class AnnotationEditorUIManager {
|
|
|
12
12
|
static TRANSLATE_SMALL: number;
|
|
13
13
|
static TRANSLATE_BIG: number;
|
|
14
14
|
static get _keyboardManager(): any;
|
|
15
|
-
constructor(container: any, viewer: any, altTextManager: any, eventBus: any, pdfDocument: any, pageColors: any);
|
|
15
|
+
constructor(container: any, viewer: any, altTextManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any);
|
|
16
16
|
_eventBus: any;
|
|
17
17
|
viewParameters: {
|
|
18
18
|
realScale: number;
|
|
@@ -21,6 +21,8 @@ export class AnnotationEditorUIManager {
|
|
|
21
21
|
destroy(): void;
|
|
22
22
|
get hcmFilter(): any;
|
|
23
23
|
get direction(): any;
|
|
24
|
+
get highlightColors(): any;
|
|
25
|
+
setMainHighlightColorPicker(colorPicker: any): void;
|
|
24
26
|
editAltText(editor: any): void;
|
|
25
27
|
onPageChanging({ pageNumber }: {
|
|
26
28
|
pageNumber: any;
|
package/dist/types/src/pdf.d.ts
CHANGED
|
@@ -14,9 +14,12 @@ import { AnnotationLayer } from "./display/annotation_layer.js";
|
|
|
14
14
|
import { AnnotationMode } from "./shared/util.js";
|
|
15
15
|
import { build } from "./display/api.js";
|
|
16
16
|
import { CMapCompressionType } from "./shared/util.js";
|
|
17
|
+
import { ColorPicker } from "./display/editor/color_picker.js";
|
|
17
18
|
import { createValidAbsoluteUrl } from "./shared/util.js";
|
|
18
19
|
import { DOMSVGFactory } from "./display/display_utils.js";
|
|
20
|
+
import { DrawLayer } from "./display/draw_layer.js";
|
|
19
21
|
import { FeatureTest } from "./shared/util.js";
|
|
22
|
+
import { fetchData } from "./display/display_utils.js";
|
|
20
23
|
import { getDocument } from "./display/api.js";
|
|
21
24
|
import { getFilenameFromUrl } from "./display/display_utils.js";
|
|
22
25
|
import { getPdfFilenameFromUrl } from "./display/display_utils.js";
|
|
@@ -30,6 +33,7 @@ import { MissingPDFException } from "./shared/util.js";
|
|
|
30
33
|
import { noContextMenu } from "./display/display_utils.js";
|
|
31
34
|
import { normalizeUnicode } from "./shared/util.js";
|
|
32
35
|
import { OPS } from "./shared/util.js";
|
|
36
|
+
import { Outliner } from "./display/editor/outliner.js";
|
|
33
37
|
import { PasswordResponses } from "./shared/util.js";
|
|
34
38
|
import { PDFDataRangeTransport } from "./display/api.js";
|
|
35
39
|
import { PDFDateString } from "./display/display_utils.js";
|
|
@@ -47,4 +51,4 @@ import { Util } from "./shared/util.js";
|
|
|
47
51
|
import { VerbosityLevel } from "./shared/util.js";
|
|
48
52
|
import { version } from "./display/api.js";
|
|
49
53
|
import { XfaLayer } from "./display/xfa_layer.js";
|
|
50
|
-
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, createValidAbsoluteUrl, DOMSVGFactory, FeatureTest, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, PromiseCapability, RenderingCancelledException, renderTextLayer, setLayerDimensions, shadow, UnexpectedResponseException, updateTextLayer, Util, VerbosityLevel, version, XfaLayer };
|
|
54
|
+
export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, Outliner, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, PromiseCapability, RenderingCancelledException, renderTextLayer, setLayerDimensions, shadow, UnexpectedResponseException, updateTextLayer, Util, VerbosityLevel, version, XfaLayer };
|
|
@@ -38,12 +38,15 @@ export namespace AnnotationEditorParamsType {
|
|
|
38
38
|
let INK_COLOR: number;
|
|
39
39
|
let INK_THICKNESS: number;
|
|
40
40
|
let INK_OPACITY: number;
|
|
41
|
+
let HIGHLIGHT_COLOR: number;
|
|
42
|
+
let HIGHLIGHT_DEFAULT_COLOR: number;
|
|
41
43
|
}
|
|
42
44
|
export const AnnotationEditorPrefix: "pdfjs_internal_editor_";
|
|
43
45
|
export namespace AnnotationEditorType {
|
|
44
46
|
let DISABLE: number;
|
|
45
47
|
let NONE: number;
|
|
46
48
|
let FREETEXT: number;
|
|
49
|
+
let HIGHLIGHT: number;
|
|
47
50
|
let STAMP: number;
|
|
48
51
|
let INK: number;
|
|
49
52
|
}
|
|
@@ -103,7 +106,8 @@ export namespace AnnotationType {
|
|
|
103
106
|
export let CIRCLE: number;
|
|
104
107
|
export let POLYGON: number;
|
|
105
108
|
export let POLYLINE: number;
|
|
106
|
-
|
|
109
|
+
let HIGHLIGHT_1: number;
|
|
110
|
+
export { HIGHLIGHT_1 as HIGHLIGHT };
|
|
107
111
|
let UNDERLINE_1: number;
|
|
108
112
|
export { UNDERLINE_1 as UNDERLINE };
|
|
109
113
|
export let SQUIGGLY: number;
|
|
@@ -11,6 +11,8 @@ export type AnnotationEditorLayerBuilderOptions = {
|
|
|
11
11
|
l10n?: import("./interfaces").IL10n | undefined;
|
|
12
12
|
accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
|
|
13
13
|
annotationLayer?: import("../src/display/annotation_layer.js").AnnotationLayer | undefined;
|
|
14
|
+
textLayer?: any;
|
|
15
|
+
drawLayer?: any;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* @typedef {Object} AnnotationEditorLayerBuilderOptions
|
|
@@ -20,6 +22,8 @@ export type AnnotationEditorLayerBuilderOptions = {
|
|
|
20
22
|
* @property {IL10n} [l10n]
|
|
21
23
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
22
24
|
* @property {AnnotationLayer} [annotationLayer]
|
|
25
|
+
* @property {TextLayer} [textLayer]
|
|
26
|
+
* @property {DrawLayer} [drawLayer]
|
|
23
27
|
*/
|
|
24
28
|
export class AnnotationEditorLayerBuilder {
|
|
25
29
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type DrawLayerBuilderOptions = {
|
|
2
|
+
pageIndex: number;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} DrawLayerBuilderOptions
|
|
6
|
+
* @property {number} pageIndex
|
|
7
|
+
*/
|
|
8
|
+
export class DrawLayerBuilder {
|
|
9
|
+
/**
|
|
10
|
+
* @param {DrawLayerBuilderOptions} options
|
|
11
|
+
*/
|
|
12
|
+
constructor(options: DrawLayerBuilderOptions);
|
|
13
|
+
pageIndex: number;
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} intent (default value is 'display')
|
|
16
|
+
*/
|
|
17
|
+
render(intent?: string): Promise<void>;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
_cancelled: boolean | undefined;
|
|
20
|
+
setParent(parent: any): void;
|
|
21
|
+
getDrawLayer(): null;
|
|
22
|
+
#private;
|
|
23
|
+
}
|
|
@@ -9,9 +9,9 @@ export class GenericL10n extends L10n implements IL10n {
|
|
|
9
9
|
* translations.
|
|
10
10
|
* @param {String} baseLang - The base language to use for translations.
|
|
11
11
|
*/
|
|
12
|
-
static "__#
|
|
13
|
-
static "__#
|
|
14
|
-
static "__#
|
|
12
|
+
static "__#53@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
|
|
13
|
+
static "__#53@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
|
|
14
|
+
static "__#53@#getPaths"(): Promise<{
|
|
15
15
|
baseURL: any;
|
|
16
16
|
paths: any;
|
|
17
17
|
}>;
|
|
@@ -83,7 +83,7 @@ export class IPDFLinkService {
|
|
|
83
83
|
/**
|
|
84
84
|
* @param {number} value
|
|
85
85
|
*/
|
|
86
|
-
set page(
|
|
86
|
+
set page(value: number);
|
|
87
87
|
/**
|
|
88
88
|
* @type {number}
|
|
89
89
|
*/
|
|
@@ -91,7 +91,7 @@ export class IPDFLinkService {
|
|
|
91
91
|
/**
|
|
92
92
|
* @param {number} value
|
|
93
93
|
*/
|
|
94
|
-
set rotation(
|
|
94
|
+
set rotation(value: number);
|
|
95
95
|
/**
|
|
96
96
|
* @type {number}
|
|
97
97
|
*/
|
|
@@ -103,7 +103,7 @@ export class IPDFLinkService {
|
|
|
103
103
|
/**
|
|
104
104
|
* @param {boolean} value
|
|
105
105
|
*/
|
|
106
|
-
set externalLinkEnabled(
|
|
106
|
+
set externalLinkEnabled(value: boolean);
|
|
107
107
|
/**
|
|
108
108
|
* @type {boolean}
|
|
109
109
|
*/
|
package/dist/types/web/l10n.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export type IL10n = import("./interfaces").IL10n;
|
|
2
2
|
/** @typedef {import("./interfaces").IL10n} IL10n */
|
|
3
3
|
/**
|
|
4
|
+
* NOTE: The L10n-implementations should use lowercase language-codes
|
|
5
|
+
* internally.
|
|
4
6
|
* @implements {IL10n}
|
|
5
7
|
*/
|
|
6
8
|
export class L10n implements IL10n {
|
|
7
|
-
static "__#
|
|
8
|
-
static "__#
|
|
9
|
+
static "__#52@#fixupLangCode"(langCode: any): any;
|
|
10
|
+
static "__#52@#isRTL"(lang: any): boolean;
|
|
9
11
|
constructor({ lang, isRTL }: {
|
|
10
12
|
lang: any;
|
|
11
13
|
isRTL: any;
|