unpdf 0.12.2 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +147 -79
  2. package/dist/index.cjs +119 -74
  3. package/dist/index.d.cts +24 -41
  4. package/dist/index.d.mts +24 -41
  5. package/dist/index.d.ts +24 -41
  6. package/dist/index.mjs +118 -73
  7. package/dist/pdfjs.mjs +1 -1
  8. package/dist/types/src/display/annotation_layer.d.ts +25 -1
  9. package/dist/types/src/display/annotation_storage.d.ts +1 -8
  10. package/dist/types/src/display/api.d.ts +147 -57
  11. package/dist/types/src/display/canvas.d.ts +21 -28
  12. package/dist/types/src/display/canvas_factory.d.ts +27 -0
  13. package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
  14. package/dist/types/src/display/display_utils.d.ts +40 -60
  15. package/dist/types/src/display/draw_layer.d.ts +7 -19
  16. package/dist/types/src/display/editor/alt_text.d.ts +3 -2
  17. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -11
  18. package/dist/types/src/display/editor/color_picker.d.ts +1 -0
  19. package/dist/types/src/display/editor/draw.d.ts +121 -0
  20. package/dist/types/src/display/editor/drawers/contour.d.ts +3 -0
  21. package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
  22. package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
  23. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +129 -0
  24. package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
  25. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +79 -0
  26. package/dist/types/src/display/editor/editor.d.ts +55 -13
  27. package/dist/types/src/display/editor/freetext.d.ts +5 -16
  28. package/dist/types/src/display/editor/highlight.d.ts +8 -25
  29. package/dist/types/src/display/editor/ink.d.ts +21 -74
  30. package/dist/types/src/display/editor/signature.d.ts +80 -0
  31. package/dist/types/src/display/editor/stamp.d.ts +16 -22
  32. package/dist/types/src/display/editor/toolbar.d.ts +5 -2
  33. package/dist/types/src/display/editor/tools.d.ts +17 -9
  34. package/dist/types/src/display/fetch_stream.d.ts +6 -13
  35. package/dist/types/src/display/filter_factory.d.ts +29 -0
  36. package/dist/types/src/display/font_loader.d.ts +3 -6
  37. package/dist/types/src/display/metadata.d.ts +1 -2
  38. package/dist/types/src/display/network.d.ts +11 -7
  39. package/dist/types/src/display/network_utils.d.ts +7 -6
  40. package/dist/types/src/display/node_stream.d.ts +6 -22
  41. package/dist/types/src/display/node_utils.d.ts +15 -11
  42. package/dist/types/src/display/optional_content_config.d.ts +2 -2
  43. package/dist/types/src/display/pattern_helper.d.ts +4 -2
  44. package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
  45. package/dist/types/src/display/svg_factory.d.ts +14 -0
  46. package/dist/types/src/display/text_layer.d.ts +12 -9
  47. package/dist/types/src/display/touch_manager.d.ts +18 -0
  48. package/dist/types/src/display/transport_stream.d.ts +1 -1
  49. package/dist/types/src/display/wasm_factory.d.ts +20 -0
  50. package/dist/types/src/display/worker_options.d.ts +2 -2
  51. package/dist/types/src/interfaces.d.ts +4 -0
  52. package/dist/types/src/pdf.d.ts +13 -5
  53. package/dist/types/src/shared/message_handler.d.ts +9 -4
  54. package/dist/types/src/shared/util.d.ts +137 -129
  55. package/dist/types/web/annotation_editor_layer_builder.d.ts +20 -5
  56. package/dist/types/web/annotation_layer_builder.d.ts +35 -4
  57. package/dist/types/web/app_options.d.ts +1 -1
  58. package/dist/types/web/autolinker.d.ts +28 -0
  59. package/dist/types/web/base_pdf_page_view.d.ts +27 -0
  60. package/dist/types/web/draw_layer_builder.d.ts +13 -2
  61. package/dist/types/web/event_utils.d.ts +2 -2
  62. package/dist/types/web/genericl10n.d.ts +5 -5
  63. package/dist/types/web/interfaces.d.ts +5 -5
  64. package/dist/types/web/l10n.d.ts +2 -2
  65. package/dist/types/web/pdf_find_controller.d.ts +2 -0
  66. package/dist/types/web/pdf_link_service.d.ts +1 -2
  67. package/dist/types/web/pdf_page_detail_view.d.ts +32 -0
  68. package/dist/types/web/pdf_page_view.d.ts +44 -23
  69. package/dist/types/web/pdf_rendering_queue.d.ts +2 -1
  70. package/dist/types/web/pdf_thumbnail_view.d.ts +23 -3
  71. package/dist/types/web/pdf_thumbnail_viewer.d.ts +21 -1
  72. package/dist/types/web/pdf_viewer.d.ts +44 -16
  73. package/dist/types/web/struct_tree_layer_builder.d.ts +20 -2
  74. package/dist/types/web/text_accessibility.d.ts +1 -1
  75. package/dist/types/web/text_layer_builder.d.ts +25 -17
  76. package/dist/types/web/ui_utils.d.ts +3 -19
  77. package/dist/types/web/xfa_layer_builder.d.ts +14 -3
  78. package/package.json +31 -28
  79. package/dist/types/src/display/base_factory.d.ts +0 -60
  80. package/dist/types/src/display/editor/outliner.d.ts +0 -70
