@chialab/pdfjs-lib 1.0.0-alpha.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 +29 -0
- package/dist/browser/FoxitDingbats-SB6TO3S5.js +9 -0
- package/dist/browser/FoxitFixed-UIGSMBQB.js +9 -0
- package/dist/browser/FoxitFixedBold-2PAEIZAT.js +9 -0
- package/dist/browser/FoxitFixedBoldItalic-OSQUQDEE.js +9 -0
- package/dist/browser/FoxitFixedItalic-W73RDK22.js +9 -0
- package/dist/browser/FoxitSerif-3HH3SOZF.js +9 -0
- package/dist/browser/FoxitSerifBold-HXP2QOO7.js +9 -0
- package/dist/browser/FoxitSerifBoldItalic-FZXLNWD7.js +9 -0
- package/dist/browser/FoxitSerifItalic-WQFHUBI2.js +9 -0
- package/dist/browser/FoxitSymbol-OVWU7LKS.js +9 -0
- package/dist/browser/LiberationMono-Regular-UUOCTXY2.js +9 -0
- package/dist/browser/LiberationSans-Bold-GSJN42N5.js +9 -0
- package/dist/browser/LiberationSans-BoldItalic-UCPQJ3L2.js +9 -0
- package/dist/browser/LiberationSans-Italic-6CIHEALY.js +9 -0
- package/dist/browser/LiberationSans-Regular-KIF3IRJY.js +9 -0
- package/dist/browser/LiberationSerif-Regular-ASQ2LI3D.js +9 -0
- package/dist/browser/chunk-DYHYQ33L.js +1775 -0
- package/dist/browser/chunk-O4UKW7AD.js +44 -0
- package/dist/browser/index.js +26324 -0
- package/dist/browser/worker.js +84242 -0
- package/dist/index.d.ts +10 -0
- package/dist/lib/AnnotationData.d.ts +204 -0
- package/dist/lib/Canvas.d.ts +17 -0
- package/dist/lib/PDFPageProxy.d.ts +1 -0
- package/dist/lib/Path2D.d.ts +72 -0
- package/dist/lib/StandardFontDataFactory.d.ts +14 -0
- package/dist/lib/SvgCanvasContext.d.ts +156 -0
- package/dist/lib/TextLayer.d.ts +51 -0
- package/dist/lib/polyfills.d.ts +0 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/node/FoxitDingbats-65AZ2Z2V.js +9 -0
- package/dist/node/FoxitFixed-OZGLVVOQ.js +9 -0
- package/dist/node/FoxitFixedBold-37OOYMV7.js +9 -0
- package/dist/node/FoxitFixedBoldItalic-XYFHEG2V.js +9 -0
- package/dist/node/FoxitFixedItalic-MM7OSGS6.js +9 -0
- package/dist/node/FoxitSerif-MLMJQPRP.js +9 -0
- package/dist/node/FoxitSerifBold-AC7RJQWJ.js +9 -0
- package/dist/node/FoxitSerifBoldItalic-YCQ4CLKE.js +9 -0
- package/dist/node/FoxitSerifItalic-CXVTCST4.js +9 -0
- package/dist/node/FoxitSymbol-VUGMZN5C.js +9 -0
- package/dist/node/LiberationMono-Regular-KMFXXO3B.js +9 -0
- package/dist/node/LiberationSans-Bold-XSHQQBWB.js +9 -0
- package/dist/node/LiberationSans-BoldItalic-CTAZRFRL.js +9 -0
- package/dist/node/LiberationSans-Italic-WIOTUKLC.js +9 -0
- package/dist/node/LiberationSans-Regular-CDMMZL5S.js +9 -0
- package/dist/node/LiberationSerif-Regular-WAOWR76G.js +9 -0
- package/dist/node/chunk-7MW5RQZ5.js +30 -0
- package/dist/node/chunk-KTTVPO2G.js +1775 -0
- package/dist/node/index.js +26621 -0
- package/dist/node/worker.js +84242 -0
- package/dist/pdf.js/src/display/annotation_layer.d.ts +241 -0
- package/dist/pdf.js/src/display/annotation_storage.d.ts +99 -0
- package/dist/pdf.js/src/display/api.d.ts +1586 -0
- package/dist/pdf.js/src/display/canvas.d.ts +213 -0
- package/dist/pdf.js/src/display/canvas_factory.d.ts +27 -0
- package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +25 -0
- package/dist/pdf.js/src/display/display_utils.d.ts +247 -0
- package/dist/pdf.js/src/display/draw_layer.d.ts +26 -0
- package/dist/pdf.js/src/display/editor/alt_text.d.ts +34 -0
- package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +230 -0
- package/dist/pdf.js/src/display/editor/color_picker.d.ts +20 -0
- package/dist/pdf.js/src/display/editor/draw.d.ts +121 -0
- package/dist/pdf.js/src/display/editor/drawers/contour.d.ts +3 -0
- package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +31 -0
- package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +36 -0
- package/dist/pdf.js/src/display/editor/drawers/inkdraw.d.ts +129 -0
- package/dist/pdf.js/src/display/editor/drawers/outline.d.ts +19 -0
- package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +79 -0
- package/dist/pdf.js/src/display/editor/editor.d.ts +474 -0
- package/dist/pdf.js/src/display/editor/freetext.d.ts +59 -0
- package/dist/pdf.js/src/display/editor/highlight.d.ts +70 -0
- package/dist/pdf.js/src/display/editor/ink.d.ts +36 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +79 -0
- package/dist/pdf.js/src/display/editor/stamp.d.ts +48 -0
- package/dist/pdf.js/src/display/editor/toolbar.d.ts +21 -0
- package/dist/pdf.js/src/display/editor/tools.d.ts +424 -0
- package/dist/pdf.js/src/display/filter_factory.d.ts +29 -0
- package/dist/pdf.js/src/display/font_loader.d.ts +39 -0
- package/dist/pdf.js/src/display/metadata.d.ts +11 -0
- package/dist/pdf.js/src/display/node_utils.d.ts +32 -0
- package/dist/pdf.js/src/display/optional_content_config.d.ts +18 -0
- package/dist/pdf.js/src/display/pattern_helper.d.ts +73 -0
- package/dist/pdf.js/src/display/standard_fontdata_factory.d.ts +20 -0
- package/dist/pdf.js/src/display/svg_factory.d.ts +14 -0
- package/dist/pdf.js/src/display/text_layer.d.ts +85 -0
- package/dist/pdf.js/src/display/touch_manager.d.ts +14 -0
- package/dist/pdf.js/src/display/transport_stream.d.ts +67 -0
- package/dist/pdf.js/src/display/wasm_factory.d.ts +20 -0
- package/dist/pdf.js/src/display/worker_options.d.ts +25 -0
- package/dist/pdf.js/src/display/xfa_layer.d.ts +47 -0
- package/dist/pdf.js/src/display/xfa_text.d.ts +21 -0
- package/dist/pdf.js/src/interfaces.d.ts +122 -0
- package/dist/pdf.js/src/pdf.d.ts +55 -0
- package/dist/pdf.js/src/shared/image_utils.d.ts +17 -0
- package/dist/pdf.js/src/shared/message_handler.d.ts +48 -0
- package/dist/pdf.js/src/shared/murmurhash3.d.ts +7 -0
- package/dist/pdf.js/src/shared/scripting_utils.d.ts +16 -0
- package/dist/pdf.js/src/shared/util.d.ts +388 -0
- package/dist/pdf.js/web/interfaces.d.ts +167 -0
- package/dist/pdf.js/web/struct_tree_layer_builder.d.ts +25 -0
- package/dist/pdf.js/web/text_accessibility.d.ts +44 -0
- package/dist/pdf.js/web/ui_utils.d.ts +273 -0
- package/package.json +43 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager;
|
|
2
|
+
export type PageViewport = import("../display_utils.js").PageViewport;
|
|
3
|
+
export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
|
|
4
|
+
export type IL10n = import("../../../web/interfaces").IL10n;
|
|
5
|
+
export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
|
|
6
|
+
export type DrawLayer = import("../draw_layer.js").DrawLayer;
|
|
7
|
+
export type StructTreeLayerBuilder = any;
|
|
8
|
+
export type AnnotationEditorLayerOptions = {
|
|
9
|
+
mode: Object;
|
|
10
|
+
div: HTMLDivElement;
|
|
11
|
+
structTreeLayer: StructTreeLayerBuilder;
|
|
12
|
+
uiManager: AnnotationEditorUIManager;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined;
|
|
15
|
+
pageIndex: number;
|
|
16
|
+
l10n: IL10n;
|
|
17
|
+
annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined;
|
|
18
|
+
textLayer?: HTMLDivElement | undefined;
|
|
19
|
+
drawLayer: DrawLayer;
|
|
20
|
+
viewport: PageViewport;
|
|
21
|
+
};
|
|
22
|
+
export type RenderEditorLayerOptions = {
|
|
23
|
+
viewport: PageViewport;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {Object} AnnotationEditorLayerOptions
|
|
27
|
+
* @property {Object} mode
|
|
28
|
+
* @property {HTMLDivElement} div
|
|
29
|
+
* @property {StructTreeLayerBuilder} structTreeLayer
|
|
30
|
+
* @property {AnnotationEditorUIManager} uiManager
|
|
31
|
+
* @property {boolean} enabled
|
|
32
|
+
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
33
|
+
* @property {number} pageIndex
|
|
34
|
+
* @property {IL10n} l10n
|
|
35
|
+
* @property {AnnotationLayer} [annotationLayer]
|
|
36
|
+
* @property {HTMLDivElement} [textLayer]
|
|
37
|
+
* @property {DrawLayer} drawLayer
|
|
38
|
+
* @property {PageViewport} viewport
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} RenderEditorLayerOptions
|
|
42
|
+
* @property {PageViewport} viewport
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Manage all the different editors on a page.
|
|
46
|
+
*/
|
|
47
|
+
export class AnnotationEditorLayer {
|
|
48
|
+
static _initialized: boolean;
|
|
49
|
+
static "__#34@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
|
|
50
|
+
/**
|
|
51
|
+
* @param {AnnotationEditorLayerOptions} options
|
|
52
|
+
*/
|
|
53
|
+
constructor({ uiManager, pageIndex, div, structTreeLayer, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
|
|
54
|
+
pageIndex: number;
|
|
55
|
+
div: HTMLDivElement;
|
|
56
|
+
viewport: import("../display_utils.js").PageViewport;
|
|
57
|
+
drawLayer: import("../draw_layer.js").DrawLayer;
|
|
58
|
+
_structTree: any;
|
|
59
|
+
get isEmpty(): boolean;
|
|
60
|
+
get isInvisible(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Update the toolbar if it's required to reflect the tool currently used.
|
|
63
|
+
* @param {number} mode
|
|
64
|
+
*/
|
|
65
|
+
updateToolbar(mode: number): void;
|
|
66
|
+
/**
|
|
67
|
+
* The mode has changed: it must be updated.
|
|
68
|
+
* @param {number} mode
|
|
69
|
+
*/
|
|
70
|
+
updateMode(mode?: number): void;
|
|
71
|
+
hasTextLayer(textLayer: any): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Set the editing state.
|
|
74
|
+
* @param {boolean} isEditing
|
|
75
|
+
*/
|
|
76
|
+
setEditingState(isEditing: boolean): void;
|
|
77
|
+
/**
|
|
78
|
+
* Add some commands into the CommandManager (undo/redo stuff).
|
|
79
|
+
* @param {Object} params
|
|
80
|
+
*/
|
|
81
|
+
addCommands(params: Object): void;
|
|
82
|
+
cleanUndoStack(type: any): void;
|
|
83
|
+
toggleDrawing(enabled?: boolean): void;
|
|
84
|
+
togglePointerEvents(enabled?: boolean): void;
|
|
85
|
+
toggleAnnotationLayerPointerEvents(enabled?: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Enable pointer events on the main div in order to enable
|
|
88
|
+
* editor creation.
|
|
89
|
+
*/
|
|
90
|
+
enable(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Disable editor creation.
|
|
93
|
+
*/
|
|
94
|
+
disable(): void;
|
|
95
|
+
getEditableAnnotation(id: any): any;
|
|
96
|
+
/**
|
|
97
|
+
* Set the current editor.
|
|
98
|
+
* @param {AnnotationEditor} editor
|
|
99
|
+
*/
|
|
100
|
+
setActiveEditor(editor: AnnotationEditor): void;
|
|
101
|
+
enableTextSelection(): void;
|
|
102
|
+
disableTextSelection(): void;
|
|
103
|
+
enableClick(): void;
|
|
104
|
+
disableClick(): void;
|
|
105
|
+
attach(editor: any): void;
|
|
106
|
+
detach(editor: any): void;
|
|
107
|
+
/**
|
|
108
|
+
* Remove an editor.
|
|
109
|
+
* @param {AnnotationEditor} editor
|
|
110
|
+
*/
|
|
111
|
+
remove(editor: AnnotationEditor): void;
|
|
112
|
+
/**
|
|
113
|
+
* An editor can have a different parent, for example after having
|
|
114
|
+
* being dragged and droped from a page to another.
|
|
115
|
+
* @param {AnnotationEditor} editor
|
|
116
|
+
*/
|
|
117
|
+
changeParent(editor: AnnotationEditor): void;
|
|
118
|
+
/**
|
|
119
|
+
* Add a new editor in the current view.
|
|
120
|
+
* @param {AnnotationEditor} editor
|
|
121
|
+
*/
|
|
122
|
+
add(editor: AnnotationEditor): void;
|
|
123
|
+
moveEditorInDOM(editor: any): void;
|
|
124
|
+
/**
|
|
125
|
+
* Add or rebuild depending if it has been removed or not.
|
|
126
|
+
* @param {AnnotationEditor} editor
|
|
127
|
+
*/
|
|
128
|
+
addOrRebuild(editor: AnnotationEditor): void;
|
|
129
|
+
/**
|
|
130
|
+
* Add a new editor and make this addition undoable.
|
|
131
|
+
* @param {AnnotationEditor} editor
|
|
132
|
+
*/
|
|
133
|
+
addUndoableEditor(editor: AnnotationEditor): void;
|
|
134
|
+
/**
|
|
135
|
+
* Get an id for an editor.
|
|
136
|
+
* @returns {string}
|
|
137
|
+
*/
|
|
138
|
+
getNextId(): string;
|
|
139
|
+
combinedSignal(ac: any): AbortSignal;
|
|
140
|
+
canCreateNewEmptyEditor(): boolean | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Paste some content into a new editor.
|
|
143
|
+
* @param {number} mode
|
|
144
|
+
* @param {Object} params
|
|
145
|
+
*/
|
|
146
|
+
pasteEditor(mode: number, params: Object): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Create a new editor
|
|
149
|
+
* @param {Object} data
|
|
150
|
+
* @returns {AnnotationEditor | null}
|
|
151
|
+
*/
|
|
152
|
+
deserialize(data: Object): AnnotationEditor | null;
|
|
153
|
+
/**
|
|
154
|
+
* Create and add a new editor.
|
|
155
|
+
* @param {PointerEvent} event
|
|
156
|
+
* @param {boolean} isCentered
|
|
157
|
+
* @param [Object] data
|
|
158
|
+
* @returns {AnnotationEditor}
|
|
159
|
+
*/
|
|
160
|
+
createAndAddNewEditor(event: PointerEvent, isCentered: boolean, data?: {}): AnnotationEditor;
|
|
161
|
+
/**
|
|
162
|
+
* Create and add a new editor.
|
|
163
|
+
*/
|
|
164
|
+
addNewEditor(data?: {}): void;
|
|
165
|
+
/**
|
|
166
|
+
* Set the last selected editor.
|
|
167
|
+
* @param {AnnotationEditor} editor
|
|
168
|
+
*/
|
|
169
|
+
setSelected(editor: AnnotationEditor): void;
|
|
170
|
+
/**
|
|
171
|
+
* Add or remove an editor the current selection.
|
|
172
|
+
* @param {AnnotationEditor} editor
|
|
173
|
+
*/
|
|
174
|
+
toggleSelected(editor: AnnotationEditor): void;
|
|
175
|
+
/**
|
|
176
|
+
* Unselect an editor.
|
|
177
|
+
* @param {AnnotationEditor} editor
|
|
178
|
+
*/
|
|
179
|
+
unselect(editor: AnnotationEditor): void;
|
|
180
|
+
/**
|
|
181
|
+
* Pointerup callback.
|
|
182
|
+
* @param {PointerEvent} event
|
|
183
|
+
*/
|
|
184
|
+
pointerup(event: PointerEvent): void;
|
|
185
|
+
/**
|
|
186
|
+
* Pointerdown callback.
|
|
187
|
+
* @param {PointerEvent} event
|
|
188
|
+
*/
|
|
189
|
+
pointerdown(event: PointerEvent): void;
|
|
190
|
+
startDrawingSession(event: any): void;
|
|
191
|
+
pause(on: any): void;
|
|
192
|
+
endDrawingSession(isAborted?: boolean): any;
|
|
193
|
+
/**
|
|
194
|
+
*
|
|
195
|
+
* @param {AnnotationEditor} editor
|
|
196
|
+
* @param {number} x
|
|
197
|
+
* @param {number} y
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
findNewParent(editor: AnnotationEditor, x: number, y: number): boolean;
|
|
201
|
+
commitOrRemove(): boolean;
|
|
202
|
+
onScaleChanging(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Destroy the main editor.
|
|
205
|
+
*/
|
|
206
|
+
destroy(): void;
|
|
207
|
+
/**
|
|
208
|
+
* Render the main editor.
|
|
209
|
+
* @param {RenderEditorLayerOptions} parameters
|
|
210
|
+
*/
|
|
211
|
+
render({ viewport }: RenderEditorLayerOptions): void;
|
|
212
|
+
/**
|
|
213
|
+
* Update the main editor.
|
|
214
|
+
* @param {RenderEditorLayerOptions} parameters
|
|
215
|
+
*/
|
|
216
|
+
update({ viewport }: RenderEditorLayerOptions): void;
|
|
217
|
+
/**
|
|
218
|
+
* Get page dimensions.
|
|
219
|
+
* @returns {Object} dimensions.
|
|
220
|
+
*/
|
|
221
|
+
get pageDimensions(): Object;
|
|
222
|
+
get scale(): number;
|
|
223
|
+
#private;
|
|
224
|
+
}
|
|
225
|
+
import { AnnotationEditor } from "./editor.js";
|
|
226
|
+
import { FreeTextEditor } from "./freetext.js";
|
|
227
|
+
import { HighlightEditor } from "./highlight.js";
|
|
228
|
+
import { InkEditor } from "./ink.js";
|
|
229
|
+
import { SignatureEditor } from "./signature.js";
|
|
230
|
+
import { StampEditor } from "./stamp.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export class ColorPicker {
|
|
2
|
+
static "__#23@#l10nColor": null;
|
|
3
|
+
static get _keyboardManager(): any;
|
|
4
|
+
constructor({ editor, uiManager }: {
|
|
5
|
+
editor?: null | undefined;
|
|
6
|
+
uiManager?: null | undefined;
|
|
7
|
+
});
|
|
8
|
+
renderButton(): HTMLButtonElement;
|
|
9
|
+
renderMainDropdown(): HTMLDivElement;
|
|
10
|
+
_colorSelectFromKeyboard(event: any): void;
|
|
11
|
+
_moveToNext(event: any): void;
|
|
12
|
+
_moveToPrevious(event: any): void;
|
|
13
|
+
_moveToBeginning(event: any): void;
|
|
14
|
+
_moveToEnd(event: any): void;
|
|
15
|
+
hideDropdown(): void;
|
|
16
|
+
_hideDropdownFromKeyboard(): void;
|
|
17
|
+
updateColor(color: any): void;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
#private;
|
|
20
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic draw editor.
|
|
3
|
+
*/
|
|
4
|
+
export class DrawingEditor extends AnnotationEditor {
|
|
5
|
+
static _currentDrawId: number;
|
|
6
|
+
static _currentParent: null;
|
|
7
|
+
static "__#26@#currentDraw": null;
|
|
8
|
+
static "__#26@#currentDrawingAC": null;
|
|
9
|
+
static "__#26@#currentDrawingOptions": null;
|
|
10
|
+
static "__#26@#currentPointerId": number;
|
|
11
|
+
static "__#26@#currentPointerType": null;
|
|
12
|
+
static "__#26@#currentPointerIds": null;
|
|
13
|
+
static "__#26@#currentMoveTimestamp": number;
|
|
14
|
+
static _INNER_MARGIN: number;
|
|
15
|
+
static _mergeSVGProperties(p1: any, p2: any): any;
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} options
|
|
18
|
+
* @return {DrawingOptions} the default options to use for a new editor.
|
|
19
|
+
*/
|
|
20
|
+
static getDefaultDrawingOptions(_options: any): DrawingOptions;
|
|
21
|
+
/**
|
|
22
|
+
* @return {Map<AnnotationEditorParamsType, string>} a map between the
|
|
23
|
+
* parameter types and the name of the options.
|
|
24
|
+
*/
|
|
25
|
+
static get typesMap(): Map<{
|
|
26
|
+
RESIZE: number;
|
|
27
|
+
CREATE: number;
|
|
28
|
+
FREETEXT_SIZE: number;
|
|
29
|
+
FREETEXT_COLOR: number;
|
|
30
|
+
FREETEXT_OPACITY: number;
|
|
31
|
+
INK_COLOR: number;
|
|
32
|
+
INK_THICKNESS: number;
|
|
33
|
+
INK_OPACITY: number;
|
|
34
|
+
HIGHLIGHT_COLOR: number;
|
|
35
|
+
HIGHLIGHT_DEFAULT_COLOR: number;
|
|
36
|
+
HIGHLIGHT_THICKNESS: number;
|
|
37
|
+
HIGHLIGHT_FREE: number;
|
|
38
|
+
HIGHLIGHT_SHOW_ALL: number;
|
|
39
|
+
DRAW_STEP: number;
|
|
40
|
+
}, string>;
|
|
41
|
+
/**
|
|
42
|
+
* @returns {boolean} `true` if several drawings can be added to the
|
|
43
|
+
* annotation.
|
|
44
|
+
*/
|
|
45
|
+
static get supportMultipleDrawings(): boolean;
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
static updateDefaultParams(type: any, value: any): void;
|
|
48
|
+
/** @inheritdoc */
|
|
49
|
+
static get defaultPropertiesToUpdate(): any[][];
|
|
50
|
+
static onScaleChangingWhenDrawing(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Create a new drawer instance.
|
|
53
|
+
* @param {number} x - The x coordinate of the event.
|
|
54
|
+
* @param {number} y - The y coordinate of the event.
|
|
55
|
+
* @param {number} parentWidth - The parent width.
|
|
56
|
+
* @param {number} parentHeight - The parent height.
|
|
57
|
+
* @param {number} rotation - The parent rotation.
|
|
58
|
+
*/
|
|
59
|
+
static createDrawerInstance(_x: any, _y: any, _parentWidth: any, _parentHeight: any, _rotation: any): void;
|
|
60
|
+
static startDrawing(parent: any, uiManager: any, _isLTR: any, event: any): void;
|
|
61
|
+
static _drawMove(event: any): void;
|
|
62
|
+
static _cleanup(all: any): void;
|
|
63
|
+
static _endDraw(event: any): void;
|
|
64
|
+
static endDrawing(isAborted: any): any;
|
|
65
|
+
/**
|
|
66
|
+
* Deserialize the drawing outlines.
|
|
67
|
+
* @param {number} pageX - The x coordinate of the page.
|
|
68
|
+
* @param {number} pageY - The y coordinate of the page.
|
|
69
|
+
* @param {number} pageWidth - The width of the page.
|
|
70
|
+
* @param {number} pageHeight - The height of the page.
|
|
71
|
+
* @param {number} innerWidth - The inner width.
|
|
72
|
+
* @param {Object} data - The data to deserialize.
|
|
73
|
+
* @returns {Object} The deserialized outlines.
|
|
74
|
+
*/
|
|
75
|
+
static deserializeDraw(_pageX: any, _pageY: any, _pageWidth: any, _pageHeight: any, _innerWidth: any, _data: any): Object;
|
|
76
|
+
/** @inheritdoc */
|
|
77
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
78
|
+
constructor(params: any);
|
|
79
|
+
_drawId: null;
|
|
80
|
+
_addOutlines(params: any): void;
|
|
81
|
+
/** @inheritdoc */
|
|
82
|
+
updateParams(type: any, value: any): void;
|
|
83
|
+
/** @inheritdoc */
|
|
84
|
+
get propertiesToUpdate(): any[][];
|
|
85
|
+
/**
|
|
86
|
+
* Update a property and make this action undoable.
|
|
87
|
+
* @param {string} color
|
|
88
|
+
*/
|
|
89
|
+
_updateProperty(type: any, name: any, value: any): void;
|
|
90
|
+
/** @inheritdoc */
|
|
91
|
+
_onTranslating(_x: any, _y: any): void;
|
|
92
|
+
/** @inheritdoc */
|
|
93
|
+
_onTranslated(): void;
|
|
94
|
+
/** @inheritdoc */
|
|
95
|
+
onceAdded(focus: any): void;
|
|
96
|
+
/** @inheritdoc */
|
|
97
|
+
rotate(): void;
|
|
98
|
+
onScaleChanging(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Create the drawing options.
|
|
101
|
+
* @param {Object} _data
|
|
102
|
+
*/
|
|
103
|
+
createDrawingOptions(_data: Object): void;
|
|
104
|
+
serializeDraw(isForCopying: any): any;
|
|
105
|
+
/** @inheritdoc */
|
|
106
|
+
renderAnnotationElement(annotation: any): null;
|
|
107
|
+
#private;
|
|
108
|
+
}
|
|
109
|
+
export class DrawingOptions {
|
|
110
|
+
updateProperty(name: any, value: any): void;
|
|
111
|
+
updateProperties(properties: any): void;
|
|
112
|
+
updateSVGProperty(name: any, value: any): void;
|
|
113
|
+
toSVGProperties(): {
|
|
114
|
+
root: any;
|
|
115
|
+
};
|
|
116
|
+
reset(): void;
|
|
117
|
+
updateAll(options?: this): void;
|
|
118
|
+
clone(): void;
|
|
119
|
+
#private;
|
|
120
|
+
}
|
|
121
|
+
import { AnnotationEditor } from "./editor.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class FreeDrawOutline extends Outline {
|
|
2
|
+
constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any);
|
|
3
|
+
lastPoint: number[];
|
|
4
|
+
serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): {
|
|
5
|
+
outline: any[];
|
|
6
|
+
points: any[][];
|
|
7
|
+
};
|
|
8
|
+
get box(): Float32Array<ArrayBuffer>;
|
|
9
|
+
newOutliner(point: any, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number): FreeDrawOutliner;
|
|
10
|
+
getNewOutline(thickness: any, innerMargin: any): FreeDrawOutline;
|
|
11
|
+
#private;
|
|
12
|
+
}
|
|
13
|
+
export class FreeDrawOutliner {
|
|
14
|
+
static "__#19@#MIN_DIST": number;
|
|
15
|
+
static "__#19@#MIN_DIFF": number;
|
|
16
|
+
static "__#19@#MIN": number;
|
|
17
|
+
constructor({ x, y }: {
|
|
18
|
+
x: any;
|
|
19
|
+
y: any;
|
|
20
|
+
}, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number);
|
|
21
|
+
isEmpty(): boolean;
|
|
22
|
+
add({ x, y }: {
|
|
23
|
+
x: any;
|
|
24
|
+
y: any;
|
|
25
|
+
}): boolean;
|
|
26
|
+
toSVGPath(): string;
|
|
27
|
+
newFreeDrawOutline(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any): FreeDrawOutline;
|
|
28
|
+
getOutlines(): FreeDrawOutline;
|
|
29
|
+
#private;
|
|
30
|
+
}
|
|
31
|
+
import { Outline } from "./outline.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class FreeHighlightOutliner extends FreeDrawOutliner {
|
|
2
|
+
}
|
|
3
|
+
export class HighlightOutliner {
|
|
4
|
+
/**
|
|
5
|
+
* Construct an outliner.
|
|
6
|
+
* @param {Array<Object>} boxes - An array of axis-aligned rectangles.
|
|
7
|
+
* @param {number} borderWidth - The width of the border of the boxes, it
|
|
8
|
+
* allows to make the boxes bigger (or smaller).
|
|
9
|
+
* @param {number} innerMargin - The margin between the boxes and the
|
|
10
|
+
* outlines. It's important to not have a null innerMargin when we want to
|
|
11
|
+
* draw the outline else the stroked outline could be clipped because of its
|
|
12
|
+
* width.
|
|
13
|
+
* @param {boolean} isLTR - true if we're in LTR mode. It's used to determine
|
|
14
|
+
* the last point of the boxes.
|
|
15
|
+
*/
|
|
16
|
+
constructor(boxes: Array<Object>, borderWidth?: number, innerMargin?: number, isLTR?: boolean);
|
|
17
|
+
getOutlines(): HighlightOutline;
|
|
18
|
+
#private;
|
|
19
|
+
}
|
|
20
|
+
import { FreeDrawOutliner } from "./freedraw.js";
|
|
21
|
+
declare class HighlightOutline extends Outline {
|
|
22
|
+
constructor(outlines: any, box: any, lastPoint: any);
|
|
23
|
+
lastPoint: any;
|
|
24
|
+
/**
|
|
25
|
+
* Serialize the outlines into the PDF page coordinate system.
|
|
26
|
+
* @param {Array<number>} _bbox - the bounding box of the annotation.
|
|
27
|
+
* @param {number} _rotation - the rotation of the annotation.
|
|
28
|
+
* @returns {Array<Array<number>>}
|
|
29
|
+
*/
|
|
30
|
+
serialize([blX, blY, trX, trY]: Array<number>, _rotation: number): Array<Array<number>>;
|
|
31
|
+
get box(): any;
|
|
32
|
+
get classNamesForOutlining(): string[];
|
|
33
|
+
#private;
|
|
34
|
+
}
|
|
35
|
+
import { Outline } from "./outline.js";
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export class InkDrawOutline extends Outline {
|
|
2
|
+
static deserialize(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, { paths: { lines, points }, rotation, thickness }: {
|
|
3
|
+
paths: {
|
|
4
|
+
lines: any;
|
|
5
|
+
points: any;
|
|
6
|
+
};
|
|
7
|
+
rotation: any;
|
|
8
|
+
thickness: any;
|
|
9
|
+
}): any;
|
|
10
|
+
build(lines: any, parentWidth: any, parentHeight: any, parentScale: any, rotation: any, thickness: any, innerMargin: any): void;
|
|
11
|
+
get thickness(): any;
|
|
12
|
+
setLastElement(element: any): {
|
|
13
|
+
path: {
|
|
14
|
+
d: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
removeLastElement(): {
|
|
18
|
+
path: {
|
|
19
|
+
d: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
serialize([pageX, pageY, pageWidth, pageHeight]: [any, any, any, any], isForCopying: any): {
|
|
23
|
+
lines: any[];
|
|
24
|
+
points: any[];
|
|
25
|
+
rect: any[];
|
|
26
|
+
};
|
|
27
|
+
get box(): any;
|
|
28
|
+
updateProperty(name: any, value: any): any;
|
|
29
|
+
updateParentDimensions([width, height]: [any, any], scale: any): any;
|
|
30
|
+
updateRotation(rotation: any): {
|
|
31
|
+
path: {
|
|
32
|
+
transform: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
get viewBox(): any;
|
|
36
|
+
get defaultProperties(): {
|
|
37
|
+
root: {
|
|
38
|
+
viewBox: any;
|
|
39
|
+
};
|
|
40
|
+
path: {
|
|
41
|
+
"transform-origin": string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
get rotationTransform(): string;
|
|
45
|
+
getPathResizingSVGProperties([newX, newY, newWidth, newHeight]: [any, any, any, any]): {
|
|
46
|
+
path: {
|
|
47
|
+
"transform-origin": string;
|
|
48
|
+
transform: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
getPathResizedSVGProperties([newX, newY, newWidth, newHeight]: [any, any, any, any]): {
|
|
52
|
+
root: {
|
|
53
|
+
viewBox: any;
|
|
54
|
+
};
|
|
55
|
+
path: {
|
|
56
|
+
"transform-origin": string;
|
|
57
|
+
transform: string | null;
|
|
58
|
+
d: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
getPathTranslatedSVGProperties([newX, newY]: [any, any], parentDimensions: any): {
|
|
62
|
+
root: {
|
|
63
|
+
viewBox: any;
|
|
64
|
+
};
|
|
65
|
+
path: {
|
|
66
|
+
d: string;
|
|
67
|
+
"transform-origin": string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
get defaultSVGProperties(): {
|
|
71
|
+
root: {
|
|
72
|
+
viewBox: any;
|
|
73
|
+
};
|
|
74
|
+
rootClass: {
|
|
75
|
+
draw: boolean;
|
|
76
|
+
};
|
|
77
|
+
path: {
|
|
78
|
+
d: string;
|
|
79
|
+
"transform-origin": string;
|
|
80
|
+
transform: string | null;
|
|
81
|
+
};
|
|
82
|
+
bbox: any;
|
|
83
|
+
};
|
|
84
|
+
#private;
|
|
85
|
+
}
|
|
86
|
+
export class InkDrawOutliner {
|
|
87
|
+
constructor(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any, thickness: any);
|
|
88
|
+
updateProperty(name: any, value: any): void;
|
|
89
|
+
isEmpty(): boolean;
|
|
90
|
+
isCancellable(): boolean;
|
|
91
|
+
add(x: any, y: any): {
|
|
92
|
+
path: {
|
|
93
|
+
d: string;
|
|
94
|
+
};
|
|
95
|
+
} | null;
|
|
96
|
+
end(x: any, y: any): {
|
|
97
|
+
path: {
|
|
98
|
+
d: string;
|
|
99
|
+
};
|
|
100
|
+
} | null;
|
|
101
|
+
startNew(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): null;
|
|
102
|
+
getLastElement(): {
|
|
103
|
+
line: any[];
|
|
104
|
+
points: any[];
|
|
105
|
+
} | undefined;
|
|
106
|
+
setLastElement(element: any): {
|
|
107
|
+
path: {
|
|
108
|
+
d: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
removeLastElement(): {
|
|
112
|
+
path: {
|
|
113
|
+
d: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
toSVGPath(): string;
|
|
117
|
+
getOutlines(parentWidth: any, parentHeight: any, scale: any, innerMargin: any): InkDrawOutline;
|
|
118
|
+
get defaultSVGProperties(): {
|
|
119
|
+
root: {
|
|
120
|
+
viewBox: string;
|
|
121
|
+
};
|
|
122
|
+
rootClass: {
|
|
123
|
+
draw: boolean;
|
|
124
|
+
};
|
|
125
|
+
bbox: number[];
|
|
126
|
+
};
|
|
127
|
+
#private;
|
|
128
|
+
}
|
|
129
|
+
import { Outline } from "./outline.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class Outline {
|
|
2
|
+
static PRECISION: number;
|
|
3
|
+
static _rescale(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any;
|
|
4
|
+
static _rescaleAndSwap(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any;
|
|
5
|
+
static _translate(src: any, tx: any, ty: any, dest: any): any;
|
|
6
|
+
static svgRound(x: any): number;
|
|
7
|
+
static _normalizePoint(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): number[];
|
|
8
|
+
static _normalizePagePoint(x: any, y: any, rotation: any): any[];
|
|
9
|
+
static createBezierPoints(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): number[];
|
|
10
|
+
/**
|
|
11
|
+
* @returns {string} The SVG path of the outline.
|
|
12
|
+
*/
|
|
13
|
+
toSVGPath(): string;
|
|
14
|
+
/**
|
|
15
|
+
* @type {Object|null} The bounding box of the outline.
|
|
16
|
+
*/
|
|
17
|
+
get box(): Object | null;
|
|
18
|
+
serialize(_bbox: any, _rotation: any): void;
|
|
19
|
+
}
|
|
@@ -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";
|