@chialab/pdfjs-lib 1.0.0-alpha.24 → 1.0.0-alpha.25

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 (28) hide show
  1. package/dist/browser/{chunk-W3YEFTNG.js → chunk-YWSFNHP3.js} +23 -5
  2. package/dist/browser/index.js +6769 -5164
  3. package/dist/browser/worker.js +460 -180
  4. package/dist/lib/Path2D.d.ts +8 -48
  5. package/dist/node/{NodeUtils-EDBNTTIR.js → NodeUtils-ZGLDDB6J.js} +2 -2
  6. package/dist/node/{chunk-ZKUTXCS2.js → chunk-AC5JE2E3.js} +1 -1
  7. package/dist/node/{chunk-K6VD27AD.js → chunk-GVC6TP3T.js} +4 -1
  8. package/dist/node/{chunk-XMKSLA4K.js → chunk-YDSKBMQ3.js} +23 -5
  9. package/dist/node/index.js +6770 -5168
  10. package/dist/node/worker.js +461 -181
  11. package/dist/pdf.js/src/display/annotation_layer.d.ts +9 -0
  12. package/dist/pdf.js/src/display/api.d.ts +43 -6
  13. package/dist/pdf.js/src/display/canvas.d.ts +82 -80
  14. package/dist/pdf.js/src/display/canvas_dependency_tracker.d.ts +144 -0
  15. package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +1 -1
  16. package/dist/pdf.js/src/display/editor/color_picker.d.ts +19 -0
  17. package/dist/pdf.js/src/display/editor/comment.d.ts +32 -0
  18. package/dist/pdf.js/src/display/editor/draw.d.ts +1 -1
  19. package/dist/pdf.js/src/display/editor/editor.d.ts +27 -2
  20. package/dist/pdf.js/src/display/editor/freetext.d.ts +7 -0
  21. package/dist/pdf.js/src/display/editor/highlight.d.ts +1 -0
  22. package/dist/pdf.js/src/display/editor/ink.d.ts +4 -0
  23. package/dist/pdf.js/src/display/editor/toolbar.d.ts +2 -1
  24. package/dist/pdf.js/src/display/editor/tools.d.ts +11 -3
  25. package/dist/pdf.js/src/pdf.d.ts +2 -1
  26. package/dist/pdf.js/src/shared/util.d.ts +6 -2
  27. package/dist/pdf.js/web/interfaces.d.ts +7 -0
  28. package/package.json +1 -1
