unpdf 0.12.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -79
- package/dist/index.cjs +118 -73
- package/dist/index.d.cts +24 -41
- package/dist/index.d.mts +24 -41
- package/dist/index.d.ts +24 -41
- package/dist/index.mjs +117 -72
- package/dist/pdfjs.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +25 -1
- package/dist/types/src/display/annotation_storage.d.ts +1 -8
- package/dist/types/src/display/api.d.ts +147 -57
- package/dist/types/src/display/canvas.d.ts +21 -28
- package/dist/types/src/display/canvas_factory.d.ts +27 -0
- package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
- package/dist/types/src/display/display_utils.d.ts +40 -60
- package/dist/types/src/display/draw_layer.d.ts +7 -19
- package/dist/types/src/display/editor/alt_text.d.ts +3 -2
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -11
- package/dist/types/src/display/editor/color_picker.d.ts +1 -0
- package/dist/types/src/display/editor/draw.d.ts +121 -0
- package/dist/types/src/display/editor/drawers/contour.d.ts +3 -0
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
- package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
- package/dist/types/src/display/editor/drawers/inkdraw.d.ts +129 -0
- package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
- package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +79 -0
- package/dist/types/src/display/editor/editor.d.ts +55 -13
- package/dist/types/src/display/editor/freetext.d.ts +5 -16
- package/dist/types/src/display/editor/highlight.d.ts +8 -25
- package/dist/types/src/display/editor/ink.d.ts +21 -74
- package/dist/types/src/display/editor/signature.d.ts +80 -0
- package/dist/types/src/display/editor/stamp.d.ts +16 -22
- package/dist/types/src/display/editor/toolbar.d.ts +5 -2
- package/dist/types/src/display/editor/tools.d.ts +17 -9
- package/dist/types/src/display/fetch_stream.d.ts +6 -13
- package/dist/types/src/display/filter_factory.d.ts +29 -0
- package/dist/types/src/display/font_loader.d.ts +3 -6
- package/dist/types/src/display/metadata.d.ts +1 -2
- package/dist/types/src/display/network.d.ts +11 -7
- package/dist/types/src/display/network_utils.d.ts +7 -6
- package/dist/types/src/display/node_stream.d.ts +6 -22
- package/dist/types/src/display/node_utils.d.ts +15 -11
- package/dist/types/src/display/optional_content_config.d.ts +2 -2
- package/dist/types/src/display/pattern_helper.d.ts +4 -2
- package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
- package/dist/types/src/display/svg_factory.d.ts +14 -0
- package/dist/types/src/display/text_layer.d.ts +12 -9
- package/dist/types/src/display/touch_manager.d.ts +18 -0
- package/dist/types/src/display/transport_stream.d.ts +1 -1
- package/dist/types/src/display/wasm_factory.d.ts +20 -0
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/interfaces.d.ts +4 -0
- package/dist/types/src/pdf.d.ts +13 -5
- package/dist/types/src/shared/message_handler.d.ts +9 -4
- package/dist/types/src/shared/util.d.ts +137 -129
- package/dist/types/web/annotation_editor_layer_builder.d.ts +20 -5
- package/dist/types/web/annotation_layer_builder.d.ts +35 -4
- package/dist/types/web/app_options.d.ts +1 -1
- package/dist/types/web/autolinker.d.ts +28 -0
- package/dist/types/web/base_pdf_page_view.d.ts +27 -0
- package/dist/types/web/draw_layer_builder.d.ts +13 -2
- package/dist/types/web/event_utils.d.ts +2 -2
- package/dist/types/web/genericl10n.d.ts +5 -5
- package/dist/types/web/interfaces.d.ts +5 -5
- package/dist/types/web/l10n.d.ts +2 -2
- package/dist/types/web/pdf_find_controller.d.ts +2 -0
- package/dist/types/web/pdf_link_service.d.ts +1 -2
- package/dist/types/web/pdf_page_detail_view.d.ts +32 -0
- package/dist/types/web/pdf_page_view.d.ts +44 -23
- package/dist/types/web/pdf_rendering_queue.d.ts +2 -1
- package/dist/types/web/pdf_thumbnail_view.d.ts +23 -3
- package/dist/types/web/pdf_thumbnail_viewer.d.ts +21 -1
- package/dist/types/web/pdf_viewer.d.ts +44 -16
- package/dist/types/web/struct_tree_layer_builder.d.ts +20 -2
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +25 -17
- package/dist/types/web/ui_utils.d.ts +3 -19
- package/dist/types/web/xfa_layer_builder.d.ts +14 -3
- package/package.json +31 -28
- package/dist/types/src/display/base_factory.d.ts +0 -60
- package/dist/types/src/display/editor/outliner.d.ts +0 -70
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic text editor in order to create a Signature annotation.
|
|
3
|
+
*/
|
|
4
|
+
export class SignatureExtractor {
|
|
5
|
+
static "__#30@#PARAMETERS": {
|
|
6
|
+
maxDim: number;
|
|
7
|
+
sigmaSFactor: number;
|
|
8
|
+
sigmaR: number;
|
|
9
|
+
kernelSize: number;
|
|
10
|
+
};
|
|
11
|
+
static "__#30@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any;
|
|
12
|
+
static "__#30@#neighborIdToIndex": Int32Array<ArrayBuffer>;
|
|
13
|
+
static "__#30@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
|
|
14
|
+
static "__#30@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
|
|
15
|
+
static "__#30@#findContours"(buf: any, width: any, height: any, threshold: any): {
|
|
16
|
+
isHole: boolean;
|
|
17
|
+
points: number[];
|
|
18
|
+
id: number;
|
|
19
|
+
parent: number;
|
|
20
|
+
}[];
|
|
21
|
+
static "__#30@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void;
|
|
22
|
+
static "__#30@#douglasPeucker"(points: any): any[] | null;
|
|
23
|
+
static "__#30@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
|
|
24
|
+
static "__#30@#getHistogram"(buf: any): Uint32Array<ArrayBuffer>;
|
|
25
|
+
static "__#30@#toUint8"(buf: any): Uint8ClampedArray<ArrayBuffer>;
|
|
26
|
+
static "__#30@#guessThreshold"(histogram: any): number;
|
|
27
|
+
static "__#30@#getGrayPixels"(bitmap: any): any[];
|
|
28
|
+
static extractContoursFromText(text: any, { fontFamily, fontStyle, fontWeight }: {
|
|
29
|
+
fontFamily: any;
|
|
30
|
+
fontStyle: any;
|
|
31
|
+
fontWeight: any;
|
|
32
|
+
}, pageWidth: any, pageHeight: any, rotation: any, innerMargin: any): {
|
|
33
|
+
outline: InkDrawOutline;
|
|
34
|
+
newCurves: any[];
|
|
35
|
+
areContours: any;
|
|
36
|
+
thickness: any;
|
|
37
|
+
width: any;
|
|
38
|
+
height: any;
|
|
39
|
+
} | null;
|
|
40
|
+
static process(bitmap: any, pageWidth: any, pageHeight: any, rotation: any, innerMargin: any): {
|
|
41
|
+
outline: InkDrawOutline;
|
|
42
|
+
newCurves: any[];
|
|
43
|
+
areContours: any;
|
|
44
|
+
thickness: any;
|
|
45
|
+
width: any;
|
|
46
|
+
height: any;
|
|
47
|
+
} | null;
|
|
48
|
+
static processDrawnLines({ lines, pageWidth, pageHeight, rotation, innerMargin, mustSmooth, areContours, }: {
|
|
49
|
+
lines: any;
|
|
50
|
+
pageWidth: any;
|
|
51
|
+
pageHeight: any;
|
|
52
|
+
rotation: any;
|
|
53
|
+
innerMargin: any;
|
|
54
|
+
mustSmooth: any;
|
|
55
|
+
areContours: any;
|
|
56
|
+
}): {
|
|
57
|
+
outline: InkDrawOutline;
|
|
58
|
+
newCurves: any[];
|
|
59
|
+
areContours: any;
|
|
60
|
+
thickness: any;
|
|
61
|
+
width: any;
|
|
62
|
+
height: any;
|
|
63
|
+
} | null;
|
|
64
|
+
static compressSignature({ outlines, areContours, thickness, width, height, }: {
|
|
65
|
+
outlines: any;
|
|
66
|
+
areContours: any;
|
|
67
|
+
thickness: any;
|
|
68
|
+
width: any;
|
|
69
|
+
height: any;
|
|
70
|
+
}): Promise<any>;
|
|
71
|
+
static decompressSignature(signatureData: any): Promise<{
|
|
72
|
+
areContours: boolean;
|
|
73
|
+
thickness: number;
|
|
74
|
+
outlines: Float32Array<ArrayBuffer>[];
|
|
75
|
+
width: number;
|
|
76
|
+
height: number;
|
|
77
|
+
} | null>;
|
|
78
|
+
}
|
|
79
|
+
import { InkDrawOutline } from "./inkdraw.js";
|
|
@@ -33,20 +33,21 @@ export type AnnotationEditorParameters = {
|
|
|
33
33
|
* Base class for editors.
|
|
34
34
|
*/
|
|
35
35
|
export class AnnotationEditor {
|
|
36
|
-
static
|
|
36
|
+
static _l10n: null;
|
|
37
37
|
static _l10nResizer: null;
|
|
38
38
|
static _borderLineWidth: number;
|
|
39
39
|
static _colorManager: ColorManager;
|
|
40
40
|
static _zIndex: number;
|
|
41
41
|
static _telemetryTimeout: number;
|
|
42
42
|
static get _resizerKeyboardManager(): any;
|
|
43
|
+
static get isDrawer(): boolean;
|
|
43
44
|
static get _defaultLineColor(): any;
|
|
44
45
|
static deleteAnnotationElement(editor: any): void;
|
|
45
46
|
/**
|
|
46
47
|
* Initialize the l10n stuff for this type of editor.
|
|
47
48
|
* @param {Object} l10n
|
|
48
49
|
*/
|
|
49
|
-
static initialize(l10n: Object, _uiManager: any
|
|
50
|
+
static initialize(l10n: Object, _uiManager: any): void;
|
|
50
51
|
/**
|
|
51
52
|
* Update the default parameters for this type of editor.
|
|
52
53
|
* @param {number} _type
|
|
@@ -72,7 +73,8 @@ export class AnnotationEditor {
|
|
|
72
73
|
* @param {AnnotationEditorLayer} parent
|
|
73
74
|
*/
|
|
74
75
|
static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
|
|
75
|
-
static "__#
|
|
76
|
+
static "__#42@#rotatePoint"(x: any, y: any, angle: any): any[];
|
|
77
|
+
static _round(x: any): number;
|
|
76
78
|
/**
|
|
77
79
|
* Deserialize the editor.
|
|
78
80
|
* The result of the deserialization is a new editor.
|
|
@@ -80,17 +82,19 @@ export class AnnotationEditor {
|
|
|
80
82
|
* @param {Object} data
|
|
81
83
|
* @param {AnnotationEditorLayer} parent
|
|
82
84
|
* @param {AnnotationEditorUIManager} uiManager
|
|
83
|
-
* @returns {AnnotationEditor | null}
|
|
85
|
+
* @returns {Promise<AnnotationEditor | null>}
|
|
84
86
|
*/
|
|
85
|
-
static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): AnnotationEditor | null
|
|
87
|
+
static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): Promise<AnnotationEditor | null>;
|
|
86
88
|
static get MIN_SIZE(): number;
|
|
87
89
|
static canCreateNewEmptyEditor(): boolean;
|
|
88
90
|
/**
|
|
89
91
|
* @param {AnnotationEditorParameters} parameters
|
|
90
92
|
*/
|
|
91
93
|
constructor(parameters: AnnotationEditorParameters);
|
|
94
|
+
_isCopy: boolean;
|
|
92
95
|
_editToolbar: null;
|
|
93
96
|
_initialOptions: any;
|
|
97
|
+
_initialData: null;
|
|
94
98
|
_isVisible: boolean;
|
|
95
99
|
_uiManager: null;
|
|
96
100
|
_focusEventsAllowed: boolean;
|
|
@@ -163,6 +167,7 @@ export class AnnotationEditor {
|
|
|
163
167
|
* @param {number} ty - y-translation in screen coordinates.
|
|
164
168
|
*/
|
|
165
169
|
setAt(x: number, y: number, tx: number, ty: number): void;
|
|
170
|
+
_moveAfterPaste(baseX: any, baseY: any): void;
|
|
166
171
|
/**
|
|
167
172
|
* Translate the editor position within its parent.
|
|
168
173
|
* @param {number} x - x-translation in screen coordinates.
|
|
@@ -176,8 +181,22 @@ export class AnnotationEditor {
|
|
|
176
181
|
* @param {number} y - y-translation in page coordinates.
|
|
177
182
|
*/
|
|
178
183
|
translateInPage(x: number, y: number): void;
|
|
184
|
+
translationDone(): void;
|
|
179
185
|
drag(tx: any, ty: any): void;
|
|
186
|
+
/**
|
|
187
|
+
* Called when the editor is being translated.
|
|
188
|
+
* @param {number} x - in page coordinates.
|
|
189
|
+
* @param {number} y - in page coordinates.
|
|
190
|
+
*/
|
|
191
|
+
_onTranslating(x: number, y: number): void;
|
|
192
|
+
/**
|
|
193
|
+
* Called when the editor has been translated.
|
|
194
|
+
* @param {number} x - in page coordinates.
|
|
195
|
+
* @param {number} y - in page coordinates.
|
|
196
|
+
*/
|
|
197
|
+
_onTranslated(x: number, y: number): void;
|
|
180
198
|
get _hasBeenMoved(): boolean;
|
|
199
|
+
get _hasBeenResized(): boolean;
|
|
181
200
|
/**
|
|
182
201
|
* Get the translation to take into account the editor border.
|
|
183
202
|
* The CSS engine positions the element by taking the border into account so
|
|
@@ -195,7 +214,7 @@ export class AnnotationEditor {
|
|
|
195
214
|
* Fix the position of the editor in order to keep it inside its parent page.
|
|
196
215
|
* @param {number} [rotation] - the rotation of the page.
|
|
197
216
|
*/
|
|
198
|
-
fixAndSetPosition(rotation?: number
|
|
217
|
+
fixAndSetPosition(rotation?: number): void;
|
|
199
218
|
/**
|
|
200
219
|
* Convert a screen translation into a page one.
|
|
201
220
|
* @param {number} x
|
|
@@ -223,6 +242,14 @@ export class AnnotationEditor {
|
|
|
223
242
|
* @returns {Array<number>}
|
|
224
243
|
*/
|
|
225
244
|
getInitialTranslation(): Array<number>;
|
|
245
|
+
/**
|
|
246
|
+
* Called when the editor has been resized.
|
|
247
|
+
*/
|
|
248
|
+
_onResized(): void;
|
|
249
|
+
/**
|
|
250
|
+
* Called when the editor is being resized.
|
|
251
|
+
*/
|
|
252
|
+
_onResizing(): void;
|
|
226
253
|
/**
|
|
227
254
|
* Called when the alt text dialog is closed.
|
|
228
255
|
*/
|
|
@@ -233,6 +260,7 @@ export class AnnotationEditor {
|
|
|
233
260
|
*/
|
|
234
261
|
addEditToolbar(): Promise<EditorToolbar | null>;
|
|
235
262
|
removeEditToolbar(): void;
|
|
263
|
+
addContainer(container: any): void;
|
|
236
264
|
getClientDimensions(): DOMRect;
|
|
237
265
|
addAltTextButton(): Promise<void>;
|
|
238
266
|
/**
|
|
@@ -255,6 +283,9 @@ export class AnnotationEditor {
|
|
|
255
283
|
* @param {PointerEvent} event
|
|
256
284
|
*/
|
|
257
285
|
pointerdown(event: PointerEvent): void;
|
|
286
|
+
get isSelected(): any;
|
|
287
|
+
_onStartDragging(): void;
|
|
288
|
+
_onStopDragging(): void;
|
|
258
289
|
moveInDOM(): void;
|
|
259
290
|
_setParentAndPosition(parent: any, x: any, y: any): void;
|
|
260
291
|
/**
|
|
@@ -263,12 +294,13 @@ export class AnnotationEditor {
|
|
|
263
294
|
* @param {number} ty - y-translation in screen coordinates.
|
|
264
295
|
* @param {number} [rotation] - the rotation of the page.
|
|
265
296
|
*/
|
|
266
|
-
getRect(tx: number, ty: number, rotation?: number
|
|
297
|
+
getRect(tx: number, ty: number, rotation?: number): any[];
|
|
267
298
|
getRectInCurrentCoords(rect: any, pageHeight: any): any[];
|
|
268
299
|
/**
|
|
269
300
|
* Executed once this editor has been rendered.
|
|
301
|
+
* @param {boolean} focus - true if the editor should be focused.
|
|
270
302
|
*/
|
|
271
|
-
onceAdded(): void;
|
|
303
|
+
onceAdded(focus: boolean): void;
|
|
272
304
|
/**
|
|
273
305
|
* Check if the editor contains something.
|
|
274
306
|
* @returns {boolean}
|
|
@@ -298,6 +330,7 @@ export class AnnotationEditor {
|
|
|
298
330
|
* @returns {boolean}
|
|
299
331
|
*/
|
|
300
332
|
needsToBeRebuilt(): boolean;
|
|
333
|
+
get isOnScreen(): boolean;
|
|
301
334
|
/**
|
|
302
335
|
* Rebuild the editor in case it has been removed on undo.
|
|
303
336
|
*
|
|
@@ -305,10 +338,19 @@ export class AnnotationEditor {
|
|
|
305
338
|
*/
|
|
306
339
|
rebuild(): void;
|
|
307
340
|
/**
|
|
308
|
-
* Rotate the editor.
|
|
341
|
+
* Rotate the editor when the page is rotated.
|
|
309
342
|
* @param {number} angle
|
|
310
343
|
*/
|
|
311
344
|
rotate(_angle: any): void;
|
|
345
|
+
/**
|
|
346
|
+
* Resize the editor when the page is resized.
|
|
347
|
+
*/
|
|
348
|
+
resize(): void;
|
|
349
|
+
/**
|
|
350
|
+
* Serialize the editor when it has been deleted.
|
|
351
|
+
* @returns {Object}
|
|
352
|
+
*/
|
|
353
|
+
serializeDeleted(): Object;
|
|
312
354
|
/**
|
|
313
355
|
* Serialize the editor.
|
|
314
356
|
* The result of the serialization will be used to construct a
|
|
@@ -319,7 +361,7 @@ export class AnnotationEditor {
|
|
|
319
361
|
* @param {Object | null} [context]
|
|
320
362
|
* @returns {Object | null}
|
|
321
363
|
*/
|
|
322
|
-
serialize(isForCopying?: boolean
|
|
364
|
+
serialize(isForCopying?: boolean, context?: Object | null): Object | null;
|
|
323
365
|
/**
|
|
324
366
|
* Check if an existing annotation associated with this editor has been
|
|
325
367
|
* modified.
|
|
@@ -378,7 +420,7 @@ export class AnnotationEditor {
|
|
|
378
420
|
/**
|
|
379
421
|
* @returns {HTMLElement | null} the element requiring an alt text.
|
|
380
422
|
*/
|
|
381
|
-
|
|
423
|
+
getElementForAltText(): HTMLElement | null;
|
|
382
424
|
/**
|
|
383
425
|
* Get the div which really contains the displayed content.
|
|
384
426
|
* @returns {HTMLDivElement | undefined}
|
|
@@ -421,9 +463,9 @@ export class AnnotationEditor {
|
|
|
421
463
|
/**
|
|
422
464
|
* Render an annotation in the annotation layer.
|
|
423
465
|
* @param {Object} annotation
|
|
424
|
-
* @returns {HTMLElement}
|
|
466
|
+
* @returns {HTMLElement|null}
|
|
425
467
|
*/
|
|
426
|
-
renderAnnotationElement(annotation: Object): HTMLElement;
|
|
468
|
+
renderAnnotationElement(annotation: Object): HTMLElement | null;
|
|
427
469
|
resetAnnotationElement(annotation: any): void;
|
|
428
470
|
#private;
|
|
429
471
|
}
|
|
@@ -19,7 +19,7 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
19
19
|
static "__#18@#getNodeContent"(node: any): any;
|
|
20
20
|
static "__#18@#deserializeContent"(content: any): any;
|
|
21
21
|
/** @inheritdoc */
|
|
22
|
-
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null
|
|
22
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
23
23
|
constructor(params: any);
|
|
24
24
|
/** @inheritdoc */
|
|
25
25
|
updateParams(type: any, value: any): void;
|
|
@@ -31,6 +31,8 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
31
31
|
* @param {number} y in page units.
|
|
32
32
|
*/
|
|
33
33
|
_translateEmpty(x: number, y: number): void;
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
onceAdded(focus: any): void;
|
|
34
36
|
/**
|
|
35
37
|
* Commit the content we have in this editor.
|
|
36
38
|
* @returns {undefined}
|
|
@@ -49,22 +51,9 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
49
51
|
overlayDiv: HTMLDivElement | undefined;
|
|
50
52
|
editorDivPaste(event: any): void;
|
|
51
53
|
/** @inheritdoc */
|
|
52
|
-
serialize(isForCopying?: boolean):
|
|
53
|
-
annotationType: number;
|
|
54
|
-
color: number[];
|
|
55
|
-
fontSize: any;
|
|
56
|
-
value: string;
|
|
57
|
-
pageIndex: number;
|
|
58
|
-
rect: any[];
|
|
59
|
-
rotation: number;
|
|
60
|
-
structTreeParentId: any;
|
|
61
|
-
} | {
|
|
62
|
-
pageIndex: number;
|
|
63
|
-
id: any;
|
|
64
|
-
deleted: boolean;
|
|
65
|
-
} | null;
|
|
54
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
66
55
|
/** @inheritdoc */
|
|
67
|
-
renderAnnotationElement(annotation: any): HTMLElement;
|
|
56
|
+
renderAnnotationElement(annotation: any): HTMLElement | null;
|
|
68
57
|
#private;
|
|
69
58
|
}
|
|
70
59
|
import { AnnotationEditor } from "./editor.js";
|
|
@@ -5,7 +5,6 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
5
5
|
static _defaultColor: null;
|
|
6
6
|
static _defaultOpacity: number;
|
|
7
7
|
static _defaultThickness: number;
|
|
8
|
-
static _l10nPromise: any;
|
|
9
8
|
static _type: string;
|
|
10
9
|
static _editorType: number;
|
|
11
10
|
static _freeHighlightId: number;
|
|
@@ -20,17 +19,7 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
20
19
|
/** @inheritdoc */
|
|
21
20
|
static updateDefaultParams(type: any, value: any): void;
|
|
22
21
|
static get defaultPropertiesToUpdate(): (number | null)[][];
|
|
23
|
-
static "__#24@#rotateBbox"(
|
|
24
|
-
x: any;
|
|
25
|
-
y: any;
|
|
26
|
-
width: any;
|
|
27
|
-
height: any;
|
|
28
|
-
}, angle: any): {
|
|
29
|
-
x: any;
|
|
30
|
-
y: any;
|
|
31
|
-
width: any;
|
|
32
|
-
height: any;
|
|
33
|
-
};
|
|
22
|
+
static "__#24@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
|
|
34
23
|
static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
|
|
35
24
|
target: any;
|
|
36
25
|
x: any;
|
|
@@ -39,9 +28,10 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
39
28
|
static "__#24@#highlightMove"(parent: any, event: any): void;
|
|
40
29
|
static "__#24@#endHighlight"(parent: any, event: any): void;
|
|
41
30
|
/** @inheritdoc */
|
|
42
|
-
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null
|
|
31
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
43
32
|
constructor(params: any);
|
|
44
33
|
color: any;
|
|
34
|
+
defaultL10nId: string;
|
|
45
35
|
/** @inheritdoc */
|
|
46
36
|
get telemetryInitialData(): {
|
|
47
37
|
action: string;
|
|
@@ -66,23 +56,16 @@ export class HighlightEditor extends AnnotationEditor {
|
|
|
66
56
|
/** @inheritdoc */
|
|
67
57
|
getRect(tx: any, ty: any): any[];
|
|
68
58
|
/** @inheritdoc */
|
|
59
|
+
onceAdded(focus: any): void;
|
|
60
|
+
/** @inheritdoc */
|
|
69
61
|
rotate(angle: any): void;
|
|
70
62
|
pointerover(): void;
|
|
71
63
|
pointerleave(): void;
|
|
72
64
|
_moveCaret(direction: any): void;
|
|
73
65
|
/** @inheritdoc */
|
|
74
|
-
serialize(isForCopying?: boolean):
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
opacity: any;
|
|
78
|
-
thickness: any;
|
|
79
|
-
quadPoints: Float32Array | null;
|
|
80
|
-
outlines: any;
|
|
81
|
-
pageIndex: number;
|
|
82
|
-
rect: any[];
|
|
83
|
-
rotation: number;
|
|
84
|
-
structTreeParentId: any;
|
|
85
|
-
} | null;
|
|
66
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
67
|
+
/** @inheritdoc */
|
|
68
|
+
renderAnnotationElement(annotation: any): null;
|
|
86
69
|
#private;
|
|
87
70
|
}
|
|
88
71
|
import { AnnotationEditor } from "./editor.js";
|
|
@@ -1,90 +1,37 @@
|
|
|
1
|
+
export class InkDrawingOptions extends DrawingOptions {
|
|
2
|
+
constructor(viewerParameters: any);
|
|
3
|
+
_viewParameters: any;
|
|
4
|
+
clone(): InkDrawingOptions;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
7
|
* Basic draw editor in order to generate an Ink annotation.
|
|
3
8
|
*/
|
|
4
|
-
export class InkEditor extends
|
|
5
|
-
static _defaultColor: null;
|
|
6
|
-
static _defaultOpacity: number;
|
|
7
|
-
static _defaultThickness: number;
|
|
9
|
+
export class InkEditor extends DrawingEditor {
|
|
8
10
|
static _type: string;
|
|
9
11
|
static _editorType: number;
|
|
12
|
+
static _defaultDrawingOptions: null;
|
|
10
13
|
/** @inheritdoc */
|
|
11
14
|
static initialize(l10n: any, uiManager: any): void;
|
|
12
15
|
/** @inheritdoc */
|
|
13
|
-
static
|
|
14
|
-
/** @inheritdoc */
|
|
15
|
-
static get defaultPropertiesToUpdate(): any[][];
|
|
16
|
-
/**
|
|
17
|
-
* Convert into a Path2D.
|
|
18
|
-
* @param {Array<Array<number>>} bezier
|
|
19
|
-
* @returns {Path2D}
|
|
20
|
-
*/
|
|
21
|
-
static "__#25@#buildPath2D"(bezier: Array<Array<number>>): Path2D;
|
|
22
|
-
static "__#25@#toPDFCoordinates"(points: any, rect: any, rotation: any): any;
|
|
23
|
-
static "__#25@#fromPDFCoordinates"(points: any, rect: any, rotation: any): any;
|
|
16
|
+
static getDefaultDrawingOptions(options: any): any;
|
|
24
17
|
/** @inheritdoc */
|
|
25
|
-
static
|
|
26
|
-
constructor(params: any);
|
|
27
|
-
color: any;
|
|
28
|
-
thickness: any;
|
|
29
|
-
opacity: any;
|
|
30
|
-
paths: any[];
|
|
31
|
-
bezierPath2D: any[];
|
|
32
|
-
allRawPaths: any[];
|
|
33
|
-
currentPath: any[];
|
|
34
|
-
scaleFactor: number;
|
|
35
|
-
translationX: number;
|
|
36
|
-
translationY: number;
|
|
18
|
+
static get typesMap(): any;
|
|
37
19
|
/** @inheritdoc */
|
|
38
|
-
|
|
20
|
+
static createDrawerInstance(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): InkDrawOutliner;
|
|
39
21
|
/** @inheritdoc */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
onScaleChanging(): void;
|
|
43
|
-
pointerdownAC: any;
|
|
44
|
-
/**
|
|
45
|
-
* onpointerdown callback for the canvas we're drawing on.
|
|
46
|
-
* @param {PointerEvent} event
|
|
47
|
-
*/
|
|
48
|
-
canvasPointerdown(event: PointerEvent): void;
|
|
49
|
-
/**
|
|
50
|
-
* onpointermove callback for the canvas we're drawing on.
|
|
51
|
-
* @param {PointerEvent} event
|
|
52
|
-
*/
|
|
53
|
-
canvasPointermove(event: PointerEvent): void;
|
|
54
|
-
/**
|
|
55
|
-
* onpointerup callback for the canvas we're drawing on.
|
|
56
|
-
* @param {PointerEvent} event
|
|
57
|
-
*/
|
|
58
|
-
canvasPointerup(event: PointerEvent): void;
|
|
59
|
-
/**
|
|
60
|
-
* onpointerleave callback for the canvas we're drawing on.
|
|
61
|
-
* @param {PointerEvent} event
|
|
62
|
-
*/
|
|
63
|
-
canvasPointerleave(event: PointerEvent): void;
|
|
64
|
-
ctx: CanvasRenderingContext2D | null | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* When the dimensions of the div change the inner canvas must
|
|
67
|
-
* renew its dimensions, hence it must redraw its own contents.
|
|
68
|
-
* @param {number} width - the new width of the div
|
|
69
|
-
* @param {number} height - the new height of the div
|
|
70
|
-
* @returns
|
|
71
|
-
*/
|
|
72
|
-
setDimensions(width: number, height: number): void;
|
|
22
|
+
static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
|
|
23
|
+
defaultL10nId: string;
|
|
73
24
|
/** @inheritdoc */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
color: number[];
|
|
25
|
+
createDrawingOptions({ color, thickness, opacity }: {
|
|
26
|
+
color: any;
|
|
77
27
|
thickness: any;
|
|
78
28
|
opacity: any;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
pageIndex: number;
|
|
84
|
-
rect: any[];
|
|
85
|
-
rotation: number;
|
|
86
|
-
structTreeParentId: any;
|
|
87
|
-
} | null;
|
|
29
|
+
}): void;
|
|
30
|
+
_drawingOptions: any;
|
|
31
|
+
/** @inheritdoc */
|
|
32
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
88
33
|
#private;
|
|
89
34
|
}
|
|
90
|
-
import {
|
|
35
|
+
import { DrawingOptions } from "./draw.js";
|
|
36
|
+
import { DrawingEditor } from "./draw.js";
|
|
37
|
+
import { InkDrawOutliner } from "./drawers/inkdraw.js";
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic editor in order to generate an Stamp annotation annotation containing
|
|
3
|
+
* a signature drawing.
|
|
4
|
+
*/
|
|
5
|
+
export class SignatureEditor extends DrawingEditor {
|
|
6
|
+
static _type: string;
|
|
7
|
+
static _editorType: number;
|
|
8
|
+
static _defaultDrawingOptions: null;
|
|
9
|
+
/** @inheritdoc */
|
|
10
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
11
|
+
/** @inheritdoc */
|
|
12
|
+
static getDefaultDrawingOptions(options: any): any;
|
|
13
|
+
static get typesMap(): any;
|
|
14
|
+
static computeTelemetryFinalData(data: any): {
|
|
15
|
+
hasAltText: any;
|
|
16
|
+
hasNoAltText: any;
|
|
17
|
+
};
|
|
18
|
+
/** @inheritdoc */
|
|
19
|
+
static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
|
|
20
|
+
defaultL10nId: string;
|
|
21
|
+
/** @inheritdoc */
|
|
22
|
+
get telemetryFinalData(): {
|
|
23
|
+
type: string;
|
|
24
|
+
hasDescription: boolean;
|
|
25
|
+
};
|
|
26
|
+
setUuid(uuid: any): void;
|
|
27
|
+
getUuid(): null;
|
|
28
|
+
set description(description: null);
|
|
29
|
+
get description(): null;
|
|
30
|
+
getSignaturePreview(): {
|
|
31
|
+
areContours: any;
|
|
32
|
+
outline: InkDrawOutline;
|
|
33
|
+
};
|
|
34
|
+
addSignature(data: any, heightInPage: any, description: any, uuid: any): void;
|
|
35
|
+
getFromImage(bitmap: any): {
|
|
36
|
+
outline: InkDrawOutline;
|
|
37
|
+
newCurves: any[];
|
|
38
|
+
areContours: any;
|
|
39
|
+
thickness: any;
|
|
40
|
+
width: any;
|
|
41
|
+
height: any;
|
|
42
|
+
} | null;
|
|
43
|
+
getFromText(text: any, fontInfo: any): {
|
|
44
|
+
outline: InkDrawOutline;
|
|
45
|
+
newCurves: any[];
|
|
46
|
+
areContours: any;
|
|
47
|
+
thickness: any;
|
|
48
|
+
width: any;
|
|
49
|
+
height: any;
|
|
50
|
+
} | null;
|
|
51
|
+
getDrawnSignature(curves: any): {
|
|
52
|
+
outline: InkDrawOutline;
|
|
53
|
+
newCurves: any[];
|
|
54
|
+
areContours: any;
|
|
55
|
+
thickness: any;
|
|
56
|
+
width: any;
|
|
57
|
+
height: any;
|
|
58
|
+
} | null;
|
|
59
|
+
/** @inheritdoc */
|
|
60
|
+
createDrawingOptions({ areContours, thickness }: {
|
|
61
|
+
areContours: any;
|
|
62
|
+
thickness: any;
|
|
63
|
+
}): void;
|
|
64
|
+
_drawingOptions: any;
|
|
65
|
+
/** @inheritdoc */
|
|
66
|
+
serialize(isForCopying?: boolean): {
|
|
67
|
+
annotationType: number;
|
|
68
|
+
isSignature: boolean;
|
|
69
|
+
areContours: boolean;
|
|
70
|
+
color: number[];
|
|
71
|
+
thickness: any;
|
|
72
|
+
pageIndex: number;
|
|
73
|
+
rect: any;
|
|
74
|
+
rotation: number;
|
|
75
|
+
structTreeParentId: any;
|
|
76
|
+
} | null;
|
|
77
|
+
#private;
|
|
78
|
+
}
|
|
79
|
+
import { DrawingEditor } from "./draw.js";
|
|
80
|
+
import { InkDrawOutline } from "./drawers/inkdraw.js";
|
|
@@ -6,10 +6,8 @@ export class StampEditor extends AnnotationEditor {
|
|
|
6
6
|
static _editorType: number;
|
|
7
7
|
/** @inheritdoc */
|
|
8
8
|
static initialize(l10n: any, uiManager: any): void;
|
|
9
|
-
static get supportedTypes(): any;
|
|
10
|
-
static get supportedTypesStr(): any;
|
|
11
9
|
/** @inheritdoc */
|
|
12
|
-
static isHandlingMimeForPasting(mime: any):
|
|
10
|
+
static isHandlingMimeForPasting(mime: any): boolean;
|
|
13
11
|
/** @inheritdoc */
|
|
14
12
|
static paste(item: any, parent: any): void;
|
|
15
13
|
static computeTelemetryFinalData(data: any): {
|
|
@@ -17,37 +15,33 @@ export class StampEditor extends AnnotationEditor {
|
|
|
17
15
|
hasNoAltText: any;
|
|
18
16
|
};
|
|
19
17
|
/** @inheritdoc */
|
|
20
|
-
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null
|
|
18
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
21
19
|
constructor(params: any);
|
|
20
|
+
defaultL10nId: string;
|
|
22
21
|
/** @inheritdoc */
|
|
23
22
|
get telemetryFinalData(): {
|
|
24
23
|
type: string;
|
|
25
24
|
hasAltText: boolean;
|
|
26
25
|
};
|
|
27
26
|
mlGuessAltText(imageData?: null, updateAltTextData?: boolean): Promise<any>;
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/** @inheritdoc */
|
|
28
|
+
onceAdded(focus: any): void;
|
|
29
|
+
setCanvas(annotationElementId: any, canvas: any): void;
|
|
30
|
+
onScaleChanging(): void;
|
|
31
|
+
copyCanvas(maxDataDimension: any, maxPreviewDimension: any, createImageData?: boolean): {
|
|
32
|
+
canvas: HTMLCanvasElement | null;
|
|
33
|
+
width: any;
|
|
34
|
+
height: any;
|
|
30
35
|
imageData: {
|
|
31
36
|
width: any;
|
|
32
37
|
height: any;
|
|
33
|
-
data: Uint8ClampedArray
|
|
34
|
-
};
|
|
35
|
-
} | {
|
|
36
|
-
canvas: HTMLCanvasElement;
|
|
37
|
-
imageData: null;
|
|
38
|
+
data: Uint8ClampedArray<ArrayBufferLike>;
|
|
39
|
+
} | null;
|
|
38
40
|
};
|
|
39
41
|
/** @inheritdoc */
|
|
40
|
-
|
|
41
|
-
/** @inheritdoc */
|
|
42
|
-
|
|
43
|
-
annotationType: number;
|
|
44
|
-
bitmapId: null;
|
|
45
|
-
pageIndex: number;
|
|
46
|
-
rect: any[];
|
|
47
|
-
rotation: number;
|
|
48
|
-
isSvg: boolean;
|
|
49
|
-
structTreeParentId: any;
|
|
50
|
-
} | null;
|
|
42
|
+
serialize(isForCopying?: boolean, context?: null): Object | null;
|
|
43
|
+
/** @inheritdoc */
|
|
44
|
+
renderAnnotationElement(annotation: any): null;
|
|
51
45
|
#private;
|
|
52
46
|
}
|
|
53
47
|
import { AnnotationEditor } from "./editor.js";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export class EditorToolbar {
|
|
2
|
-
static "__#
|
|
3
|
-
static "__#
|
|
2
|
+
static "__#3@#l10nRemove": null;
|
|
3
|
+
static "__#3@#pointerDown"(e: any): void;
|
|
4
4
|
constructor(editor: any);
|
|
5
5
|
render(): HTMLDivElement;
|
|
6
|
+
get div(): null;
|
|
6
7
|
hide(): void;
|
|
7
8
|
show(): void;
|
|
8
9
|
addAltText(altText: any): Promise<void>;
|
|
9
10
|
addColorPicker(colorPicker: any): void;
|
|
11
|
+
addEditSignatureButton(signatureManager: any): Promise<void>;
|
|
12
|
+
updateEditSignatureButton(description: any): void;
|
|
10
13
|
remove(): void;
|
|
11
14
|
#private;
|
|
12
15
|
}
|