pdfjs-serverless 0.7.0 → 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 (54) hide show
  1. package/README.md +66 -82
  2. package/dist/index.d.mts +17 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/types/src/display/annotation_layer.d.ts +14 -0
  5. package/dist/types/src/display/annotation_storage.d.ts +1 -8
  6. package/dist/types/src/display/api.d.ts +80 -34
  7. package/dist/types/src/display/canvas.d.ts +19 -27
  8. package/dist/types/src/display/display_utils.d.ts +11 -0
  9. package/dist/types/src/display/draw_layer.d.ts +2 -1
  10. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  11. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +4 -3
  12. package/dist/types/src/display/editor/draw.d.ts +2 -1
  13. package/dist/types/src/display/editor/drawers/contour.d.ts +3 -0
  14. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +2 -1
  15. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +79 -0
  16. package/dist/types/src/display/editor/editor.d.ts +5 -2
  17. package/dist/types/src/display/editor/highlight.d.ts +1 -0
  18. package/dist/types/src/display/editor/ink.d.ts +8 -2
  19. package/dist/types/src/display/editor/signature.d.ts +80 -0
  20. package/dist/types/src/display/editor/stamp.d.ts +3 -5
  21. package/dist/types/src/display/editor/toolbar.d.ts +2 -0
  22. package/dist/types/src/display/editor/tools.d.ts +5 -7
  23. package/dist/types/src/display/font_loader.d.ts +3 -8
  24. package/dist/types/src/display/metadata.d.ts +1 -2
  25. package/dist/types/src/display/network.d.ts +1 -1
  26. package/dist/types/src/display/network_utils.d.ts +2 -3
  27. package/dist/types/src/display/node_utils.d.ts +7 -0
  28. package/dist/types/src/display/optional_content_config.d.ts +1 -1
  29. package/dist/types/src/display/pattern_helper.d.ts +4 -2
  30. package/dist/types/src/display/text_layer.d.ts +9 -9
  31. package/dist/types/src/display/touch_manager.d.ts +5 -1
  32. package/dist/types/src/display/wasm_factory.d.ts +20 -0
  33. package/dist/types/src/display/worker_options.d.ts +2 -2
  34. package/dist/types/src/pdf.d.ts +9 -3
  35. package/dist/types/src/shared/message_handler.d.ts +2 -3
  36. package/dist/types/src/shared/util.d.ts +128 -109
  37. package/dist/types/web/annotation_editor_layer_builder.d.ts +15 -3
  38. package/dist/types/web/annotation_layer_builder.d.ts +35 -5
  39. package/dist/types/web/autolinker.d.ts +28 -0
  40. package/dist/types/web/base_pdf_page_view.d.ts +27 -0
  41. package/dist/types/web/draw_layer_builder.d.ts +13 -2
  42. package/dist/types/web/pdf_find_controller.d.ts +2 -0
  43. package/dist/types/web/pdf_link_service.d.ts +0 -1
  44. package/dist/types/web/pdf_page_detail_view.d.ts +32 -0
  45. package/dist/types/web/pdf_page_view.d.ts +41 -14
  46. package/dist/types/web/pdf_rendering_queue.d.ts +2 -1
  47. package/dist/types/web/pdf_thumbnail_view.d.ts +23 -3
  48. package/dist/types/web/pdf_thumbnail_viewer.d.ts +21 -1
  49. package/dist/types/web/pdf_viewer.d.ts +31 -0
  50. package/dist/types/web/struct_tree_layer_builder.d.ts +17 -1
  51. package/dist/types/web/text_layer_builder.d.ts +25 -17
  52. package/dist/types/web/xfa_layer_builder.d.ts +14 -3
  53. package/package.json +13 -21
  54. package/dist/index.d.ts +0 -4