@@ -4,6 +4,10 @@ export type PageViewportParameters = {
4
4
  * yMax coordinates.
5
5
  */
6
6
  viewBox: Array<number>;
7
+ /**
8
+ * - The size of units.
9
+ */
10
+ userUnit: number;
7
11
  /**
8
12
  * - The scale of the viewport.
9
13
  */
@@ -56,59 +60,6 @@ export type PageViewportCloneParameters = {
56
60
  dontFlip?: boolean | undefined;
57
61
  };
58
62
  export function deprecated(details: any): void;
59
- export class DOMCanvasFactory extends BaseCanvasFactory {
60
- constructor({ ownerDocument, enableHWA }?: {
61
- ownerDocument?: Document | undefined;
62
- enableHWA?: boolean | undefined;
63
- });
64
- _document: Document;
65
- /**
66
- * @ignore
67
- */
68
- _createCanvas(width: any, height: any): HTMLCanvasElement;
69
- }
70
- export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
71
- /**
72
- * @ignore
73
- */
74
- _fetchData(url: any, compressionType: any): Promise<{
75
- cMapData: Uint8Array;
76
- compressionType: any;
77
- }>;
78
- }
79
- /**
80
- * FilterFactory aims to create some SVG filters we can use when drawing an
81
- * image (or whatever) on a canvas.
82
- * Filters aren't applied with ctx.putImageData because it just overwrites the
83
- * underlying pixels.
84
- * With these filters, it's possible for example to apply some transfer maps on
85
- * an image without the need to apply them on the pixel arrays: the renderer
86
- * does the magic for us.
87
- */
88
- export class DOMFilterFactory extends BaseFilterFactory {
89
- constructor({ docId, ownerDocument }?: {
90
- docId: any;
91
- ownerDocument?: Document | undefined;
92
- });
93
- addFilter(maps: any): any;
94
- addHCMFilter(fgColor: any, bgColor: any): any;
95
- addAlphaFilter(map: any): any;
96
- addLuminosityFilter(map: any): any;
97
- addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
98
- #private;
99
- }
100
- export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
101
- /**
102
- * @ignore
103
- */
104
- _fetchData(url: any): Promise<Uint8Array>;
105
- }
106
- export class DOMSVGFactory extends BaseSVGFactory {
107
- /**
108
- * @ignore
109
- */
110
- _createSVG(type: any): any;
111
- }
112
63
  export function fetchData(url: any, type?: string): Promise<any>;
113
64
  export function getColorValues(colors: any): void;
114
65
  export function getCurrentTransform(ctx: any): any[];