@@ -170,6 +170,7 @@ declare class AnnotationElement {
170
170
  renderForms: any;
171
171
  svgFactory: any;
172
172
  annotationStorage: any;
173
+ enableComment: any;
173
174
  enableScripting: any;
174
175
  hasJSActions: any;
175
176
  _fieldObjects: any;
@@ -177,7 +178,12 @@ declare class AnnotationElement {
177
178
  container: HTMLElement | undefined;
178
179
  get _isEditable(): any;
179
180
  get hasPopupData(): boolean;
181
+ get hasCommentButton(): any;
182
+ get commentButtonPosition(): any[] | null;
183
+ get commentButtonColor(): string | null;
184
+ _normalizePoint(point: any): any;
180
185
  updateEdited(params: any): void;
186
+ popup: any;
181
187
  resetEdited(): void;
182
188
  /**
183
189
  * Create an empty container for the annotation's HTML element.
@@ -204,10 +210,13 @@ declare class AnnotationElement {
204
210
  * annotations that do not have a Popup entry in the dictionary, but
205
211
  * are of a type that works with popups (such as Highlight annotations).
206
212
  *
213
+ * @param {Object} [popupData] - The data for the popup, if any.
214
+ *
207
215
  * @private
208
216
  * @memberof AnnotationElement
209
217
  */
210
218
  private _createPopup;
219
+ get hasPopupElement(): boolean;
211
220
  /**
212
221
  * Render the annotation's HTML element(s).
213
222
  *
@@ -414,15 +414,24 @@ export type GetAnnotationsParameters = {
414
414
  */
415
415
  export type RenderParameters = {
416
416
  /**
417
- * - A 2D context of a DOM
418
- * Canvas object.
417
+ * - A DOM Canvas object. The default
418
+ * value is the canvas associated with the `canvasContext` parameter if no
419
+ * value is provided explicitly.
419
420
  */
420
- canvasContext: CanvasRenderingContext2D;
421
+ canvas: HTMLCanvasElement | null;
421
422
  /**
422
423
  * - Rendering viewport obtained by calling
423
424
  * the `PDFPageProxy.getViewport` method.
424
425
  */
425
426
  viewport: PageViewport;
427
+ /**
428
+ * - 2D context of a DOM
429
+ * Canvas object for backwards compatibility; it is recommended to use the
430
+ * `canvas` parameter instead.
431
+ * If the context must absolutely be used to render the page, the canvas must
432
+ * be null.
433
+ */
434
+ canvasContext?: CanvasRenderingContext2D | undefined;
426
435
  /**
427
436
  * - Rendering intent, can be 'display', 'print',
428
437
  * or 'any'. The default value is 'display'.
@@ -483,6 +492,16 @@ export type RenderParameters = {
483
492
  * - Render the page in editing mode.
484
493
  */
485
494
  isEditing?: boolean | undefined;
495
+ /**
496
+ * - Record the dependencies and bounding
497
+ * boxes of all PDF operations that render onto the canvas.
498
+ */
499
+ recordOperations?: boolean | undefined;
500
+ /**
501
+ * - If provided, only run
502
+ * the PDF operations that are included in this set.
503
+ */
504
+ filteredOperationIndexes?: Set<number> | undefined;
486
505
  };
487
506
  /**
488
507
  * Page getOperatorList parameters.
@@ -960,6 +979,13 @@ export class PDFDocumentProxy {
960
979
  * for mapping named attachments to their content.
961
980
  */
962
981
  getAttachments(): Promise<any>;
982
+ /**
983
+ * @param {Set<number>} types - The annotation types to retrieve.
984
+ * @param {Set<number>} pageIndexesToSkip
985
+ * @returns {Promise<Array<Object>>} A promise that is resolved with a list of
986
+ * annotations data.
987
+ */
988
+ getAnnotationsByType(types: Set<number>, pageIndexesToSkip: Set<number>): Promise<Array<Object>>;
963
989
  /**
964
990
  * @returns {Promise<Object | null>} A promise that is resolved with
965
991
  * an {Object} with the JavaScript actions:
@@ -1209,10 +1235,16 @@ export class PDFDocumentProxy {
1209
1235
  * Page render parameters.
1210
1236
  *
1211
1237
  * @typedef {Object} RenderParameters
1212
- * @property {CanvasRenderingContext2D} canvasContext - A 2D context of a DOM
1213
- * Canvas object.
1238
+ * @property {HTMLCanvasElement|null} canvas - A DOM Canvas object. The default
1239
+ * value is the canvas associated with the `canvasContext` parameter if no
1240
+ * value is provided explicitly.
1214
1241
  * @property {PageViewport} viewport - Rendering viewport obtained by calling
1215
1242
  * the `PDFPageProxy.getViewport` method.
1243
+ * @property {CanvasRenderingContext2D} [canvasContext] - 2D context of a DOM
1244
+ * Canvas object for backwards compatibility; it is recommended to use the
1245
+ * `canvas` parameter instead.
1246
+ * If the context must absolutely be used to render the page, the canvas must
1247
+ * be null.
1216
1248
  * @property {string} [intent] - Rendering intent, can be 'display', 'print',
1217
1249
  * or 'any'. The default value is 'display'.
1218
1250
  * @property {number} [annotationMode] Controls which annotations are rendered
@@ -1250,6 +1282,10 @@ export class PDFDocumentProxy {
1250
1282
  * annotation ids with canvases used to render them.
1251
1283
  * @property {PrintAnnotationStorage} [printAnnotationStorage]
1252
1284
  * @property {boolean} [isEditing] - Render the page in editing mode.
1285
+ * @property {boolean} [recordOperations] - Record the dependencies and bounding
1286
+ * boxes of all PDF operations that render onto the canvas.
1287
+ * @property {Set<number>} [filteredOperationIndexes] - If provided, only run
1288
+ * the PDF operations that are included in this set.
1253
1289
  */
1254
1290
  /**
1255
1291
  * Page getOperatorList parameters.
@@ -1312,6 +1348,7 @@ export class PDFPageProxy {
1312
1348
  objs: PDFObjects;
1313
1349
  _intentStates: Map<any, any>;
1314
1350
  destroyed: boolean;
1351
+ recordedGroups: any;
1315
1352
  /**
1316
1353
  * @type {number} Page number of the page. First page is 1.
1317
1354
  */
@@ -1372,7 +1409,7 @@ export class PDFPageProxy {
1372
1409
  * @returns {RenderTask} An object that contains a promise that is
1373
1410
  * resolved when the page finishes rendering.
1374
1411
  */
1375
- render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
1412
+ render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, recordOperations, filteredOperationIndexes, }: RenderParameters): RenderTask;
1376
1413
  /**
1377
1414
  * @param {GetOperatorListParameters} params - Page getOperatorList
1378
1415
  * parameters.
@@ -2,7 +2,7 @@ export class CanvasGraphics {
2
2
  constructor(canvasCtx: any, commonObjs: any, objs: any, canvasFactory: any, filterFactory: any, { optionalContentConfig, markedContentStack }: {
3
3
  optionalContentConfig: any;
4
4
  markedContentStack?: null | undefined;
5
- }, annotationCanvasMap: any, pageColors: any);
5
+ }, annotationCanvasMap: any, pageColors: any, dependencyTracker: any);
6
6
  ctx: any;
7
7
  current: CanvasExtraState;
8
8
  stateStack: any[];
@@ -35,7 +35,8 @@ export class CanvasGraphics {
35
35
  _cachedScaleForStroking: number[];
36
36
  _cachedGetSinglePixelWidth: number | null;
37
37
  _cachedBitmapsMap: Map<any, any>;
38
- getObject(data: any, fallback?: null): any;
38
+ dependencyTracker: any;
39
+ getObject(opIdx: any, data: any, fallback?: null): any;
39
40
  beginDrawing({ transform, viewport, transparency, background, }: {
40
41
  transform: any;
41
42
  viewport: any;
@@ -44,26 +45,26 @@ export class CanvasGraphics {
44
45
  }): void;
45
46
  compositeCtx: any;
46
47
  transparentCanvas: any;
47
- executeOperatorList(operatorList: any, executionStartIdx: any, continueCallback: any, stepper: any): any;
48
+ executeOperatorList(operatorList: any, executionStartIdx: any, continueCallback: any, stepper: any, filteredOperationIndexes: any): any;
48
49
  endDrawing(): void;
49
50
  _scaleImage(img: any, inverseTransform: any): {
50
51
  img: any;
51
52
  paintWidth: any;
52
53
  paintHeight: any;
53
54
  };
54
- _createMaskCanvas(img: any): {
55
+ _createMaskCanvas(opIdx: any, img: any): {
55
56
  canvas: any;
56
57
  offsetX: number;
57
58
  offsetY: number;
58
59
  };
59
- setLineWidth(width: any): void;
60
- setLineCap(style: any): void;
61
- setLineJoin(style: any): void;
62
- setMiterLimit(limit: any): void;
63
- setDash(dashArray: any, dashPhase: any): void;
64
- setRenderingIntent(intent: any): void;
65
- setFlatness(flatness: any): void;
66
- setGState(states: any): void;
60
+ setLineWidth(opIdx: any, width: any): void;
61
+ setLineCap(opIdx: any, style: any): void;
62
+ setLineJoin(opIdx: any, style: any): void;
63
+ setMiterLimit(opIdx: any, limit: any): void;
64
+ setDash(opIdx: any, dashArray: any, dashPhase: any): void;
65
+ setRenderingIntent(opIdx: any, intent: any): void;
66
+ setFlatness(opIdx: any, flatness: any): void;
67
+ setGState(opIdx: any, states: any): void;
67
68
  get inSMaskMode(): boolean;
68
69
  checkSMaskState(): void;
69
70
  /**
@@ -75,83 +76,84 @@ export class CanvasGraphics {
75
76
  * mode ends any clipping paths or transformations will still be active and in
76
77
  * the right order on the canvas' graphics state stack.
77
78
  */
78
- beginSMaskMode(): void;
79
+ beginSMaskMode(opIdx: any): void;
79
80
  endSMaskMode(): void;
80
81
  compose(dirtyBox: any): void;
81
82
  composeSMask(ctx: any, smask: any, layerCtx: any, layerBox: any): void;
82
83
  genericComposeSMask(maskCtx: any, layerCtx: any, width: any, height: any, subtype: any, backdrop: any, transferMap: any, layerOffsetX: any, layerOffsetY: any, maskOffsetX: any, maskOffsetY: any): void;
83
- save(): void;
84
- restore(): void;
85
- transform(a: any, b: any, c: any, d: any, e: any, f: any): void;
86
- constructPath(op: any, data: any, minMax: any): void;
87
- closePath(): 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
- clip(): void;
99
- eoClip(): void;
100
- beginText(): void;
101
- endText(): void;
102
- setCharSpacing(spacing: any): void;
103
- setWordSpacing(spacing: any): void;
104
- setHScale(scale: any): void;
105
- setLeading(leading: any): void;
106
- setFont(fontRefName: any, size: any): void;
107
- setTextRenderingMode(mode: any): void;
108
- setTextRise(rise: any): void;
109
- moveText(x: any, y: any): void;
110
- setLeadingMoveText(x: any, y: any): void;
111
- setTextMatrix(matrix: any): void;
112
- nextLine(): void;
113
- paintChar(character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void;
84
+ save(opIdx: any): void;
85
+ restore(opIdx: any): void;
86
+ transform(opIdx: any, a: any, b: any, c: any, d: any, e: any, f: any): void;
87
+ constructPath(opIdx: any, op: any, data: any, minMax: any): void;
88
+ _pathStartIdx: any;
89
+ closePath(opIdx: any): void;
90
+ stroke(opIdx: any, path: any, consumePath?: boolean): void;
91
+ closeStroke(opIdx: any, path: any): void;
92
+ fill(opIdx: any, path: any, consumePath?: boolean): void;
93
+ eoFill(opIdx: any, path: any): void;
94
+ fillStroke(opIdx: any, path: any): void;
95
+ eoFillStroke(opIdx: any, path: any): void;
96
+ closeFillStroke(opIdx: any, path: any): void;
97
+ closeEOFillStroke(opIdx: any, path: any): void;
98
+ endPath(opIdx: any, path: any): void;
99
+ rawFillPath(opIdx: any, path: any): void;
100
+ clip(opIdx: any): void;
101
+ eoClip(opIdx: any): void;
102
+ beginText(opIdx: any): void;
103
+ endText(opIdx: any): void;
104
+ setCharSpacing(opIdx: any, spacing: any): void;
105
+ setWordSpacing(opIdx: any, spacing: any): void;
106
+ setHScale(opIdx: any, scale: any): void;
107
+ setLeading(opIdx: any, leading: any): void;
108
+ setFont(opIdx: any, fontRefName: any, size: any): void;
109
+ setTextRenderingMode(opIdx: any, mode: any): void;
110
+ setTextRise(opIdx: any, rise: any): void;
111
+ moveText(opIdx: any, x: any, y: any): void;
112
+ setLeadingMoveText(opIdx: any, x: any, y: any): void;
113
+ setTextMatrix(opIdx: any, matrix: any): void;
114
+ nextLine(opIdx: any): void;
115
+ paintChar(opIdx: any, character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void;
114
116
  get isFontSubpixelAAEnabled(): any;
115
- showText(glyphs: any): void;
116
- showType3Text(glyphs: any): void;
117
- setCharWidth(xWidth: any, yWidth: any): void;
118
- setCharWidthAndBounds(xWidth: any, yWidth: any, llx: any, lly: any, urx: any, ury: any): void;
119
- getColorN_Pattern(IR: any): any;
120
- setStrokeColorN(...args: any[]): void;
121
- setFillColorN(...args: any[]): void;
122
- setStrokeRGBColor(color: any): void;
123
- setStrokeTransparent(): void;
124
- setFillRGBColor(color: any): void;
125
- setFillTransparent(): void;
126
- _getPattern(objId: any, matrix?: null): any;
127
- shadingFill(objId: any): void;
117
+ showText(opIdx: any, glyphs: any): undefined;
118
+ showType3Text(opIdx: any, glyphs: any): void;
119
+ setCharWidth(opIdx: any, xWidth: any, yWidth: any): void;
120
+ setCharWidthAndBounds(opIdx: any, xWidth: any, yWidth: any, llx: any, lly: any, urx: any, ury: any): void;
121
+ getColorN_Pattern(opIdx: any, IR: any): any;
122
+ setStrokeColorN(opIdx: any, ...args: any[]): void;
123
+ setFillColorN(opIdx: any, ...args: any[]): void;
124
+ setStrokeRGBColor(opIdx: any, color: any): void;
125
+ setStrokeTransparent(opIdx: any): void;
126
+ setFillRGBColor(opIdx: any, color: any): void;
127
+ setFillTransparent(opIdx: any): void;
128
+ _getPattern(opIdx: any, objId: any, matrix?: null): any;
129
+ shadingFill(opIdx: any, objId: any): void;
128
130
  beginInlineImage(): void;
129
131
  beginImageData(): void;
130
- paintFormXObjectBegin(matrix: any, bbox: any): void;
131
- paintFormXObjectEnd(): void;
132
- beginGroup(group: any): void;
133
- endGroup(group: any): void;
134
- beginAnnotation(id: any, rect: any, transform: any, matrix: any, hasOwnCanvas: any): void;
132
+ paintFormXObjectBegin(opIdx: any, matrix: any, bbox: any): void;
133
+ paintFormXObjectEnd(opIdx: any): void;
134
+ beginGroup(opIdx: any, group: any): void;
135
+ endGroup(opIdx: any, group: any): void;
136
+ beginAnnotation(opIdx: any, id: any, rect: any, transform: any, matrix: any, hasOwnCanvas: any): void;
135
137
  annotationCanvas: any;
136
- endAnnotation(): void;
137
- paintImageMaskXObject(img: any): void;
138
- paintImageMaskXObjectRepeat(img: any, scaleX: any, skewX: number | undefined, skewY: number | undefined, scaleY: any, positions: any): void;
139
- paintImageMaskXObjectGroup(images: any): void;
140
- paintImageXObject(objId: any): void;
141
- paintImageXObjectRepeat(objId: any, scaleX: any, scaleY: any, positions: any): void;
138
+ endAnnotation(opIdx: any): void;
139
+ paintImageMaskXObject(opIdx: any, img: any): void;
140
+ paintImageMaskXObjectRepeat(opIdx: any, img: any, scaleX: any, skewX: number | undefined, skewY: number | undefined, scaleY: any, positions: any): void;
141
+ paintImageMaskXObjectGroup(opIdx: any, images: any): void;
142
+ paintImageXObject(opIdx: any, objId: any): void;
143
+ paintImageXObjectRepeat(opIdx: any, objId: any, scaleX: any, scaleY: any, positions: any): void;
142
144
  applyTransferMapsToCanvas(ctx: any): any;
143
145
  applyTransferMapsToBitmap(imgData: any): any;
144
- paintInlineImageXObject(imgData: any): void;
145
- paintInlineImageXObjectGroup(imgData: any, map: any): void;
146
- paintSolidColorImageMask(): void;
147
- markPoint(tag: any): void;
148
- markPointProps(tag: any, properties: any): void;
149
- beginMarkedContent(tag: any): void;
150
- beginMarkedContentProps(tag: any, properties: any): void;
151
- endMarkedContent(): void;
152
- beginCompat(): void;
153
- endCompat(): void;
154
- consumePath(path: any, clipBox: any): void;
146
+ paintInlineImageXObject(opIdx: any, imgData: any): void;
147
+ paintInlineImageXObjectGroup(opIdx: any, imgData: any, map: any): void;
148
+ paintSolidColorImageMask(opIdx: any): void;
149
+ markPoint(opIdx: any, tag: any): void;
150
+ markPointProps(opIdx: any, tag: any, properties: any): void;
151
+ beginMarkedContent(opIdx: any, tag: any): void;
152
+ beginMarkedContentProps(opIdx: any, tag: any, properties: any): void;
153
+ endMarkedContent(opIdx: any): void;
154
+ beginCompat(opIdx: any): void;
155
+ endCompat(opIdx: any): void;
156
+ consumePath(opIdx: any, path: any, clipBox: any): void;
155
157
  getSinglePixelWidth(): number;
156
158
  getScaleForStroking(): number[];
157
159
  rescaleAndStroke(path: any, saveRestore: any): void;
@@ -159,7 +161,7 @@ export class CanvasGraphics {
159
161
  #private;
160
162
  }
161
163
  declare class CanvasExtraState {
162
- constructor(width: any, height: any);
164
+ constructor(width: any, height: any, preInit: any);
163
165
  alphaIsShape: boolean;
164
166
  fontSize: number;
165
167
  fontSizeScale: number;
@@ -0,0 +1,144 @@
1
+ export type SimpleDependency = "lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" | "strokeAlpha" | "fillColor" | "fillAlpha" | "globalCompositeOperation" | "path" | "filter";
2
+ export type IncrementalDependency = "transform" | "moveText" | "sameLineText";
3
+ export type InternalIncrementalDependency = IncrementalDependency | typeof FORCED_DEPENDENCY_LABEL;
4
+ /**
5
+ * @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
6
+ * "strokeAlpha" | "fillColor" | "fillAlpha" | "globalCompositeOperation" |
7
+ * "path" | "filter"} SimpleDependency
8
+ */
9
+ /**
10
+ * @typedef {"transform" | "moveText" | "sameLineText"} IncrementalDependency
11
+ */
12
+ /**
13
+ * @typedef {IncrementalDependency |
14
+ * typeof FORCED_DEPENDENCY_LABEL} InternalIncrementalDependency
15
+ */
16
+ export class CanvasDependencyTracker {
17
+ constructor(canvas: any);
18
+ save(opIdx: any): this;
19
+ restore(opIdx: any): this;
20
+ /**
21
+ * @param {number} idx
22
+ */
23
+ recordOpenMarker(idx: number): this;
24
+ getOpenMarker(): any;
25
+ recordCloseMarker(idx: any): this;
26
+ beginMarkedContent(opIdx: any): this;
27
+ endMarkedContent(opIdx: any): this;
28
+ pushBaseTransform(ctx: any): this;
29
+ popBaseTransform(): this;
30
+ /**
31
+ * @param {SimpleDependency} name
32
+ * @param {number} idx
33
+ */
34
+ recordSimpleData(name: SimpleDependency, idx: number): this;
35
+ /**
36
+ * @param {IncrementalDependency} name
37
+ * @param {number} idx
38
+ */
39
+ recordIncrementalData(name: IncrementalDependency, idx: number): this;
40
+ /**
41
+ * @param {IncrementalDependency} name
42
+ * @param {number} idx
43
+ */
44
+ resetIncrementalData(name: IncrementalDependency, idx: number): this;
45
+ recordNamedData(name: any, idx: any): this;
46
+ recordFutureForcedDependency(name: any, idx: any): this;
47
+ inheritSimpleDataAsFutureForcedDependencies(names: any): this;
48
+ inheritPendingDependenciesAsFutureForcedDependencies(): this;
49
+ resetBBox(idx: any): this;
50
+ get hasPendingBBox(): boolean;
51
+ recordClipBox(idx: any, ctx: any, minX: any, maxX: any, minY: any, maxY: any): this;
52
+ recordBBox(idx: any, ctx: any, minX: any, maxX: any, minY: any, maxY: any): this;
53
+ recordCharacterBBox(idx: any, ctx: any, font: any, scale: number | undefined, x: number | undefined, y: number | undefined, getMeasure: any): this;
54
+ recordFullPageBBox(idx: any): this;
55
+ getSimpleIndex(dependencyName: any): any;
56
+ recordDependencies(idx: any, dependencyNames: any): this;
57
+ copyDependenciesFromIncrementalOperation(idx: any, name: any): this;
58
+ recordNamedDependency(idx: any, name: any): this;
59
+ /**
60
+ * @param {number} idx
61
+ */
62
+ recordOperation(idx: number, preserveBbox?: boolean): this;
63
+ bboxToClipBoxDropOperation(idx: any): this;
64
+ _takePendingDependencies(): Set<any>;
65
+ _extractOperation(idx: any): any;
66
+ _pushPendingDependencies(dependencies: any): void;
67
+ take(): {
68
+ minX: number;
69
+ maxX: number;
70
+ minY: number;
71
+ maxY: number;
72
+ dependencies: any[];
73
+ idx: any;
74
+ }[];
75
+ #private;
76
+ }
77
+ /**
78
+ * Used to track dependencies of nested operations list, that
79
+ * should actually all map to the index of the operation that
80
+ * contains the nested list.
81
+ *
82
+ * @implements {CanvasDependencyTracker}
83
+ */
84
+ export class CanvasNestedDependencyTracker implements CanvasDependencyTracker {
85
+ constructor(dependencyTracker: any, opIdx: any);
86
+ save(opIdx: any): this;
87
+ restore(opIdx: any): this;
88
+ recordOpenMarker(idx: any): this;
89
+ getOpenMarker(): any;
90
+ recordCloseMarker(idx: any): this;
91
+ beginMarkedContent(opIdx: any): this;
92
+ endMarkedContent(opIdx: any): this;
93
+ pushBaseTransform(ctx: any): this;
94
+ popBaseTransform(): this;
95
+ /**
96
+ * @param {SimpleDependency} name
97
+ * @param {number} idx
98
+ */
99
+ recordSimpleData(name: SimpleDependency, idx: number): this;
100
+ /**
101
+ * @param {IncrementalDependency} name
102
+ * @param {number} idx
103
+ */
104
+ recordIncrementalData(name: IncrementalDependency, idx: number): this;
105
+ /**
106
+ * @param {IncrementalDependency} name
107
+ * @param {number} idx
108
+ */
109
+ resetIncrementalData(name: IncrementalDependency, idx: number): this;
110
+ recordNamedData(name: any, idx: any): this;
111
+ recordFutureForcedDependency(name: any, idx: any): this;
112
+ inheritSimpleDataAsFutureForcedDependencies(names: any): this;
113
+ inheritPendingDependenciesAsFutureForcedDependencies(): this;
114
+ resetBBox(idx: any): this;
115
+ get hasPendingBBox(): boolean;
116
+ recordClipBox(idx: any, ctx: any, minX: any, maxX: any, minY: any, maxY: any): this;
117
+ recordBBox(idx: any, ctx: any, minX: any, maxX: any, minY: any, maxY: any): this;
118
+ recordCharacterBBox(idx: any, ctx: any, font: any, scale: any, x: any, y: any, getMeasure: any): this;
119
+ recordFullPageBBox(idx: any): this;
120
+ getSimpleIndex(dependencyName: any): any;
121
+ recordDependencies(idx: any, dependencyNames: any): this;
122
+ copyDependenciesFromIncrementalOperation(idx: any, name: any): this;
123
+ recordNamedDependency(idx: any, name: any): this;
124
+ /**
125
+ * @param {number} idx
126
+ * @param {SimpleDependency[]} dependencyNames
127
+ */
128
+ recordOperation(idx: number): this;
129
+ bboxToClipBoxDropOperation(idx: any): this;
130
+ recordNestedDependencies(): void;
131
+ take(): void;
132
+ #private;
133
+ }
134
+ export namespace Dependencies {
135
+ let stroke: string[];
136
+ let fill: string[];
137
+ let imageXObject: string[];
138
+ let rawFillPath: string[];
139
+ let showText: string[];
140
+ let transform: string[];
141
+ let transformAndFill: string[];
142
+ }
143
+ declare const FORCED_DEPENDENCY_LABEL: "__forcedDependency";
144
+ export {};
@@ -111,7 +111,7 @@ export class AnnotationEditorLayer {
111
111
  remove(editor: AnnotationEditor): void;
112
112
  /**
113
113
  * An editor can have a different parent, for example after having
114
- * being dragged and droped from a page to another.
114
+ * being dragged and dropped from a page to another.
115
115
  * @param {AnnotationEditor} editor
116
116
  */
117
117
  changeParent(editor: AnnotationEditor): void;
@@ -1,3 +1,22 @@
1
+ /**
2
+ * BasicColorPicker class provides a simple color picker.
3
+ * It displays an input element (with type="color") that allows the user
4
+ * to select a color for the annotation.
5
+ */
6
+ export class BasicColorPicker {
7
+ static #l10nColor: null;
8
+ constructor(editor: any);
9
+ renderButton(): HTMLInputElement;
10
+ update(value: any): void;
11
+ destroy(): void;
12
+ hideDropdown(): void;
13
+ #private;
14
+ }
15
+ /**
16
+ * ColorPicker class provides a color picker for the annotation editor.
17
+ * It displays a dropdown with some predefined colors and allows the user
18
+ * to select a color for the annotation.
19
+ */
1
20
  export class ColorPicker {
2
21
  static #l10nColor: null;
3
22
  static get _keyboardManager(): any;
@@ -0,0 +1,32 @@
1
+ export class Comment {
2
+ constructor(editor: any);
3
+ toolbar: any;
4
+ render(): HTMLButtonElement | null;
5
+ edit(): void;
6
+ finish(): void;
7
+ isDeleted(): boolean;
8
+ hasBeenEdited(): boolean;
9
+ serialize(): {
10
+ text: null;
11
+ date: null;
12
+ deleted: boolean;
13
+ };
14
+ /**
15
+ * Set the comment data.
16
+ */
17
+ set data(text: {
18
+ text: null;
19
+ date: null;
20
+ deleted: boolean;
21
+ });
22
+ get data(): {
23
+ text: null;
24
+ date: null;
25
+ deleted: boolean;
26
+ };
27
+ setInitialText(text: any): void;
28
+ toggle(enabled?: boolean): void;
29
+ shown(): void;
30
+ destroy(): void;
31
+ #private;
32
+ }
@@ -32,7 +32,6 @@ export class DrawingEditor extends AnnotationEditor {
32
32
  INK_THICKNESS: number;
33
33
  INK_OPACITY: number;
34
34
  HIGHLIGHT_COLOR: number;
35
- HIGHLIGHT_DEFAULT_COLOR: number;
36
35
  HIGHLIGHT_THICKNESS: number;
37
36
  HIGHLIGHT_FREE: number;
38
37
  HIGHLIGHT_SHOW_ALL: number;
@@ -76,6 +75,7 @@ export class DrawingEditor extends AnnotationEditor {
76
75
  /** @inheritdoc */
77
76
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
78
77
  constructor(params: any);
78
+ _colorPicker: null;
79
79
  _drawId: null;
80
80
  _addOutlines(params: any): void;
81
81
  /** @inheritdoc */
@@ -258,9 +258,9 @@ export class AnnotationEditor {
258
258
  altTextFinish(): void;
259
259
  /**
260
260
  * Get the toolbar buttons for this editor.
261
- * @returns {Array<Array<string|object>>|null}
261
+ * @returns {Array<Array<string|object|null>>|null}
262
262
  */
263
- get toolbarButtons(): Array<Array<string | object>> | null;
263
+ get toolbarButtons(): Array<Array<string | object | null>> | null;
264
264
  /**
265
265
  * Add a toolbar for this editor.
266
266
  * @returns {Promise<EditorToolbar|null>}
@@ -284,6 +284,24 @@ export class AnnotationEditor {
284
284
  serializeAltText(isForCopying: any): any;
285
285
  hasAltText(): boolean;
286
286
  hasAltTextData(): any;
287
+ addCommentButton(): Comment;
288
+ get commentColor(): null;
289
+ set comment(text: {
290
+ text: any;
291
+ date: any;
292
+ deleted: any;
293
+ color: null;
294
+ });
295
+ get comment(): {
296
+ text: any;
297
+ date: any;
298
+ deleted: any;
299
+ color: null;
300
+ };
301
+ setCommentData(text: any): void;
302
+ get hasEditedComment(): any;
303
+ editComment(): Promise<void>;
304
+ addComment(serialized: any): void;
287
305
  /**
288
306
  * Render this editor in a div.
289
307
  * @returns {HTMLDivElement | null}
@@ -306,6 +324,12 @@ export class AnnotationEditor {
306
324
  */
307
325
  getRect(tx: number, ty: number, rotation?: number): any[];
308
326
  getRectInCurrentCoords(rect: any, pageHeight: any): any[];
327
+ /**
328
+ * Get the rect in page coordinates without any translation.
329
+ * It's used when serializing the editor.
330
+ * @returns {Array<number>}
331
+ */
332
+ getPDFRect(): Array<number>;
309
333
  /**
310
334
  * Executed once this editor has been rendered.
311
335
  * @param {boolean} focus - true if the editor should be focused.
@@ -495,4 +519,5 @@ export class AnnotationEditor {
495
519
  }
496
520
  import { AnnotationEditorUIManager } from "./tools.js";
497
521
  import { EditorToolbar } from "./toolbar.js";
522
+ import { Comment } from "./comment.js";
498
523
  import { ColorManager } from "./tools.js";
@@ -21,10 +21,15 @@ export class FreeTextEditor extends AnnotationEditor {
21
21
  /** @inheritdoc */
22
22
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
23
23
  constructor(params: any);
24
+ _colorPicker: null;
24
25
  /** @inheritdoc */
25
26
  updateParams(type: any, value: any): void;
26
27
  /** @inheritdoc */
27
28
  get propertiesToUpdate(): any[][];
29
+ /** @inheritdoc */
30
+ get toolbarButtons(): (string | null)[][];
31
+ get colorType(): number;
32
+ get colorValue(): any;
28
33
  /**
29
34
  * Helper to translate the editor with the keyboard when it's empty.
30
35
  * @param {number} x in page units.
@@ -48,6 +53,8 @@ export class FreeTextEditor extends AnnotationEditor {
48
53
  overlayDiv: HTMLDivElement | undefined;
49
54
  editorDivPaste(event: any): void;
50
55
  /** @inheritdoc */
56
+ getPDFRect(): any[];
57
+ /** @inheritdoc */
51
58
  serialize(isForCopying?: boolean): Object | null;
52
59
  /** @inheritdoc */
53
60
  renderAnnotationElement(annotation: any): HTMLElement | null;
@@ -45,6 +45,7 @@ export class HighlightEditor extends AnnotationEditor {
45
45
  type: string;
46
46
  color: any;
47
47
  };
48
+ get commentColor(): any;
48
49
  /** @inheritdoc */
49
50
  translateInPage(x: any, y: any): void;
50
51
  /** @inheritdoc */