@@ -78,6 +78,10 @@ export type AnnotationLayerParameters = {
78
78
  * Manage the layer containing all the annotations.
79
79
  */
80
80
  export class AnnotationLayer {
81
+ /**
82
+ * @private
83
+ */
84
+ private static get _defaultBorderStyle();
81
85
  constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: {
82
86
  div: any;
83
87
  accessibilityManager: any;
@@ -101,6 +105,14 @@ export class AnnotationLayer {
101
105
  * @memberof AnnotationLayer
102
106
  */
103
107
  render(params: AnnotationLayerParameters): Promise<void>;
108
+ /**
109
+ * Add link annotations to the annotation layer.
110
+ *
111
+ * @param {Array<Object>} annotations
112
+ * @param {IPDFLinkService} linkService
113
+ * @memberof AnnotationLayer
114
+ */
115
+ addLinkAnnotations(annotations: Array<Object>, linkService: IPDFLinkService): Promise<void>;
104
116
  /**
105
117
  * Update the annotation elements on existing annotation layer.
106
118
  *
@@ -222,6 +234,8 @@ declare class AnnotationElement {
222
234
  public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
223
235
  addHighlightArea(): void;
224
236
  _editOnDoubleClick(): void;
237
+ get width(): number;
238
+ get height(): number;
225
239
  #private;
226
240
  }
227
241
  export {};
@@ -35,14 +35,6 @@ export class AnnotationStorage {
35
35
  * @returns {boolean}
36
36
  */
37
37
  has(key: string): boolean;
38
- /**
39
- * @returns {Object | null}
40
- */
41
- getAll(): Object | null;
42
- /**
43
- * @param {Object} obj
44
- */
45
- setAll(obj: Object): void;
46
38
  get size(): number;
47
39
  resetModified(): void;
48
40
  /**
@@ -71,6 +63,7 @@ export class AnnotationStorage {
71
63
  ids: Set<string>;
72
64
  hash: string;
73
65
  };
66
+ [Symbol.iterator](): MapIterator<[any, any]>;
74
67
  #private;
75
68
  }
76
69
  /**
@@ -79,11 +79,15 @@ export type DocumentInitParameters = {
79
79
  cMapPacked?: boolean | undefined;
80
80
  /**
81
81
  * - The factory that will be used when
82
- * reading built-in CMap files. Providing a custom factory is useful for
83
- * environments without Fetch API or `XMLHttpRequest` support, such as
84
- * Node.js. The default value is {DOMCMapReaderFactory}.
82
+ * reading built-in CMap files.
83
+ * The default value is {DOMCMapReaderFactory}.
85
84
  */
86
85
  CMapReaderFactory?: Object | undefined;
86
+ /**
87
+ * - The URL where the predefined ICC profiles are
88
+ * located. Include the trailing slash.
89
+ */
90
+ iccUrl?: string | undefined;
87
91
  /**
88
92
  * - When `true`, fonts that aren't
89
93
  * embedded in the PDF document will fallback to a system font.
@@ -99,18 +103,35 @@ export type DocumentInitParameters = {
99
103
  standardFontDataUrl?: string | undefined;
100
104
  /**
101
105
  * - The factory that will be used
102
- * when reading the standard font files. Providing a custom factory is useful
103
- * for environments without Fetch API or `XMLHttpRequest` support, such as
104
- * Node.js. The default value is {DOMStandardFontDataFactory}.
106
+ * when reading the standard font files.
107
+ * The default value is {DOMStandardFontDataFactory}.
105
108
  */
106
109
  StandardFontDataFactory?: Object | undefined;
110
+ /**
111
+ * - The URL where the wasm files are located.
112
+ * Include the trailing slash.
113
+ */
114
+ wasmUrl?: string | undefined;
115
+ /**
116
+ * - The factory that will be used
117
+ * when reading the wasm files.
118
+ * The default value is {DOMWasmFactory}.
119
+ */
120
+ WasmFactory?: Object | undefined;
107
121
  /**
108
122
  * - Enable using the Fetch API in the
109
123
  * worker-thread when reading CMap and standard font files. When `true`,
110
- * the `CMapReaderFactory` and `StandardFontDataFactory` options are ignored.
124
+ * the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory`
125
+ * options are ignored.
111
126
  * The default value is `true` in web environments and `false` in Node.js.
112
127
  */
113
128
  useWorkerFetch?: boolean | undefined;
129
+ /**
130
+ * - Attempt to use WebAssembly in order to
131
+ * improve e.g. image decoding performance.
132
+ * The default value is `true`.
133
+ */
134
+ useWasm?: boolean | undefined;
114
135
  /**
115
136
  * - Reject certain promises, e.g.
116
137
  * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
@@ -553,10 +574,6 @@ export type PDFWorkerParameters = {
553
574
  };
554
575
  /** @type {string} */
555
576
  export const build: string;
556
- export const DefaultCanvasFactory: typeof DOMCanvasFactory | typeof NodeCanvasFactory;
557
- export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory;
558
- export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
559
- export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
560
577
  /**
561
578
  * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
562
579
  * Int16Array | Uint16Array |
@@ -605,9 +622,10 @@ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
605
622
  * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary
606
623
  * packed or not. The default value is `true`.
607
624
  * @property {Object} [CMapReaderFactory] - The factory that will be used when
608
- * reading built-in CMap files. Providing a custom factory is useful for
609
- * environments without Fetch API or `XMLHttpRequest` support, such as
610
- * Node.js. The default value is {DOMCMapReaderFactory}.
625
+ * reading built-in CMap files.
626
+ * The default value is {DOMCMapReaderFactory}.
627
+ * @property {string} [iccUrl] - The URL where the predefined ICC profiles are
628
+ * located. Include the trailing slash.
611
629
  * @property {boolean} [useSystemFonts] - When `true`, fonts that aren't
612
630
  * embedded in the PDF document will fallback to a system font.
613
631
  * The default value is `true` in web environments and `false` in Node.js;
@@ -616,13 +634,21 @@ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
616
634
  * @property {string} [standardFontDataUrl] - The URL where the standard font
617
635
  * files are located. Include the trailing slash.
618
636
  * @property {Object} [StandardFontDataFactory] - The factory that will be used
619
- * when reading the standard font files. Providing a custom factory is useful
620
- * for environments without Fetch API or `XMLHttpRequest` support, such as
621
- * Node.js. The default value is {DOMStandardFontDataFactory}.
637
+ * when reading the standard font files.
638
+ * The default value is {DOMStandardFontDataFactory}.
639
+ * @property {string} [wasmUrl] - The URL where the wasm files are located.
640
+ * Include the trailing slash.
641
+ * @property {Object} [WasmFactory] - The factory that will be used
642
+ * when reading the wasm files.
643
+ * The default value is {DOMWasmFactory}.
622
644
  * @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the
623
645
  * worker-thread when reading CMap and standard font files. When `true`,
624
- * the `CMapReaderFactory` and `StandardFontDataFactory` options are ignored.
646
+ * the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory`
647
+ * options are ignored.
625
648
  * The default value is `true` in web environments and `false` in Node.js.
649
+ * @property {boolean} [useWasm] - Attempt to use WebAssembly in order to
650
+ * improve e.g. image decoding performance.
651
+ * The default value is `true`.
626
652
  * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.
627
653
  * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated
628
654
  * PDF data cannot be successfully parsed, instead of attempting to recover
@@ -706,6 +732,7 @@ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
706
732
  * @returns {PDFDocumentLoadingTask}
707
733
  */
708
734
  export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
735
+ export const isValidExplicitDest: (dest?: any) => boolean;
709
736
  export class LoopbackPort {
710
737
  postMessage(obj: any, transfer: any): void;
711
738
  addEventListener(name: any, listener: any, options?: null): void;
@@ -787,10 +814,19 @@ export class PDFDataRangeTransport {
787
814
  * after which individual pages can be rendered.
788
815
  */
789
816
  export class PDFDocumentLoadingTask {
790
- static "__#54@#docId": number;
791
- _capability: any;
792
- _transport: any;
793
- _worker: any;
817
+ static "__#55@#docId": number;
818
+ /**
819
+ * @private
820
+ */
821
+ private _capability;
822
+ /**
823
+ * @private
824
+ */
825
+ private _transport;
826
+ /**
827
+ * @private
828
+ */
829
+ private _worker;
794
830
  /**
795
831
  * Unique identifier for the document loading task.
796
832
  * @type {string}
@@ -826,6 +862,13 @@ export class PDFDocumentLoadingTask {
826
862
  * completed.
827
863
  */
828
864
  destroy(): Promise<void>;
865
+ /**
866
+ * Attempt to fetch the raw data of the PDF document, when e.g.
867
+ * - An exception was thrown during document initialization.
868
+ * - An `onPassword` callback is delaying initialization.
869
+ * @returns {Promise<Uint8Array>}
870
+ */
871
+ getData(): Promise<Uint8Array>;
829
872
  }
830
873
  /**
831
874
  * Proxy to a `PDFDocument` in the worker thread.
@@ -1279,7 +1322,6 @@ export class PDFPageProxy {
1279
1322
  /** @type {PDFObjects} */
1280
1323
  commonObjs: PDFObjects;
1281
1324
  objs: PDFObjects;
1282
- _maybeCleanupAfterRender: boolean;
1283
1325
  _intentStates: Map<any, any>;
1284
1326
  destroyed: boolean;
1285
1327
  /**
@@ -1425,19 +1467,20 @@ export class PDFPageProxy {
1425
1467
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1426
1468
  */
1427
1469
  export class PDFWorker {
1428
- static "__#57@#fakeWorkerId": number;
1429
- static "__#57@#isWorkerDisabled": boolean;
1430
- static "__#57@#workerPorts": any;
1470
+ static "__#58@#fakeWorkerId": number;
1471
+ static "__#58@#isWorkerDisabled": boolean;
1472
+ static "__#58@#workerPorts": any;
1431
1473
  /**
1432
1474
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1475
+ * @returns {PDFWorker}
1433
1476
  */
1434
- static fromPort(params: PDFWorkerParameters): any;
1477
+ static fromPort(params: PDFWorkerParameters): PDFWorker;
1435
1478
  /**
1436
1479
  * The current `workerSrc`, when it exists.
1437
1480
  * @type {string}
1438
1481
  */
1439
1482
  static get workerSrc(): string;
1440
- static get "__#57@#mainThreadWorkerMessageHandler"(): any;
1483
+ static get "__#58@#mainThreadWorkerMessageHandler"(): any;
1441
1484
  static get _setupFakeWorkerGlobal(): any;
1442
1485
  constructor({ name, port, verbosity, }?: {
1443
1486
  name?: null | undefined;
@@ -1487,6 +1530,15 @@ export class RenderTask {
1487
1530
  * @type {function}
1488
1531
  */
1489
1532
  onContinue: Function;
1533
+ /**
1534
+ * A function that will be synchronously called when the rendering tasks
1535
+ * finishes with an error (either because of an actual error, or because the
1536
+ * rendering is cancelled).
1537
+ *
1538
+ * @type {function}
1539
+ * @param {Error} error
1540
+ */
1541
+ onError: Function;
1490
1542
  /**
1491
1543
  * Promise for rendering task completion.
1492
1544
  * @type {Promise<void>}
@@ -1512,12 +1564,6 @@ export const version: string;
1512
1564
  import { PageViewport } from "./display_utils.js";
1513
1565
  import { OptionalContentConfig } from "./optional_content_config.js";
1514
1566
  import { PrintAnnotationStorage } from "./annotation_storage.js";
1515
- import { DOMCanvasFactory } from "./canvas_factory.js";
1516
- import { NodeCanvasFactory } from "./node_utils";
1517
- import { DOMCMapReaderFactory } from "./cmap_reader_factory";
1518
- import { DOMFilterFactory } from "./filter_factory.js";
1519
- import { NodeFilterFactory } from "./node_utils";
1520
- import { DOMStandardFontDataFactory } from "./standard_fontdata_factory";
1521
1567
  import { AnnotationStorage } from "./annotation_storage.js";
1522
1568
  import { Metadata } from "./metadata.js";
1523
1569
  import { StatTimer } from "./display_utils.js";
@@ -15,7 +15,6 @@ export class CanvasGraphics {
15
15
  canvasFactory: any;
16
16
  filterFactory: any;
17
17
  groupStack: any[];
18
- processingType3: any;
19
18
  baseTransform: any;
20
19
  baseTransformStack: any[];
21
20
  groupLevel: number;
@@ -84,17 +83,18 @@ export class CanvasGraphics {
84
83
  save(): void;
85
84
  restore(): void;
86
85
  transform(a: any, b: any, c: any, d: any, e: any, f: any): void;
87
- constructPath(ops: any, args: any, minMax: any): void;
86
+ constructPath(op: any, data: any, minMax: any): void;
88
87
  closePath(): void;
89
- stroke(consumePath?: boolean): void;
90
- closeStroke(): void;
91
- fill(consumePath?: boolean): void;
92
- eoFill(): void;
93
- fillStroke(): void;
94
- eoFillStroke(): void;
95
- closeFillStroke(): void;
96
- closeEOFillStroke(): void;
97
- endPath(): void;
88
+ stroke(path: any, consumePath?: boolean): void;
89
+ closeStroke(path: any): void;
90
+ fill(path: any, consumePath?: boolean): void;
91
+ eoFill(path: any): void;
92
+ fillStroke(path: any): void;
93
+ eoFillStroke(path: any): void;
94
+ closeFillStroke(path: any): void;
95
+ closeEOFillStroke(path: any): void;
96
+ endPath(path: any): void;
97
+ rawFillPath(path: any): void;
98
98
  clip(): void;
99
99
  eoClip(): void;
100
100
  beginText(): void;
@@ -108,7 +108,7 @@ export class CanvasGraphics {
108
108
  setTextRise(rise: any): void;
109
109
  moveText(x: any, y: any): void;
110
110
  setLeadingMoveText(x: any, y: any): void;
111
- setTextMatrix(a: any, b: any, c: any, d: any, e: any, f: any): void;
111
+ setTextMatrix(matrix: any): void;
112
112
  nextLine(): void;
113
113
  paintChar(character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void;
114
114
  get isFontSubpixelAAEnabled(): any;
@@ -151,10 +151,10 @@ export class CanvasGraphics {
151
151
  endMarkedContent(): void;
152
152
  beginCompat(): void;
153
153
  endCompat(): void;
154
- consumePath(clipBox: any): void;
154
+ consumePath(path: any, clipBox: any): void;
155
155
  getSinglePixelWidth(): number;
156
156
  getScaleForStroking(): number[];
157
- rescaleAndStroke(saveRestore: any): void;
157
+ rescaleAndStroke(path: any, saveRestore: any): void;
158
158
  isContentVisible(): boolean;
159
159
  #private;
160
160
  }
@@ -163,7 +163,7 @@ declare class CanvasExtraState {
163
163
  alphaIsShape: boolean;
164
164
  fontSize: number;
165
165
  fontSizeScale: number;
166
- textMatrix: number[];
166
+ textMatrix: null;
167
167
  textMatrixScale: number;
168
168
  fontMatrix: number[];
169
169
  leading: number;
@@ -183,23 +183,15 @@ declare class CanvasExtraState {
183
183
  fillAlpha: number;
184
184
  strokeAlpha: number;
185
185
  lineWidth: number;
186
- activeSMask: any;
186
+ activeSMask: null;
187
187
  transferMaps: string;
188
+ clipBox: Float32Array<ArrayBuffer>;
189
+ minMax: Float32Array<ArrayBuffer>;
188
190
  clone(): any;
189
- setCurrentPoint(x: any, y: any): void;
190
- updatePathMinMax(transform: any, x: any, y: any): void;
191
- minX: any;
192
- minY: any;
193
- maxX: any;
194
- maxY: any;
195
- updateRectMinMax(transform: any, rect: any): void;
196
- updateScalingPathMinMax(transform: any, minMax: any): void;
197
- updateCurvePathMinMax(transform: any, x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void;
198
- getPathBoundingBox(pathType?: string, transform?: null): any[];
191
+ getPathBoundingBox(pathType?: string, transform?: null): Float32Array<ArrayBuffer>;
199
192
  updateClipFromPath(): void;
200
193
  isEmptyClip(): boolean;
201
194
  startNewPathAndClipBox(box: any): void;
202
- clipBox: any;
203
195
  getClippedPathBoundingBox(pathType?: string, transform?: null): number[] | null;
204
196
  }
205
197
  declare class CachedCanvases {
@@ -97,6 +97,7 @@ export function noContextMenu(e: any): void;
97
97
  * Scale factors for the canvas, necessary with HiDPI displays.
98
98
  */
99
99
  export class OutputScale {
100
+ static get pixelRatio(): number;
100
101
  /**
101
102
  * @type {number} Horizontal scale.
102
103
  */
@@ -109,7 +110,16 @@ export class OutputScale {
109
110
  * @type {boolean} Returns `true` when scaling is required, `false` otherwise.
110
111
  */
111
112
  get scaled(): boolean;
113
+ /**
114
+ * @type {boolean} Returns `true` when scaling is symmetric,
115
+ * `false` otherwise.
116
+ */
112
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;
113
123
  }
114
124
  /**
115
125
  * @typedef {Object} PageViewportParameters
@@ -242,5 +252,6 @@ export class StatTimer {
242
252
  toString(): string;
243
253
  }
244
254
  export function stopEvent(e: any): void;
255
+ export const SupportedImageMimeTypes: string[];
245
256
  export const SVG_NS: "http://www.w3.org/2000/svg";
246
257
  export {};
@@ -4,8 +4,9 @@
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 "__#32@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
9
+ static "__#33@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
9
10
  constructor({ pageIndex }: {
10
11
  pageIndex: any;
11
12
  });
@@ -1,5 +1,5 @@
1
1
  export class AltText {
2
- static "__#39@#l10nNewButton": null;
2
+ static "__#40@#l10nNewButton": null;
3
3
  static _l10n: null;
4
4
  static initialize(l10n: any): void;
5
5
  constructor(editor: any);
@@ -46,7 +46,7 @@ export type RenderEditorLayerOptions = {
46
46
  */
47
47
  export class AnnotationEditorLayer {
48
48
  static _initialized: boolean;
49
- static "__#33@#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>;
50
50
  /**
51
51
  * @param {AnnotationEditorLayerOptions} options
52
52
  */
@@ -143,7 +143,7 @@ export class AnnotationEditorLayer {
143
143
  * @param {number} mode
144
144
  * @param {Object} params
145
145
  */
146
- pasteEditor(mode: number, params: Object): void;
146
+ pasteEditor(mode: number, params: Object): Promise<void>;
147
147
  /**
148
148
  * Create a new editor
149
149
  * @param {Object} data
@@ -161,7 +161,7 @@ export class AnnotationEditorLayer {
161
161
  /**
162
162
  * Create and add a new editor.
163
163
  */
164
- addNewEditor(): void;
164
+ addNewEditor(data?: {}): void;
165
165
  /**
166
166
  * Set the last selected editor.
167
167
  * @param {AnnotationEditor} editor
@@ -226,4 +226,5 @@ import { AnnotationEditor } from "./editor.js";
226
226
  import { FreeTextEditor } from "./freetext.js";
227
227
  import { HighlightEditor } from "./highlight.js";
228
228
  import { InkEditor } from "./ink.js";
229
+ import { SignatureEditor } from "./signature.js";
229
230
  import { StampEditor } from "./stamp.js";
@@ -77,6 +77,7 @@ export class DrawingEditor extends AnnotationEditor {
77
77
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
78
78
  constructor(params: any);
79
79
  _drawId: null;
80
+ _addOutlines(params: any): void;
80
81
  /** @inheritdoc */
81
82
  updateParams(type: any, value: any): void;
82
83
  /** @inheritdoc */
@@ -87,7 +88,7 @@ export class DrawingEditor extends AnnotationEditor {
87
88
  */
88
89
  _updateProperty(type: any, name: any, value: any): void;
89
90
  /** @inheritdoc */
90
- _onTranslating(x: any, y: any): void;
91
+ _onTranslating(_x: any, _y: any): void;
91
92
  /** @inheritdoc */
92
93
  _onTranslated(): void;
93
94
  /** @inheritdoc */
@@ -0,0 +1,3 @@
1
+ export class ContourDrawOutline extends InkDrawOutline {
2
+ }
3
+ import { InkDrawOutline } from "./inkdraw.js";
@@ -6,8 +6,9 @@ export class InkDrawOutline extends Outline {
6
6
  };
7
7
  rotation: any;
8
8
  thickness: any;
9
- }): InkDrawOutline;
9
+ }): any;
10
10
  build(lines: any, parentWidth: any, parentHeight: any, parentScale: any, rotation: any, thickness: any, innerMargin: any): void;
11
+ get thickness(): any;
11
12
  setLastElement(element: any): {
12
13
  path: {
13
14
  d: string;
@@ -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";
@@ -73,7 +73,7 @@ export class AnnotationEditor {
73
73
  * @param {AnnotationEditorLayer} parent
74
74
  */
75
75
  static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
76
- static "__#41@#rotatePoint"(x: any, y: any, angle: any): any[];
76
+ static "__#42@#rotatePoint"(x: any, y: any, angle: any): any[];
77
77
  static _round(x: any): number;
78
78
  /**
79
79
  * Deserialize the editor.
@@ -91,6 +91,7 @@ export class AnnotationEditor {
91
91
  * @param {AnnotationEditorParameters} parameters
92
92
  */
93
93
  constructor(parameters: AnnotationEditorParameters);
94
+ _isCopy: boolean;
94
95
  _editToolbar: null;
95
96
  _initialOptions: any;
96
97
  _initialData: null;
@@ -166,6 +167,7 @@ export class AnnotationEditor {
166
167
  * @param {number} ty - y-translation in screen coordinates.
167
168
  */
168
169
  setAt(x: number, y: number, tx: number, ty: number): void;
170
+ _moveAfterPaste(baseX: any, baseY: any): void;
169
171
  /**
170
172
  * Translate the editor position within its parent.
171
173
  * @param {number} x - x-translation in screen coordinates.
@@ -179,6 +181,7 @@ export class AnnotationEditor {
179
181
  * @param {number} y - y-translation in page coordinates.
180
182
  */
181
183
  translateInPage(x: number, y: number): void;
184
+ translationDone(): void;
182
185
  drag(tx: any, ty: any): void;
183
186
  /**
184
187
  * Called when the editor is being translated.
@@ -417,7 +420,7 @@ export class AnnotationEditor {
417
420
  /**
418
421
  * @returns {HTMLElement | null} the element requiring an alt text.
419
422
  */
420
- getImageForAltText(): HTMLElement | null;
423
+ getElementForAltText(): HTMLElement | null;
421
424
  /**
422
425
  * Get the div which really contains the displayed content.
423
426
  * @returns {HTMLDivElement | undefined}
@@ -31,6 +31,7 @@ export class HighlightEditor extends AnnotationEditor {
31
31
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
32
32
  constructor(params: any);
33
33
  color: any;
34
+ defaultL10nId: string;
34
35
  /** @inheritdoc */
35
36
  get telemetryInitialData(): {
36
37
  action: string;
@@ -1,3 +1,8 @@
1
+ export class InkDrawingOptions extends DrawingOptions {
2
+ constructor(viewerParameters: any);
3
+ _viewParameters: any;
4
+ clone(): InkDrawingOptions;
5
+ }
1
6
  /**
2
7
  * Basic draw editor in order to generate an Ink annotation.
3
8
  */
@@ -14,7 +19,8 @@ export class InkEditor extends DrawingEditor {
14
19
  /** @inheritdoc */
15
20
  static createDrawerInstance(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): InkDrawOutliner;
16
21
  /** @inheritdoc */
17
- static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): InkDrawOutline;
22
+ static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
23
+ defaultL10nId: string;
18
24
  /** @inheritdoc */
19
25
  createDrawingOptions({ color, thickness, opacity }: {
20
26
  color: any;
@@ -26,6 +32,6 @@ export class InkEditor extends DrawingEditor {
26
32
  serialize(isForCopying?: boolean): Object | null;
27
33
  #private;
28
34
  }
35
+ import { DrawingOptions } from "./draw.js";
29
36
  import { DrawingEditor } from "./draw.js";
30
37
  import { InkDrawOutliner } from "./drawers/inkdraw.js";
31
- import { InkDrawOutline } from "./drawers/inkdraw.js";