@@ -142,10 +93,39 @@ export function isValidFetchUrl(url: any, baseUrl: any): boolean;
142
93
  * Event handler to suppress context menu.
143
94
  */
144
95
  export function noContextMenu(e: any): void;
96
+ /**
97
+ * Scale factors for the canvas, necessary with HiDPI displays.
98
+ */
99
+ export class OutputScale {
100
+ static get pixelRatio(): number;
101
+ /**
102
+ * @type {number} Horizontal scale.
103
+ */
104
+ sx: number;
105
+ /**
106
+ * @type {number} Vertical scale.
107
+ */
108
+ sy: number;
109
+ /**
110
+ * @type {boolean} Returns `true` when scaling is required, `false` otherwise.
111
+ */
112
+ get scaled(): boolean;
113
+ /**
114
+ * @type {boolean} Returns `true` when scaling is symmetric,
115
+ * `false` otherwise.
116
+ */
117
+ get symmetric(): boolean;
118
+ /**
119
+ * @returns {boolean} Returns `true` if scaling was limited,
120
+ * `false` otherwise.
121
+ */
122
+ limitCanvas(width: any, height: any, maxPixels: any, maxDim: any): boolean;
123
+ }
145
124
  /**
146
125
  * @typedef {Object} PageViewportParameters
147
126
  * @property {Array<number>} viewBox - The xMin, yMin, xMax and
148
127
  * yMax coordinates.
128
+ * @property {number} userUnit - The size of units.
149
129
  * @property {number} scale - The scale of the viewport.
150
130
  * @property {number} rotation - The rotation, in degrees, of the viewport.
151
131
  * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The
@@ -175,8 +155,9 @@ export class PageViewport {
175
155
  /**
176
156
  * @param {PageViewportParameters}
177
157
  */
