pdfjs-serverless 0.6.0 → 0.7.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.
Files changed (62) hide show
  1. package/dist/index.d.mts +1 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/types/src/display/annotation_layer.d.ts +11 -1
  5. package/dist/types/src/display/api.d.ts +79 -35
  6. package/dist/types/src/display/canvas.d.ts +2 -1
  7. package/dist/types/src/display/canvas_factory.d.ts +27 -0
  8. package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
  9. package/dist/types/src/display/display_utils.d.ts +29 -60
  10. package/dist/types/src/display/draw_layer.d.ts +6 -19
  11. package/dist/types/src/display/editor/alt_text.d.ts +3 -2
  12. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +13 -9
  13. package/dist/types/src/display/editor/color_picker.d.ts +1 -0
  14. package/dist/types/src/display/editor/draw.d.ts +120 -0
  15. package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
  16. package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
  17. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +128 -0
  18. package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
  19. package/dist/types/src/display/editor/editor.d.ts +51 -12
  20. package/dist/types/src/display/editor/freetext.d.ts +5 -16
  21. package/dist/types/src/display/editor/highlight.d.ts +7 -25
  22. package/dist/types/src/display/editor/ink.d.ts +15 -74
  23. package/dist/types/src/display/editor/stamp.d.ts +13 -17
  24. package/dist/types/src/display/editor/toolbar.d.ts +3 -2
  25. package/dist/types/src/display/editor/tools.d.ts +13 -3
  26. package/dist/types/src/display/fetch_stream.d.ts +6 -13
  27. package/dist/types/src/display/filter_factory.d.ts +29 -0
  28. package/dist/types/src/display/font_loader.d.ts +3 -1
  29. package/dist/types/src/display/network.d.ts +10 -6
  30. package/dist/types/src/display/network_utils.d.ts +5 -3
  31. package/dist/types/src/display/node_stream.d.ts +6 -22
  32. package/dist/types/src/display/node_utils.d.ts +8 -11
  33. package/dist/types/src/display/optional_content_config.d.ts +1 -1
  34. package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
  35. package/dist/types/src/display/svg_factory.d.ts +14 -0
  36. package/dist/types/src/display/text_layer.d.ts +12 -9
  37. package/dist/types/src/display/touch_manager.d.ts +14 -0
  38. package/dist/types/src/display/transport_stream.d.ts +1 -1
  39. package/dist/types/src/display/worker_options.d.ts +2 -2
  40. package/dist/types/src/interfaces.d.ts +4 -0
  41. package/dist/types/src/pdf.d.ts +5 -3
  42. package/dist/types/src/shared/message_handler.d.ts +10 -4
  43. package/dist/types/src/shared/util.d.ts +9 -20
  44. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -2
  45. package/dist/types/web/annotation_layer_builder.d.ts +2 -1
  46. package/dist/types/web/app_options.d.ts +1 -1
  47. package/dist/types/web/event_utils.d.ts +2 -2
  48. package/dist/types/web/genericl10n.d.ts +5 -5
  49. package/dist/types/web/interfaces.d.ts +5 -5
  50. package/dist/types/web/l10n.d.ts +2 -2
  51. package/dist/types/web/pdf_link_service.d.ts +2 -2
  52. package/dist/types/web/pdf_page_view.d.ts +5 -11
  53. package/dist/types/web/pdf_rendering_queue.d.ts +1 -1
  54. package/dist/types/web/pdf_thumbnail_view.d.ts +1 -1
  55. package/dist/types/web/pdf_viewer.d.ts +13 -16
  56. package/dist/types/web/struct_tree_layer_builder.d.ts +4 -2
  57. package/dist/types/web/text_accessibility.d.ts +1 -1
  58. package/dist/types/web/text_layer_builder.d.ts +5 -5
  59. package/dist/types/web/ui_utils.d.ts +3 -19
  60. package/package.json +15 -15
  61. package/dist/types/src/display/base_factory.d.ts +0 -60
  62. package/dist/types/src/display/editor/outliner.d.ts +0 -70
@@ -4,6 +4,7 @@ export type TextAccessibilityManager = import("../../web/text_accessibility.js")
4
4
  export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
5
5
  export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
6
6
  export type AnnotationEditorUIManager = any;
