@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,79 @@
|
|
|
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
|
+
/** @inheritdoc */
|
|
21
|
+
get telemetryFinalData(): {
|
|
22
|
+
type: string;
|
|
23
|
+
hasDescription: boolean;
|
|
24
|
+
};
|
|
25
|
+
setUuid(uuid: any): void;
|
|
26
|
+
getUuid(): null;
|
|
27
|
+
set description(description: null);
|
|
28
|
+
get description(): null;
|
|
29
|
+
getSignaturePreview(): {
|
|
30
|
+
areContours: any;
|
|
31
|
+
outline: InkDrawOutline;
|
|
32
|
+
};
|
|
33
|
+
addSignature(data: any, heightInPage: any, description: any, uuid: any): void;
|
|
34
|
+
getFromImage(bitmap: any): {
|
|
35
|
+
outline: InkDrawOutline;
|
|
36
|
+
newCurves: any[];
|
|
37
|
+
areContours: any;
|
|
38
|
+
thickness: any;
|
|
39
|
+
width: any;
|
|
40
|
+
height: any;
|
|
41
|
+
} | null;
|
|
42
|
+
getFromText(text: any, fontInfo: any): {
|
|
43
|
+
outline: InkDrawOutline;
|
|
44
|
+
newCurves: any[];
|
|
45
|
+
areContours: any;
|
|
46
|
+
thickness: any;
|
|
47
|
+
width: any;
|
|
48
|
+
height: any;
|
|
49
|
+
} | null;
|
|
50
|
+
getDrawnSignature(curves: any): {
|
|
51
|
+
outline: InkDrawOutline;
|
|
52
|
+
newCurves: any[];
|
|
53
|
+
areContours: any;
|
|
54
|
+
thickness: any;
|
|
55
|
+
width: any;
|
|
56
|
+
height: any;
|
|
57
|
+
} | null;
|
|
58
|
+
/** @inheritdoc */
|
|
59
|
+
createDrawingOptions({ areContours, thickness }: {
|
|
60
|
+
areContours: any;
|
|
61
|
+
thickness: any;
|
|
62
|
+
}): void;
|
|
63
|
+
_drawingOptions: any;
|
|
64
|
+
/** @inheritdoc */
|
|
65
|
+
serialize(isForCopying?: boolean): {
|
|
66
|
+
annotationType: number;
|
|
67
|
+
isSignature: boolean;
|
|
68
|
+
areContours: boolean;
|
|
69
|
+
color: number[];
|
|
70
|
+
thickness: any;
|
|
71
|
+
pageIndex: number;
|
|
72
|
+
rect: any;
|
|
73
|
+
rotation: number;
|
|
74
|
+
structTreeParentId: any;
|
|
75
|
+
} | null;
|
|
76
|
+
#private;
|
|
77
|
+
}
|
|
78
|
+
import { DrawingEditor } from "./draw.js";
|
|
79
|
+
import { InkDrawOutline } from "./drawers/inkdraw.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic text editor in order to create a FreeTex annotation.
|
|
3
|
+
*/
|
|
4
|
+
export class StampEditor extends AnnotationEditor {
|
|
5
|
+
static _type: string;
|
|
6
|
+
static _editorType: number;
|
|
7
|
+
/** @inheritdoc */
|
|
8
|
+
static initialize(l10n: any, uiManager: any): void;
|
|
9
|
+
/** @inheritdoc */
|
|
10
|
+
static isHandlingMimeForPasting(mime: any): boolean;
|
|
11
|
+
/** @inheritdoc */
|
|
12
|
+
static paste(item: any, parent: any): void;
|
|
13
|
+
static computeTelemetryFinalData(data: any): {
|
|
14
|
+
hasAltText: any;
|
|
15
|
+
hasNoAltText: any;
|
|
16
|
+
};
|
|
17
|
+
/** @inheritdoc */
|
|
18
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
19
|
+
constructor(params: any);
|
|
20
|
+
/** @inheritdoc */
|
|
21
|
+
get telemetryFinalData(): {
|
|
22
|
+
type: string;
|
|
23
|
+
hasAltText: boolean;
|
|
24
|
+
};
|
|
25
|
+
mlGuessAltText(imageData?: null, updateAltTextData?: boolean): Promise<any>;
|
|
26
|
+
/** @inheritdoc */
|
|
27
|
+
onceAdded(focus: any): void;
|
|
28
|
+
setCanvas(annotationElementId: any, canvas: any): void;
|
|
29
|
+
onScaleChanging(): void;
|
|
30
|
+
copyCanvas(maxDataDimension: any, maxPreviewDimension: any, createImageData?: boolean): {
|
|
31
|
+
canvas: HTMLCanvasElement | null;
|
|
32
|
+
width: any;
|
|
33
|
+
height: any;
|
|
34
|
+
imageData: {
|
|
35
|
+
width: any;
|
|
36
|
+
height: any;
|
|
37
|
+
data: Uint8ClampedArray<ArrayBufferLike>;
|
|
38
|
+
} | null;
|
|
39
|
+
};
|
|
40
|
+
/** @inheritdoc */
|
|
41
|
+
getImageForAltText(): null;
|
|
42
|
+
/** @inheritdoc */
|
|
43
|
+
serialize(isForCopying?: boolean, context?: null): Object | null;
|
|
44
|
+
/** @inheritdoc */
|
|
45
|
+
renderAnnotationElement(annotation: any): null;
|
|
46
|
+
#private;
|
|
47
|
+
}
|
|
48
|
+
import { AnnotationEditor } from "./editor.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class EditorToolbar {
|
|
2
|
+
static "__#3@#l10nRemove": null;
|
|
3
|
+
static "__#3@#pointerDown"(e: any): void;
|
|
4
|
+
constructor(editor: any);
|
|
5
|
+
render(): HTMLDivElement;
|
|
6
|
+
get div(): null;
|
|
7
|
+
hide(): void;
|
|
8
|
+
show(): void;
|
|
9
|
+
addAltText(altText: any): Promise<void>;
|
|
10
|
+
addColorPicker(colorPicker: any): void;
|
|
11
|
+
addEditSignatureButton(signatureManager: any): Promise<void>;
|
|
12
|
+
updateEditSignatureButton(description: any): void;
|
|
13
|
+
remove(): void;
|
|
14
|
+
#private;
|
|
15
|
+
}
|
|
16
|
+
export class HighlightToolbar {
|
|
17
|
+
constructor(uiManager: any);
|
|
18
|
+
show(parent: any, boxes: any, isLTR: any): void;
|
|
19
|
+
hide(): void;
|
|
20
|
+
#private;
|
|
21
|
+
}
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
export type AnnotationEditor = import("./editor.js").AnnotationEditor;
|
|
2
|
+
export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer;
|
|
3
|
+
/**
|
|
4
|
+
* A pdf has several pages and each of them when it will rendered
|
|
5
|
+
* will have an AnnotationEditorLayer which will contain the some
|
|
6
|
+
* new Annotations associated to an editor in order to modify them.
|
|
7
|
+
*
|
|
8
|
+
* This class is used to manage all the different layers, editors and
|
|
9
|
+
* some action like copy/paste, undo/redo, ...
|
|
10
|
+
*/
|
|
11
|
+
export class AnnotationEditorUIManager {
|
|
12
|
+
static TRANSLATE_SMALL: number;
|
|
13
|
+
static TRANSLATE_BIG: number;
|
|
14
|
+
static get _keyboardManager(): any;
|
|
15
|
+
constructor(container: any, viewer: any, altTextManager: any, signatureManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, enableUpdatedAddImage: any, enableNewAltTextWhenAddingImage: any, mlManager: any, editorUndoBar: any, supportsPinchToZoom: any);
|
|
16
|
+
_editorUndoBar: null;
|
|
17
|
+
_signal: AbortSignal;
|
|
18
|
+
_eventBus: any;
|
|
19
|
+
viewParameters: {
|
|
20
|
+
realScale: number;
|
|
21
|
+
rotation: number;
|
|
22
|
+
};
|
|
23
|
+
isShiftKeyDown: boolean;
|
|
24
|
+
_supportsPinchToZoom: boolean;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
combinedSignal(ac: any): AbortSignal;
|
|
27
|
+
get mlManager(): null;
|
|
28
|
+
get useNewAltTextFlow(): boolean;
|
|
29
|
+
get useNewAltTextWhenAddingImage(): boolean;
|
|
30
|
+
get hcmFilter(): any;
|
|
31
|
+
get direction(): any;
|
|
32
|
+
get highlightColors(): any;
|
|
33
|
+
get highlightColorNames(): any;
|
|
34
|
+
/**
|
|
35
|
+
* Set the current drawing session.
|
|
36
|
+
* @param {AnnotationEditorLayer} layer
|
|
37
|
+
*/
|
|
38
|
+
setCurrentDrawingSession(layer: AnnotationEditorLayer): void;
|
|
39
|
+
setMainHighlightColorPicker(colorPicker: any): void;
|
|
40
|
+
editAltText(editor: any, firstTime?: boolean): void;
|
|
41
|
+
getSignature(editor: any): void;
|
|
42
|
+
get signatureManager(): null;
|
|
43
|
+
switchToMode(mode: any, callback: any): void;
|
|
44
|
+
setPreference(name: any, value: any): void;
|
|
45
|
+
onSetPreference({ name, value }: {
|
|
46
|
+
name: any;
|
|
47
|
+
value: any;
|
|
48
|
+
}): void;
|
|
49
|
+
onPageChanging({ pageNumber }: {
|
|
50
|
+
pageNumber: any;
|
|
51
|
+
}): void;
|
|
52
|
+
focusMainContainer(): void;
|
|
53
|
+
findParent(x: any, y: any): any;
|
|
54
|
+
disableUserSelect(value?: boolean): void;
|
|
55
|
+
addShouldRescale(editor: any): void;
|
|
56
|
+
removeShouldRescale(editor: any): void;
|
|
57
|
+
onScaleChanging({ scale }: {
|
|
58
|
+
scale: any;
|
|
59
|
+
}): void;
|
|
60
|
+
onRotationChanging({ pagesRotation }: {
|
|
61
|
+
pagesRotation: any;
|
|
62
|
+
}): void;
|
|
63
|
+
highlightSelection(methodOfCreation?: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Add an editor in the annotation storage.
|
|
66
|
+
* @param {AnnotationEditor} editor
|
|
67
|
+
*/
|
|
68
|
+
addToAnnotationStorage(editor: AnnotationEditor): void;
|
|
69
|
+
blur(): void;
|
|
70
|
+
focus(): void;
|
|
71
|
+
addEditListeners(): void;
|
|
72
|
+
removeEditListeners(): void;
|
|
73
|
+
dragOver(event: any): void;
|
|
74
|
+
/**
|
|
75
|
+
* Drop callback.
|
|
76
|
+
* @param {DragEvent} event
|
|
77
|
+
*/
|
|
78
|
+
drop(event: DragEvent): void;
|
|
79
|
+
/**
|
|
80
|
+
* Copy callback.
|
|
81
|
+
* @param {ClipboardEvent} event
|
|
82
|
+
*/
|
|
83
|
+
copy(event: ClipboardEvent): void;
|
|
84
|
+
/**
|
|
85
|
+
* Cut callback.
|
|
86
|
+
* @param {ClipboardEvent} event
|
|
87
|
+
*/
|
|
88
|
+
cut(event: ClipboardEvent): void;
|
|
89
|
+
/**
|
|
90
|
+
* Paste callback.
|
|
91
|
+
* @param {ClipboardEvent} event
|
|
92
|
+
*/
|
|
93
|
+
paste(event: ClipboardEvent): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Keydown callback.
|
|
96
|
+
* @param {KeyboardEvent} event
|
|
97
|
+
*/
|
|
98
|
+
keydown(event: KeyboardEvent): void;
|
|
99
|
+
/**
|
|
100
|
+
* Keyup callback.
|
|
101
|
+
* @param {KeyboardEvent} event
|
|
102
|
+
*/
|
|
103
|
+
keyup(event: KeyboardEvent): void;
|
|
104
|
+
/**
|
|
105
|
+
* Execute an action for a given name.
|
|
106
|
+
* For example, the user can click on the "Undo" entry in the context menu
|
|
107
|
+
* and it'll trigger the undo action.
|
|
108
|
+
*/
|
|
109
|
+
onEditingAction({ name }: {
|
|
110
|
+
name: any;
|
|
111
|
+
}): void;
|
|
112
|
+
/**
|
|
113
|
+
* Set the editing state.
|
|
114
|
+
* It can be useful to temporarily disable it when the user is editing a
|
|
115
|
+
* FreeText annotation.
|
|
116
|
+
* @param {boolean} isEditing
|
|
117
|
+
*/
|
|
118
|
+
setEditingState(isEditing: boolean): void;
|
|
119
|
+
registerEditorTypes(types: any): void;
|
|
120
|
+
/**
|
|
121
|
+
* Get an id.
|
|
122
|
+
* @returns {string}
|
|
123
|
+
*/
|
|
124
|
+
getId(): string;
|
|
125
|
+
get currentLayer(): any;
|
|
126
|
+
getLayer(pageIndex: any): any;
|
|
127
|
+
get currentPageIndex(): number;
|
|
128
|
+
/**
|
|
129
|
+
* Add a new layer for a page which will contains the editors.
|
|
130
|
+
* @param {AnnotationEditorLayer} layer
|
|
131
|
+
*/
|
|
132
|
+
addLayer(layer: AnnotationEditorLayer): void;
|
|
133
|
+
/**
|
|
134
|
+
* Remove a layer.
|
|
135
|
+
* @param {AnnotationEditorLayer} layer
|
|
136
|
+
*/
|
|
137
|
+
removeLayer(layer: AnnotationEditorLayer): void;
|
|
138
|
+
/**
|
|
139
|
+
* Change the editor mode (None, FreeText, Ink, ...)
|
|
140
|
+
* @param {number} mode
|
|
141
|
+
* @param {string|null} editId
|
|
142
|
+
* @param {boolean} [isFromKeyboard] - true if the mode change is due to a
|
|
143
|
+
* keyboard action.
|
|
144
|
+
*/
|
|
145
|
+
updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean): Promise<void>;
|
|
146
|
+
addNewEditorFromKeyboard(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Update the toolbar if it's required to reflect the tool currently used.
|
|
149
|
+
* @param {number} mode
|
|
150
|
+
* @returns {undefined}
|
|
151
|
+
*/
|
|
152
|
+
updateToolbar(mode: number): undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Update a parameter in the current editor or globally.
|
|
155
|
+
* @param {number} type
|
|
156
|
+
* @param {*} value
|
|
157
|
+
*/
|
|
158
|
+
updateParams(type: number, value: any): void;
|
|
159
|
+
showAllEditors(type: any, visible: any, updateButton?: boolean): void;
|
|
160
|
+
enableWaiting(mustWait?: boolean): void;
|
|
161
|
+
/**
|
|
162
|
+
* Get all the editors belonging to a given page.
|
|
163
|
+
* @param {number} pageIndex
|
|
164
|
+
* @returns {Array<AnnotationEditor>}
|
|
165
|
+
*/
|
|
166
|
+
getEditors(pageIndex: number): Array<AnnotationEditor>;
|
|
167
|
+
/**
|
|
168
|
+
* Get an editor with the given id.
|
|
169
|
+
* @param {string} id
|
|
170
|
+
* @returns {AnnotationEditor}
|
|
171
|
+
*/
|
|
172
|
+
getEditor(id: string): AnnotationEditor;
|
|
173
|
+
/**
|
|
174
|
+
* Add a new editor.
|
|
175
|
+
* @param {AnnotationEditor} editor
|
|
176
|
+
*/
|
|
177
|
+
addEditor(editor: AnnotationEditor): void;
|
|
178
|
+
/**
|
|
179
|
+
* Remove an editor.
|
|
180
|
+
* @param {AnnotationEditor} editor
|
|
181
|
+
*/
|
|
182
|
+
removeEditor(editor: AnnotationEditor): void;
|
|
183
|
+
/**
|
|
184
|
+
* The annotation element with the given id has been deleted.
|
|
185
|
+
* @param {AnnotationEditor} editor
|
|
186
|
+
*/
|
|
187
|
+
addDeletedAnnotationElement(editor: AnnotationEditor): void;
|
|
188
|
+
/**
|
|
189
|
+
* Check if the annotation element with the given id has been deleted.
|
|
190
|
+
* @param {string} annotationElementId
|
|
191
|
+
* @returns {boolean}
|
|
192
|
+
*/
|
|
193
|
+
isDeletedAnnotationElement(annotationElementId: string): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* The annotation element with the given id have been restored.
|
|
196
|
+
* @param {AnnotationEditor} editor
|
|
197
|
+
*/
|
|
198
|
+
removeDeletedAnnotationElement(editor: AnnotationEditor): void;
|
|
199
|
+
/**
|
|
200
|
+
* Set the given editor as the active one.
|
|
201
|
+
* @param {AnnotationEditor} editor
|
|
202
|
+
*/
|
|
203
|
+
setActiveEditor(editor: AnnotationEditor): void;
|
|
204
|
+
/**
|
|
205
|
+
* Update the UI of the active editor.
|
|
206
|
+
* @param {AnnotationEditor} editor
|
|
207
|
+
*/
|
|
208
|
+
updateUI(editor: AnnotationEditor): void;
|
|
209
|
+
updateUIForDefaultProperties(editorType: any): void;
|
|
210
|
+
/**
|
|
211
|
+
* Add or remove an editor the current selection.
|
|
212
|
+
* @param {AnnotationEditor} editor
|
|
213
|
+
*/
|
|
214
|
+
toggleSelected(editor: AnnotationEditor): void;
|
|
215
|
+
/**
|
|
216
|
+
* Set the last selected editor.
|
|
217
|
+
* @param {AnnotationEditor} editor
|
|
218
|
+
*/
|
|
219
|
+
setSelected(editor: AnnotationEditor): void;
|
|
220
|
+
/**
|
|
221
|
+
* Check if the editor is selected.
|
|
222
|
+
* @param {AnnotationEditor} editor
|
|
223
|
+
*/
|
|
224
|
+
isSelected(editor: AnnotationEditor): boolean;
|
|
225
|
+
get firstSelectedEditor(): any;
|
|
226
|
+
/**
|
|
227
|
+
* Unselect an editor.
|
|
228
|
+
* @param {AnnotationEditor} editor
|
|
229
|
+
*/
|
|
230
|
+
unselect(editor: AnnotationEditor): void;
|
|
231
|
+
get hasSelection(): boolean;
|
|
232
|
+
get isEnterHandled(): any;
|
|
233
|
+
/**
|
|
234
|
+
* Undo the last command.
|
|
235
|
+
*/
|
|
236
|
+
undo(): void;
|
|
237
|
+
/**
|
|
238
|
+
* Redo the last undoed command.
|
|
239
|
+
*/
|
|
240
|
+
redo(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Add a command to execute (cmd) and another one to undo it.
|
|
243
|
+
* @param {Object} params
|
|
244
|
+
*/
|
|
245
|
+
addCommands(params: Object): void;
|
|
246
|
+
cleanUndoStack(type: any): void;
|
|
247
|
+
/**
|
|
248
|
+
* Delete the current editor or all.
|
|
249
|
+
*/
|
|
250
|
+
delete(): void;
|
|
251
|
+
commitOrRemove(): void;
|
|
252
|
+
hasSomethingToControl(): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Select all the editors.
|
|
255
|
+
*/
|
|
256
|
+
selectAll(): void;
|
|
257
|
+
/**
|
|
258
|
+
* Unselect all the selected editors.
|
|
259
|
+
*/
|
|
260
|
+
unselectAll(): void;
|
|
261
|
+
translateSelectedEditors(x: any, y: any, noCommit?: boolean): void;
|
|
262
|
+
/**
|
|
263
|
+
* Set up the drag session for moving the selected editors.
|
|
264
|
+
*/
|
|
265
|
+
setUpDragSession(): void;
|
|
266
|
+
/**
|
|
267
|
+
* Ends the drag session.
|
|
268
|
+
* @returns {boolean} true if at least one editor has been moved.
|
|
269
|
+
*/
|
|
270
|
+
endDragSession(): boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Drag the set of selected editors.
|
|
273
|
+
* @param {number} tx
|
|
274
|
+
* @param {number} ty
|
|
275
|
+
*/
|
|
276
|
+
dragSelectedEditors(tx: number, ty: number): void;
|
|
277
|
+
/**
|
|
278
|
+
* Rebuild the editor (usually on undo/redo actions) on a potentially
|
|
279
|
+
* non-rendered page.
|
|
280
|
+
* @param {AnnotationEditor} editor
|
|
281
|
+
*/
|
|
282
|
+
rebuild(editor: AnnotationEditor): void;
|
|
283
|
+
get isEditorHandlingKeyboard(): any;
|
|
284
|
+
/**
|
|
285
|
+
* Is the current editor the one passed as argument?
|
|
286
|
+
* @param {AnnotationEditor} editor
|
|
287
|
+
* @returns
|
|
288
|
+
*/
|
|
289
|
+
isActive(editor: AnnotationEditor): editor is never;
|
|
290
|
+
/**
|
|
291
|
+
* Get the current active editor.
|
|
292
|
+
* @returns {AnnotationEditor|null}
|
|
293
|
+
*/
|
|
294
|
+
getActive(): AnnotationEditor | null;
|
|
295
|
+
/**
|
|
296
|
+
* Get the current editor mode.
|
|
297
|
+
* @returns {number}
|
|
298
|
+
*/
|
|
299
|
+
getMode(): number;
|
|
300
|
+
get imageManager(): any;
|
|
301
|
+
getSelectionBoxes(textLayer: any): {
|
|
302
|
+
x: number;
|
|
303
|
+
y: number;
|
|
304
|
+
width: number;
|
|
305
|
+
height: number;
|
|
306
|
+
}[] | null;
|
|
307
|
+
addChangedExistingAnnotation({ annotationElementId, id }: {
|
|
308
|
+
annotationElementId: any;
|
|
309
|
+
id: any;
|
|
310
|
+
}): void;
|
|
311
|
+
removeChangedExistingAnnotation({ annotationElementId }: {
|
|
312
|
+
annotationElementId: any;
|
|
313
|
+
}): void;
|
|
314
|
+
renderAnnotationElement(annotation: any): void;
|
|
315
|
+
setMissingCanvas(annotationId: any, annotationElementId: any, canvas: any): void;
|
|
316
|
+
addMissingCanvas(annotationId: any, editor: any): void;
|
|
317
|
+
#private;
|
|
318
|
+
}
|
|
319
|
+
export function bindEvents(obj: any, element: any, names: any): void;
|
|
320
|
+
export class ColorManager {
|
|
321
|
+
static _colorsMapping: Map<string, number[]>;
|
|
322
|
+
get _colors(): any;
|
|
323
|
+
/**
|
|
324
|
+
* In High Contrast Mode, the color on the screen is not always the
|
|
325
|
+
* real color used in the pdf.
|
|
326
|
+
* For example in some cases white can appear to be black but when saving
|
|
327
|
+
* we want to have white.
|
|
328
|
+
* @param {string} color
|
|
329
|
+
* @returns {Array<number>}
|
|
330
|
+
*/
|
|
331
|
+
convert(color: string): Array<number>;
|
|
332
|
+
/**
|
|
333
|
+
* An input element must have its color value as a hex string
|
|
334
|
+
* and not as color name.
|
|
335
|
+
* So this function converts a name into an hex string.
|
|
336
|
+
* @param {string} name
|
|
337
|
+
* @returns {string}
|
|
338
|
+
*/
|
|
339
|
+
getHexCode(name: string): string;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Class to handle undo/redo.
|
|
343
|
+
* Commands are just saved in a buffer.
|
|
344
|
+
* If we hit some memory issues we could likely use a circular buffer.
|
|
345
|
+
* It has to be used as a singleton.
|
|
346
|
+
*/
|
|
347
|
+
export class CommandManager {
|
|
348
|
+
constructor(maxSize?: number);
|
|
349
|
+
/**
|
|
350
|
+
* @typedef {Object} addOptions
|
|
351
|
+
* @property {function} cmd
|
|
352
|
+
* @property {function} undo
|
|
353
|
+
* @property {function} [post]
|
|
354
|
+
* @property {boolean} mustExec
|
|
355
|
+
* @property {number} type
|
|
356
|
+
* @property {boolean} overwriteIfSameType
|
|
357
|
+
* @property {boolean} keepUndo
|
|
358
|
+
*/
|
|
359
|
+
/**
|
|
360
|
+
* Add a new couple of commands to be used in case of redo/undo.
|
|
361
|
+
* @param {addOptions} options
|
|
362
|
+
*/
|
|
363
|
+
add({ cmd, undo, post, mustExec, type, overwriteIfSameType, keepUndo, }: {
|
|
364
|
+
cmd: Function;
|
|
365
|
+
undo: Function;
|
|
366
|
+
post?: Function | undefined;
|
|
367
|
+
mustExec: boolean;
|
|
368
|
+
type: number;
|
|
369
|
+
overwriteIfSameType: boolean;
|
|
370
|
+
keepUndo: boolean;
|
|
371
|
+
}): void;
|
|
372
|
+
/**
|
|
373
|
+
* Undo the last command.
|
|
374
|
+
*/
|
|
375
|
+
undo(): void;
|
|
376
|
+
/**
|
|
377
|
+
* Redo the last command.
|
|
378
|
+
*/
|
|
379
|
+
redo(): void;
|
|
380
|
+
/**
|
|
381
|
+
* Check if there is something to undo.
|
|
382
|
+
* @returns {boolean}
|
|
383
|
+
*/
|
|
384
|
+
hasSomethingToUndo(): boolean;
|
|
385
|
+
/**
|
|
386
|
+
* Check if there is something to redo.
|
|
387
|
+
* @returns {boolean}
|
|
388
|
+
*/
|
|
389
|
+
hasSomethingToRedo(): boolean;
|
|
390
|
+
cleanType(type: any): void;
|
|
391
|
+
destroy(): void;
|
|
392
|
+
#private;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Class to handle the different keyboards shortcuts we can have on mac or
|
|
396
|
+
* non-mac OSes.
|
|
397
|
+
*/
|
|
398
|
+
export class KeyboardManager {
|
|
399
|
+
/**
|
|
400
|
+
* Create a new keyboard manager class.
|
|
401
|
+
* @param {Array<Array>} callbacks - an array containing an array of shortcuts
|
|
402
|
+
* and a callback to call.
|
|
403
|
+
* A shortcut is a string like `ctrl+c` or `mac+ctrl+c` for mac OS.
|
|
404
|
+
*/
|
|
405
|
+
constructor(callbacks: Array<any[]>);
|
|
406
|
+
buffer: any[];
|
|
407
|
+
callbacks: Map<any, any>;
|
|
408
|
+
allKeys: Set<any>;
|
|
409
|
+
/**
|
|
410
|
+
* Execute a callback, if any, for a given keyboard event.
|
|
411
|
+
* The self is used as `this` in the callback.
|
|
412
|
+
* @param {Object} self
|
|
413
|
+
* @param {KeyboardEvent} event
|
|
414
|
+
* @returns
|
|
415
|
+
*/
|
|
416
|
+
exec(self: Object, event: KeyboardEvent): void;
|
|
417
|
+
#private;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Convert a number between 0 and 100 into an hex number between 0 and 255.
|
|
421
|
+
* @param {number} opacity
|
|
422
|
+
* @return {string}
|
|
423
|
+
*/
|
|
424
|
+
export function opacityToHex(opacity: number): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export class BaseFilterFactory {
|
|
2
|
+
addFilter(maps: any): string;
|
|
3
|
+
addHCMFilter(fgColor: any, bgColor: any): string;
|
|
4
|
+
addAlphaFilter(map: any): string;
|
|
5
|
+
addLuminosityFilter(map: any): string;
|
|
6
|
+
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
|
|
7
|
+
destroy(keepHCM?: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* FilterFactory aims to create some SVG filters we can use when drawing an
|
|
11
|
+
* image (or whatever) on a canvas.
|
|
12
|
+
* Filters aren't applied with ctx.putImageData because it just overwrites the
|
|
13
|
+
* underlying pixels.
|
|
14
|
+
* With these filters, it's possible for example to apply some transfer maps on
|
|
15
|
+
* an image without the need to apply them on the pixel arrays: the renderer
|
|
16
|
+
* does the magic for us.
|
|
17
|
+
*/
|
|
18
|
+
export class DOMFilterFactory extends BaseFilterFactory {
|
|
19
|
+
constructor({ docId, ownerDocument }: {
|
|
20
|
+
docId: any;
|
|
21
|
+
ownerDocument?: Document | undefined;
|
|
22
|
+
});
|
|
23
|
+
addFilter(maps: any): any;
|
|
24
|
+
addHCMFilter(fgColor: any, bgColor: any): any;
|
|
25
|
+
addAlphaFilter(map: any): any;
|
|
26
|
+
addLuminosityFilter(map: any): any;
|
|
27
|
+
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
|
|
28
|
+
#private;
|
|
29
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export class FontFaceObject {
|
|
2
|
+
constructor(translatedData: any, inspectFont?: null);
|
|
3
|
+
compiledGlyphs: any;
|
|
4
|
+
_inspectFont: any;
|
|
5
|
+
createNativeFontFace(): FontFace | null;
|
|
6
|
+
createFontFaceRule(): string | null;
|
|
7
|
+
getPathGenerator(objs: any, character: any): any;
|
|
8
|
+
}
|
|
9
|
+
export class FontLoader {
|
|
10
|
+
constructor({ ownerDocument, styleElement, }: {
|
|
11
|
+
ownerDocument?: Document | undefined;
|
|
12
|
+
styleElement?: null | undefined;
|
|
13
|
+
});
|
|
14
|
+
_document: Document;
|
|
15
|
+
nativeFontFaces: Set<any>;
|
|
16
|
+
styleElement: HTMLStyleElement | null;
|
|
17
|
+
loadingRequests: any[] | undefined;
|
|
18
|
+
loadTestFontId: number | undefined;
|
|
19
|
+
addNativeFontFace(nativeFontFace: any): void;
|
|
20
|
+
removeNativeFontFace(nativeFontFace: any): void;
|
|
21
|
+
insertRule(rule: any): void;
|
|
22
|
+
clear(): void;
|
|
23
|
+
loadSystemFont({ systemFontInfo: info, disableFontFace, _inspectFont, }: {
|
|
24
|
+
systemFontInfo: any;
|
|
25
|
+
disableFontFace: any;
|
|
26
|
+
_inspectFont: any;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
bind(font: any): Promise<void>;
|
|
29
|
+
get isFontLoadingAPISupported(): any;
|
|
30
|
+
get isSyncFontLoadingSupported(): any;
|
|
31
|
+
_queueLoadingCallback(callback: any): {
|
|
32
|
+
done: boolean;
|
|
33
|
+
complete: () => void;
|
|
34
|
+
callback: any;
|
|
35
|
+
};
|
|
36
|
+
get _loadTestFont(): any;
|
|
37
|
+
_prepareFontLoadEvent(font: any, request: any): void;
|
|
38
|
+
#private;
|
|
39
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function fetchData(url: any): Promise<Uint8Array<ArrayBuffer>>;
|
|
2
|
+
export class NodeCanvasFactory extends BaseCanvasFactory {
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
_createCanvas(width: any, height: any): import("@napi-rs/canvas").Canvas;
|
|
7
|
+
}
|
|
8
|
+
export class NodeCMapReaderFactory extends BaseCMapReaderFactory {
|
|
9
|
+
/**
|
|
10
|
+
* @ignore
|
|
11
|
+
*/
|
|
12
|
+
_fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
|
|
13
|
+
}
|
|
14
|
+
export class NodeFilterFactory extends BaseFilterFactory {
|
|
15
|
+
}
|
|
16
|
+
export class NodeStandardFontDataFactory extends BaseStandardFontDataFactory {
|
|
17
|
+
/**
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
_fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
|
|
21
|
+
}
|
|
22
|
+
export class NodeWasmFactory extends BaseWasmFactory {
|
|
23
|
+
/**
|
|
24
|
+
* @ignore
|
|
25
|
+
*/
|
|
26
|
+
_fetch(url: any): Promise<Uint8Array<ArrayBuffer>>;
|
|
27
|
+
}
|
|
28
|
+
import { BaseCanvasFactory } from "./canvas_factory.js";
|
|
29
|
+
import { BaseCMapReaderFactory } from "./cmap_reader_factory.js";
|
|
30
|
+
import { BaseFilterFactory } from "./filter_factory.js";
|
|
31
|
+
import { BaseStandardFontDataFactory } from "./standard_fontdata_factory.js";
|
|
32
|
+
import { BaseWasmFactory } from "./wasm_factory.js";
|