178
- constructor({ viewBox, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
158
+ constructor({ viewBox, userUnit, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
179
159
  viewBox: number[];
160
+ userUnit: number;
180
161
  scale: number;
181
162
  rotation: number;
182
163
  offsetX: number;
@@ -194,7 +175,7 @@ export class PageViewport {
194
175
  * @param {PageViewportCloneParameters} [params]
195
176
  * @returns {PageViewport} Cloned viewport.
196
177
  */
197
- clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters | undefined): PageViewport;
178
+ clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters): PageViewport;
198
179
  /**
199
180
  * Converts PDF point to the viewport coordinates. For examples, useful for
200
181
  * converting PDF location into canvas pixel coordinates.
@@ -226,6 +207,7 @@ export class PageViewport {
226
207
  convertToPdfPoint(x: number, y: number): any[];
227
208
  }
228
209
  export class PDFDateString {
210
+ static "__#2@#regex": any;
229
211
  /**
230
212
  * Convert a PDF date string to a JavaScript `Date` object.
231
213
  *
@@ -269,9 +251,7 @@ export class StatTimer {
269
251
  timeEnd(name: any): void;
270
252
  toString(): string;
271
253
  }
272
- import { BaseCanvasFactory } from "./base_factory.js";
273
- import { BaseCMapReaderFactory } from "./base_factory.js";
274
- import { BaseFilterFactory } from "./base_factory.js";
275
- import { BaseStandardFontDataFactory } from "./base_factory.js";
276
- import { BaseSVGFactory } from "./base_factory.js";
254
+ export function stopEvent(e: any): void;
255
+ export const SupportedImageMimeTypes: string[];
256
+ export const SVG_NS: "http://www.w3.org/2000/svg";
277
257
  export {};
@@ -4,34 +4,22 @@
4
4
  * be able to use mix-blend-mode for some of them.
5
5
  */
6
6
  export class DrawLayer {
7
+ static "__#33@#id": number;
7
8
  static get _svgFactory(): any;
8
- static "__#27@#setBox"(element: any, { x, y, width, height }?: {
9
- x?: number | undefined;
10
- y?: number | undefined;
11
- width?: number | undefined;
12
- height?: number | undefined;
13
- }): void;
9
+ static "__#33@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
14
10
  constructor({ pageIndex }: {
15
11
  pageIndex: any;
16
12
  });
17
13
  pageIndex: any;
18
14
  setParent(parent: any): void;
19
- highlight(outlines: any, color: any, opacity: any, isPathUpdatable?: boolean): {
15
+ draw(properties: any, isPathUpdatable?: boolean, hasClip?: boolean): {
20
16
  id: number;
21
17
  clipPathId: string;
22
18
  };
23
- highlightOutline(outlines: any): number;
24
- finalizeLine(id: any, line: any): void;
25
- updateLine(id: any, line: any): void;
26
- removeFreeHighlight(id: any): void;
27
- updatePath(id: any, line: any): void;
28
- updateBox(id: any, box: any): void;
29
- show(id: any, visible: any): void;
30
- rotate(id: any, angle: any): void;
31
- changeColor(id: any, color: any): void;
32
- changeOpacity(id: any, opacity: any): void;
33
- addClass(id: any, className: any): void;
34
- removeClass(id: any, className: any): void;
19
+ drawOutline(properties: any, mustRemoveSelfIntersections: any): number;
20
+ finalizeDraw(id: any, properties: any): void;
21
+ updateProperties(elementOrId: any, properties: any): void;
22
+ updateParent(id: any, layer: any): void;
35
23
  remove(id: any): void;
36
24
  destroy(): void;
37
25
  #private;
@@ -1,6 +1,7 @@
1
1
  export class AltText {
2
- static _l10nPromise: null;
3
- static initialize(l10nPromise: any): void;
2
+ static "__#40@#l10nNewButton": null;
3
+ static _l10n: null;
4
+ static initialize(l10n: any): void;
4
5
  constructor(editor: any);
5
6
  render(): Promise<HTMLButtonElement>;
6
7
  finish(): void;
@@ -4,9 +4,11 @@ export type TextAccessibilityManager = import("../../../web/text_accessibility.j
4
4
  export type IL10n = import("../../../web/interfaces").IL10n;
5
5
  export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
6
6
  export type DrawLayer = import("../draw_layer.js").DrawLayer;
7
+ export type StructTreeLayerBuilder = any;
7
8
  export type AnnotationEditorLayerOptions = {
8
9
  mode: Object;
9
10
  div: HTMLDivElement;
11
+ structTreeLayer: StructTreeLayerBuilder;
10
12
  uiManager: AnnotationEditorUIManager;
11
13
  enabled: boolean;
12
14
  accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined;
@@ -24,6 +26,7 @@ export type RenderEditorLayerOptions = {
24
26
  * @typedef {Object} AnnotationEditorLayerOptions
25
27
  * @property {Object} mode
26
28
  * @property {HTMLDivElement} div
29
+ * @property {StructTreeLayerBuilder} structTreeLayer
27
30
  * @property {AnnotationEditorUIManager} uiManager
28
31
  * @property {boolean} enabled
29
32
  * @property {TextAccessibilityManager} [accessibilityManager]
@@ -43,15 +46,16 @@ export type RenderEditorLayerOptions = {
43
46
  */
44
47
  export class AnnotationEditorLayer {
45
48
  static _initialized: boolean;
46
- static "__#28@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof StampEditor>;
49
+ static "__#34@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
47
50
  /**
48
51
  * @param {AnnotationEditorLayerOptions} options
49
52
  */
50
- constructor({ uiManager, pageIndex, div, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
53
+ constructor({ uiManager, pageIndex, div, structTreeLayer, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
51
54
  pageIndex: number;
52
55
  div: HTMLDivElement;
53
56
  viewport: import("../display_utils.js").PageViewport;
54
57
  drawLayer: import("../draw_layer.js").DrawLayer;
58
+ _structTree: any;
55
59
  get isEmpty(): boolean;
56
60
  get isInvisible(): boolean;
57
61
  /**
@@ -65,7 +69,6 @@ export class AnnotationEditorLayer {
65
69
  */
66
70
  updateMode(mode?: number): void;
67
71
  hasTextLayer(textLayer: any): boolean;
68
- addInkEditorIfNeeded(isCommitting: any): void;
69
72
  /**
70
73
  * Set the editing state.
71
74
  * @param {boolean} isEditing
@@ -76,6 +79,7 @@ export class AnnotationEditorLayer {
76
79
  * @param {Object} params
77
80
  */
78
81
  addCommands(params: Object): void;
82
+ cleanUndoStack(type: any): void;
79
83
  toggleDrawing(enabled?: boolean): void;
80
84
  togglePointerEvents(enabled?: boolean): void;
81
85
  toggleAnnotationLayerPointerEvents(enabled?: boolean): void;
@@ -83,7 +87,7 @@ export class AnnotationEditorLayer {
83
87
  * Enable pointer events on the main div in order to enable
84
88
  * editor creation.
85
89
  */
86
- enable(): void;
90
+ enable(): Promise<void>;
87
91
  /**
88
92
  * Disable editor creation.
89
93
  */
@@ -139,7 +143,7 @@ export class AnnotationEditorLayer {
139
143
  * @param {number} mode
140
144
  * @param {Object} params
141
145
  */
142
- pasteEditor(mode: number, params: Object): void;
146
+ pasteEditor(mode: number, params: Object): Promise<void>;
143
147
  /**
144
148
  * Create a new editor
145
149
  * @param {Object} data
@@ -157,7 +161,7 @@ export class AnnotationEditorLayer {
157
161
  /**
158
162
  * Create and add a new editor.
159
163
  */
160
- addNewEditor(): void;
164
+ addNewEditor(data?: {}): void;
161
165
  /**
162
166
  * Set the last selected editor.
163
167
  * @param {AnnotationEditor} editor
@@ -168,11 +172,6 @@ export class AnnotationEditorLayer {
168
172
  * @param {AnnotationEditor} editor
169
173
  */
170
174
  toggleSelected(editor: AnnotationEditor): void;
171
- /**
172
- * Check if the editor is selected.
173
- * @param {AnnotationEditor} editor
174
- */
175
- isSelected(editor: AnnotationEditor): boolean;
176
175
  /**
177
176
  * Unselect an editor.
178
177
  * @param {AnnotationEditor} editor
@@ -188,6 +187,9 @@ export class AnnotationEditorLayer {
188
187
  * @param {PointerEvent} event
189
188
  */
190
189
  pointerdown(event: PointerEvent): void;
190
+ startDrawingSession(event: any): void;
191
+ pause(on: any): void;
192
+ endDrawingSession(isAborted?: boolean): any;
191
193
  /**
192
194
  *
193
195
  * @param {AnnotationEditor} editor
@@ -196,6 +198,8 @@ export class AnnotationEditorLayer {
196
198
  * @returns
197
199
  */
198
200
  findNewParent(editor: AnnotationEditor, x: number, y: number): boolean;
201
+ commitOrRemove(): boolean;
202
+ onScaleChanging(): void;
199
203
  /**
200
204
  * Destroy the main editor.
201
205
  */
@@ -222,4 +226,5 @@ import { AnnotationEditor } from "./editor.js";
222
226
  import { FreeTextEditor } from "./freetext.js";
223
227
  import { HighlightEditor } from "./highlight.js";
224
228
  import { InkEditor } from "./ink.js";
229
+ import { SignatureEditor } from "./signature.js";
225
230
  import { StampEditor } from "./stamp.js";
@@ -1,4 +1,5 @@
1
1
  export class ColorPicker {
2
+ static "__#23@#l10nColor": null;
2
3
  static get _keyboardManager(): any;
3
4
  constructor({ editor, uiManager }: {
4
5
  editor?: null | undefined;
@@ -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,3 @@
1
+ export class ContourDrawOutline extends InkDrawOutline {
2
+ }
3
+ import { InkDrawOutline } from "./inkdraw.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
+ }