7
+ export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
7
8
  export type AnnotationElementParameters = {
8
9
  data: Object;
9
10
  layer: HTMLDivElement;
@@ -50,6 +51,7 @@ export type AnnotationLayerParameters = {
50
51
  annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
51
52
  accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
52
53
  annotationEditorUIManager?: AnnotationEditorUIManager;
54
+ structTreeLayer?: import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined;
53
55
  };
54
56
  /**
55
57
  * @typedef {Object} AnnotationLayerParameters
@@ -70,18 +72,20 @@ export type AnnotationLayerParameters = {
70
72
  * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
71
73
  * @property {TextAccessibilityManager} [accessibilityManager]
72
74
  * @property {AnnotationEditorUIManager} [annotationEditorUIManager]
75
+ * @property {StructTreeLayerBuilder} [structTreeLayer]
73
76
  */
74
77
  /**
75
78
  * Manage the layer containing all the annotations.
76
79
  */
77
80
  export class AnnotationLayer {
78
- constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, }: {
81
+ constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: {
79
82
  div: any;
80
83
  accessibilityManager: any;
81
84
  annotationCanvasMap: any;
82
85
  annotationEditorUIManager: any;
83
86
  page: any;
84
87
  viewport: any;
88
+ structTreeLayer: any;
85
89
  });
86
90
  div: any;
87
91
  page: any;
@@ -115,6 +119,11 @@ export class FreeTextAnnotationElement extends AnnotationElement {
115
119
  annotationEditorType: number;
116
120
  render(): HTMLElement | undefined;
117
121
  }
122
+ export class HighlightAnnotationElement extends AnnotationElement {
123
+ constructor(parameters: any);
124
+ annotationEditorType: number;
125
+ render(): HTMLElement | undefined;
126
+ }
118
127
  export class InkAnnotationElement extends AnnotationElement {
119
128
  constructor(parameters: any);
120
129
  containerClassName: string;
@@ -126,6 +135,7 @@ export class InkAnnotationElement extends AnnotationElement {
126
135
  }
127
136
  export class StampAnnotationElement extends AnnotationElement {
128
137
  constructor(parameters: any);
138
+ annotationEditorType: number;
129
139
  render(): HTMLElement | undefined;
130
140
  }
131
141
  import { AnnotationStorage } from "./annotation_storage.js";
@@ -137,6 +137,23 @@ export type DocumentInitParameters = {
137
137
  * The default value is `true` in web environments and `false` in Node.js.
138
138
  */
139
139
  isOffscreenCanvasSupported?: boolean | undefined;
140
+ /**
141
+ * - Determines if we can use
142
+ * `ImageDecoder` in the worker. Primarily used to improve performance of
143
+ * image conversion/rendering.
144
+ * The default value is `true` in web environments and `false` in Node.js.
145
+ *
146
+ * NOTE: Also temporarily disabled in Chromium browsers, until we no longer
147
+ * support the affected browser versions, because of various bugs:
148
+ *
149
+ * - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
150
+ * see https://issues.chromium.org/issues/374807001
151
+ *
152
+ * - Broken images when using the JPEG decoder with images that have custom
153
+ * colour profiles, e.g. GitHub discussion 19030;
154
+ * see https://issues.chromium.org/issues/378869810
155
+ */
156
+ isImageDecoderSupported?: boolean | undefined;
140
157
  /**
141
158
  * - The integer value is used to
142
159
  * know when an image must be resized (uses `OffscreenCanvas` in the worker).
@@ -198,15 +215,16 @@ export type DocumentInitParameters = {
198
215
  */
199
216
  pdfBug?: boolean | undefined;
200
217
  /**
201
- * - The factory instance that will be used
202
- * when creating canvases. The default value is {new DOMCanvasFactory()}.
218
+ * - The factory that will be used when
219
+ * creating canvases. The default value is {DOMCanvasFactory}.
203
220
  */
204
- canvasFactory?: Object | undefined;
221
+ CanvasFactory?: Object | undefined;
205
222
  /**
206
- * - A factory instance that will be used
207
- * to create SVG filters when rendering some images on the main canvas.
223
+ * - The factory that will be used to
224
+ * create SVG filters when rendering some images on the main canvas.
225
+ * The default value is {DOMFilterFactory}.
208
226
  */
209
- filterFactory?: Object | undefined;
227
+ FilterFactory?: Object | undefined;
210
228
  /**
211
229
  * - Enables hardware acceleration for
212
230
  * rendering. The default value is `false`.
@@ -535,10 +553,10 @@ export type PDFWorkerParameters = {
535
553
  };
536
554
  /** @type {string} */
537
555
  export const build: string;
538
- export const DefaultCanvasFactory: typeof NodeCanvasFactory;
539
- export const DefaultCMapReaderFactory: typeof NodeCMapReaderFactory;
556
+ export const DefaultCanvasFactory: typeof DOMCanvasFactory | typeof NodeCanvasFactory;
557
+ export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory;
540
558
  export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
541
- export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
559
+ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
542
560
  /**
543
561
  * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
544
562
  * Int16Array | Uint16Array |
@@ -619,6 +637,21 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
619
637
  * `OffscreenCanvas` in the worker. Primarily used to improve performance of
620
638
  * image conversion/rendering.
621
639
  * The default value is `true` in web environments and `false` in Node.js.
640
+ * @property {boolean} [isImageDecoderSupported] - Determines if we can use
641
+ * `ImageDecoder` in the worker. Primarily used to improve performance of
642
+ * image conversion/rendering.
643
+ * The default value is `true` in web environments and `false` in Node.js.
644
+ *
645
+ * NOTE: Also temporarily disabled in Chromium browsers, until we no longer
646
+ * support the affected browser versions, because of various bugs:
647
+ *
648
+ * - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf;
649
+ * see https://issues.chromium.org/issues/374807001
650
+ *
651
+ * - Broken images when using the JPEG decoder with images that have custom
652
+ * colour profiles, e.g. GitHub discussion 19030;
653
+ * see https://issues.chromium.org/issues/378869810
654
+ *
622
655
  * @property {number} [canvasMaxAreaInBytes] - The integer value is used to
623
656
  * know when an image must be resized (uses `OffscreenCanvas` in the worker).
624
657
  * If it's -1 then a possibly slow algorithm is used to guess the max value.
@@ -652,10 +685,11 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
652
685
  * disabling of pre-fetching to work correctly.
653
686
  * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js
654
687
  * (see `web/debugger.js`). The default value is `false`.
655
- * @property {Object} [canvasFactory] - The factory instance that will be used
656
- * when creating canvases. The default value is {new DOMCanvasFactory()}.
657
- * @property {Object} [filterFactory] - A factory instance that will be used
658
- * to create SVG filters when rendering some images on the main canvas.
688
+ * @property {Object} [CanvasFactory] - The factory that will be used when
689
+ * creating canvases. The default value is {DOMCanvasFactory}.
690
+ * @property {Object} [FilterFactory] - The factory that will be used to
691
+ * create SVG filters when rendering some images on the main canvas.
692
+ * The default value is {DOMFilterFactory}.
659
693
  * @property {boolean} [enableHWA] - Enables hardware acceleration for
660
694
  * rendering. The default value is `false`.
661
695
  */
@@ -674,7 +708,7 @@ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
674
708
  export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
675
709
  export class LoopbackPort {
676
710
  postMessage(obj: any, transfer: any): void;
677
- addEventListener(name: any, listener: any): void;
711
+ addEventListener(name: any, listener: any, options?: null): void;
678
712
  removeEventListener(name: any, listener: any): void;
679
713
  terminate(): void;
680
714
  #private;
@@ -693,9 +727,9 @@ export class PDFDataRangeTransport {
693
727
  * @param {boolean} [progressiveDone]
694
728
  * @param {string} [contentDispositionFilename]
695
729
  */
696
- constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean | undefined, contentDispositionFilename?: string | undefined);
730
+ constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean, contentDispositionFilename?: string);
697
731
  length: number;
698
- initialData: Uint8Array | null;
732
+ initialData: Uint8Array<ArrayBufferLike> | null;
699
733
  progressiveDone: boolean;
700
734
  contentDispositionFilename: string;
701
735
  _rangeListeners: any[];
@@ -753,7 +787,7 @@ export class PDFDataRangeTransport {
753
787
  * after which individual pages can be rendered.
754
788
  */
755
789
  export class PDFDocumentLoadingTask {
756
- static "__#46@#docId": number;
790
+ static "__#54@#docId": number;
757
791
  _capability: any;
758
792
  _transport: any;
759
793
  _worker: any;
@@ -804,6 +838,10 @@ export class PDFDocumentProxy {
804
838
  * @type {AnnotationStorage} Storage for annotation data in forms.
805
839
  */
806
840
  get annotationStorage(): AnnotationStorage;
841
+ /**
842
+ * @type {Object} The canvas factory instance.
843
+ */
844
+ get canvasFactory(): Object;
807
845
  /**
808
846
  * @type {Object} The filter factory instance.
809
847
  */
@@ -813,12 +851,12 @@ export class PDFDocumentProxy {
813
851
  */
814
852
  get numPages(): number;
815
853
  /**
816
- * @type {Array<string, string|null>} A (not guaranteed to be) unique ID to
817
- * identify the PDF document.
854
+ * @type {Array<string | null>} A (not guaranteed to be) unique ID to identify
855
+ * the PDF document.
818
856
  * NOTE: The first element will always be defined for all PDF documents,
819
857
  * whereas the second element is only defined for *modified* PDF documents.
820
858
  */
821
- get fingerprints(): string[];
859
+ get fingerprints(): Array<string | null>;
822
860
  /**
823
861
  * @type {boolean} True if only XFA form.
824
862
  */
@@ -931,7 +969,7 @@ export class PDFDocumentProxy {
931
969
  unsafeUrl: string | undefined;
932
970
  newWindow: boolean | undefined;
933
971
  count: number | undefined;
934
- items: Array<any>;
972
+ items: Array</*elided*/ any>;
935
973
  }>>;
936
974
  /**
937
975
  * @typedef {Object} GetOptionalContentConfigParameters
@@ -959,7 +997,7 @@ export class PDFDocumentProxy {
959
997
  * The default value is 'display'.
960
998
  */
961
999
  intent?: string | undefined;
962
- } | undefined): Promise<OptionalContentConfig>;
1000
+ }): Promise<OptionalContentConfig>;
963
1001
  /**
964
1002
  * @returns {Promise<Array<number> | null>} A promise that is resolved with
965
1003
  * an {Array} that contains the permission flags for the PDF document, or
@@ -1024,7 +1062,7 @@ export class PDFDocumentProxy {
1024
1062
  * option unless absolutely necessary. The default value is `false`.
1025
1063
  * @returns {Promise} A promise that is resolved when clean-up has finished.
1026
1064
  */
1027
- cleanup(keepLoadedFonts?: boolean | undefined): Promise<any>;
1065
+ cleanup(keepLoadedFonts?: boolean): Promise<any>;
1028
1066
  /**
1029
1067
  * Destroys the current document instance and terminates the worker.
1030
1068
  */
@@ -1264,7 +1302,7 @@ export class PDFPageProxy {
1264
1302
  * @type {Array<number>} An array of the visible portion of the PDF page in
1265
1303
  * user space units [x1, y1, x2, y2].
1266
1304
  */
1267
- get view(): number[];
1305
+ get view(): Array<number>;
1268
1306
  /**
1269
1307
  * @param {GetViewportParameters} params - Viewport parameters.
1270
1308
  * @returns {PageViewport} Contains 'width' and 'height' properties
@@ -1276,7 +1314,7 @@ export class PDFPageProxy {
1276
1314
  * @returns {Promise<Array<any>>} A promise that is resolved with an
1277
1315
  * {Array} of the annotation objects.
1278
1316
  */
1279
- getAnnotations({ intent }?: GetAnnotationsParameters | undefined): Promise<Array<any>>;
1317
+ getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
1280
1318
  /**
1281
1319
  * @returns {Promise<Object>} A promise that is resolved with an
1282
1320
  * {Object} with JS actions.
@@ -1347,7 +1385,7 @@ export class PDFPageProxy {
1347
1385
  * The default value is `false`.
1348
1386
  * @returns {boolean} Indicates if clean-up was successfully run.
1349
1387
  */
1350
- cleanup(resetStats?: boolean | undefined): boolean;
1388
+ cleanup(resetStats?: boolean): boolean;
1351
1389
  /**
1352
1390
  * @private
1353
1391
  */
@@ -1387,9 +1425,9 @@ export class PDFPageProxy {
1387
1425
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1388
1426
  */
1389
1427
  export class PDFWorker {
1390
- static "__#49@#fakeWorkerId": number;
1391
- static "__#49@#isWorkerDisabled": boolean;
1392
- static "__#49@#workerPorts": any;
1428
+ static "__#57@#fakeWorkerId": number;
1429
+ static "__#57@#isWorkerDisabled": boolean;
1430
+ static "__#57@#workerPorts": any;
1393
1431
  /**
1394
1432
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1395
1433
  */
@@ -1399,7 +1437,7 @@ export class PDFWorker {
1399
1437
  * @type {string}
1400
1438
  */
1401
1439
  static get workerSrc(): string;
1402
- static get "__#49@#mainThreadWorkerMessageHandler"(): any;
1440
+ static get "__#57@#mainThreadWorkerMessageHandler"(): any;
1403
1441
  static get _setupFakeWorkerGlobal(): any;
1404
1442
  constructor({ name, port, verbosity, }?: {
1405
1443
  name?: null | undefined;
@@ -1461,7 +1499,7 @@ export class RenderTask {
1461
1499
  *
1462
1500
  * @param {number} [extraDelay]
1463
1501
  */
1464
- cancel(extraDelay?: number | undefined): void;
1502
+ cancel(extraDelay?: number): void;
1465
1503
  /**
1466
1504
  * Whether form fields are rendered separately from the main operatorList.
1467
1505
  * @type {boolean}
@@ -1474,11 +1512,12 @@ export const version: string;
1474
1512
  import { PageViewport } from "./display_utils.js";
1475
1513
  import { OptionalContentConfig } from "./optional_content_config.js";
1476
1514
  import { PrintAnnotationStorage } from "./annotation_storage.js";
1515
+ import { DOMCanvasFactory } from "./canvas_factory.js";
1477
1516
  import { NodeCanvasFactory } from "./node_utils";
1478
- import { NodeCMapReaderFactory } from "./node_utils";
1479
- import { DOMFilterFactory } from "./display_utils.js";
1517
+ import { DOMCMapReaderFactory } from "./cmap_reader_factory";
1518
+ import { DOMFilterFactory } from "./filter_factory.js";
1480
1519
  import { NodeFilterFactory } from "./node_utils";
1481
- import { NodeStandardFontDataFactory } from "./node_utils";
1520
+ import { DOMStandardFontDataFactory } from "./standard_fontdata_factory";
1482
1521
  import { AnnotationStorage } from "./annotation_storage.js";
1483
1522
  import { Metadata } from "./metadata.js";
1484
1523
  import { StatTimer } from "./display_utils.js";
@@ -1500,12 +1539,17 @@ declare class PDFObjects {
1500
1539
  * @param {function} [callback]
1501
1540
  * @returns {any}
1502
1541
  */
1503
- get(objId: string, callback?: Function | undefined): any;
1542
+ get(objId: string, callback?: Function): any;
1504
1543
  /**
1505
1544
  * @param {string} objId
1506
1545
  * @returns {boolean}
1507
1546
  */
1508
1547
  has(objId: string): boolean;
1548
+ /**
1549
+ * @param {string} objId
1550
+ * @returns {boolean}
1551
+ */
1552
+ delete(objId: string): boolean;
1509
1553
  /**
1510
1554
  * Resolves the object `objId` with optional `data`.
1511
1555
  *
@@ -110,7 +110,7 @@ export class CanvasGraphics {
110
110
  setLeadingMoveText(x: any, y: any): void;
111
111
  setTextMatrix(a: any, b: any, c: any, d: any, e: any, f: any): void;
112
112
  nextLine(): void;
113
- paintChar(character: any, x: any, y: any, patternTransform: any): void;
113
+ paintChar(character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void;
114
114
  get isFontSubpixelAAEnabled(): any;
115
115
  showText(glyphs: any): void;
116
116
  showType3Text(glyphs: any): void;
@@ -179,6 +179,7 @@ declare class CanvasExtraState {
179
179
  fillColor: string;
180
180
  strokeColor: string;
181
181
  patternFill: boolean;
182
+ patternStroke: boolean;
182
183
  fillAlpha: number;
183
184
  strokeAlpha: number;
184
185
  lineWidth: number;
@@ -0,0 +1,27 @@
1
+ export class BaseCanvasFactory {
2
+ constructor({ enableHWA }: {
3
+ enableHWA?: boolean | undefined;
4
+ });
5
+ create(width: any, height: any): {
6
+ canvas: void;
7
+ context: any;
8
+ };
9
+ reset(canvasAndContext: any, width: any, height: any): void;
10
+ destroy(canvasAndContext: any): void;
11
+ /**
12
+ * @ignore
13
+ */
14
+ _createCanvas(width: any, height: any): void;
15
+ #private;
16
+ }
17
+ export class DOMCanvasFactory extends BaseCanvasFactory {
18
+ constructor({ ownerDocument, enableHWA }: {
19
+ ownerDocument?: Document | undefined;
20
+ enableHWA?: boolean | undefined;
21
+ });
22
+ _document: Document;
23
+ /**
24
+ * @ignore
25
+ */
26
+ _createCanvas(width: any, height: any): HTMLCanvasElement;
27
+ }
@@ -0,0 +1,25 @@
1
+ export class BaseCMapReaderFactory {
2
+ constructor({ baseUrl, isCompressed }: {
3
+ baseUrl?: null | undefined;
4
+ isCompressed?: boolean | undefined;
5
+ });
6
+ baseUrl: any;
7
+ isCompressed: boolean;
8
+ fetch({ name }: {
9
+ name: any;
10
+ }): Promise<{
11
+ cMapData: Uint8Array<ArrayBufferLike>;
12
+ isCompressed: boolean;
13
+ }>;
14
+ /**
15
+ * @ignore
16
+ * @returns {Promise<Uint8Array>}
17
+ */
18
+ _fetch(url: any): Promise<Uint8Array>;
19
+ }
20
+ export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
21
+ /**
22
+ * @ignore
23
+ */
24
+ _fetch(url: any): Promise<Uint8Array<any>>;
25
+ }
@@ -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,29 @@ 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
+ /**
101
+ * @type {number} Horizontal scale.
102
+ */
103
+ sx: number;
104
+ /**
105
+ * @type {number} Vertical scale.
106
+ */
107
+ sy: number;
108
+ /**
109
+ * @type {boolean} Returns `true` when scaling is required, `false` otherwise.
110
+ */
111
+ get scaled(): boolean;
112
+ get symmetric(): boolean;
113
+ }
145
114
  /**
146
115
  * @typedef {Object} PageViewportParameters
147
116
  * @property {Array<number>} viewBox - The xMin, yMin, xMax and
148
117
  * yMax coordinates.
118
+ * @property {number} userUnit - The size of units.
149
119
  * @property {number} scale - The scale of the viewport.
150
120
  * @property {number} rotation - The rotation, in degrees, of the viewport.
151
121
  * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The
@@ -175,8 +145,9 @@ export class PageViewport {
175
145
  /**
176
146
  * @param {PageViewportParameters}
177
147
  */
178
- constructor({ viewBox, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
148
+ constructor({ viewBox, userUnit, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
179
149
  viewBox: number[];
150
+ userUnit: number;
180
151
  scale: number;
181
152
  rotation: number;
182
153
  offsetX: number;
@@ -194,7 +165,7 @@ export class PageViewport {
194
165
  * @param {PageViewportCloneParameters} [params]
195
166
  * @returns {PageViewport} Cloned viewport.
196
167
  */
197
- clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters | undefined): PageViewport;
168
+ clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters): PageViewport;
198
169
  /**
199
170
  * Converts PDF point to the viewport coordinates. For examples, useful for
200
171
  * converting PDF location into canvas pixel coordinates.
@@ -226,6 +197,7 @@ export class PageViewport {
226
197
  convertToPdfPoint(x: number, y: number): any[];
227
198
  }
228
199
  export class PDFDateString {
200
+ static "__#2@#regex": any;
229
201
  /**
230
202
  * Convert a PDF date string to a JavaScript `Date` object.
231
203
  *
@@ -269,9 +241,6 @@ export class StatTimer {
269
241
  timeEnd(name: any): void;
270
242
  toString(): string;
271
243
  }
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";
244
+ export function stopEvent(e: any): void;
245
+ export const SVG_NS: "http://www.w3.org/2000/svg";
277
246
  export {};
@@ -5,33 +5,20 @@
5
5
  */
6
6
  export class DrawLayer {
7
7
  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;
8
+ static "__#32@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
14
9
  constructor({ pageIndex }: {
15
10
  pageIndex: any;
16
11
  });
17
12
  pageIndex: any;
18
13
  setParent(parent: any): void;
19
- highlight(outlines: any, color: any, opacity: any, isPathUpdatable?: boolean): {
14
+ draw(properties: any, isPathUpdatable?: boolean, hasClip?: boolean): {
20
15
  id: number;
21
16
  clipPathId: string;
22
17
  };
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;
18
+ drawOutline(properties: any, mustRemoveSelfIntersections: any): number;
19
+ finalizeDraw(id: any, properties: any): void;
20
+ updateProperties(elementOrId: any, properties: any): void;
21
+ updateParent(id: any, layer: any): void;
35
22
  remove(id: any): void;
36
23
  destroy(): void;
37
24
  #private;
@@ -1,6 +1,7 @@
1
1
  export class AltText {
2
- static _l10nPromise: null;
3
- static initialize(l10nPromise: any): void;
2
+ static "__#39@#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;