pdfjs-serverless 1.0.1 → 1.2.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 (86) hide show
  1. package/README.md +14 -44
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/types/src/display/annotation_layer.d.ts +49 -16
  5. package/dist/types/src/display/annotation_storage.d.ts +10 -8
  6. package/dist/types/src/display/api.d.ts +134 -126
  7. package/dist/types/src/display/api_utils.d.ts +13 -0
  8. package/dist/types/src/display/binary_data_factory.d.ts +26 -0
  9. package/dist/types/src/display/canvas.d.ts +97 -92
  10. package/dist/types/src/display/canvas_dependency_tracker.d.ts +216 -0
  11. package/dist/types/src/display/canvas_factory.d.ts +3 -1
  12. package/dist/types/src/display/display_utils.d.ts +27 -3
  13. package/dist/types/src/display/draw_layer.d.ts +2 -6
  14. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  15. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -19
  16. package/dist/types/src/display/editor/color_picker.d.ts +20 -1
  17. package/dist/types/src/display/editor/comment.d.ts +59 -0
  18. package/dist/types/src/display/editor/draw.d.ts +4 -8
  19. package/dist/types/src/display/editor/drawers/freedraw.d.ts +4 -3
  20. package/dist/types/src/display/editor/drawers/highlight.d.ts +2 -1
  21. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  22. package/dist/types/src/display/editor/editor.d.ts +119 -15
  23. package/dist/types/src/display/editor/freetext.d.ts +11 -7
  24. package/dist/types/src/display/editor/highlight.d.ts +8 -3
  25. package/dist/types/src/display/editor/ink.d.ts +5 -0
  26. package/dist/types/src/display/editor/signature.d.ts +2 -5
  27. package/dist/types/src/display/editor/stamp.d.ts +3 -1
  28. package/dist/types/src/display/editor/toolbar.d.ts +8 -3
  29. package/dist/types/src/display/editor/tools.d.ts +72 -6
  30. package/dist/types/src/display/fetch_stream.d.ts +3 -56
  31. package/dist/types/src/display/font_loader.d.ts +28 -1
  32. package/dist/types/src/display/network.d.ts +14 -80
  33. package/dist/types/src/display/network_stream.d.ts +2 -0
  34. package/dist/types/src/display/network_utils.d.ts +3 -3
  35. package/dist/types/src/display/node_stream.d.ts +2 -52
  36. package/dist/types/src/display/node_utils.d.ts +5 -19
  37. package/dist/types/src/display/obj_bin_transform_display.d.ts +67 -0
  38. package/dist/types/src/display/pages_mapper.d.ts +72 -0
  39. package/dist/types/src/display/pattern_helper.d.ts +9 -4
  40. package/dist/types/src/display/pdf_objects.d.ts +40 -0
  41. package/dist/types/src/display/text_layer.d.ts +16 -10
  42. package/dist/types/src/display/text_layer_images.d.ts +10 -0
  43. package/dist/types/src/display/transport_stream.d.ts +8 -64
  44. package/dist/types/src/display/webgpu_mesh.d.ts +3 -0
  45. package/dist/types/src/display/worker_options.d.ts +2 -2
  46. package/dist/types/src/display/xfa_layer.d.ts +3 -3
  47. package/dist/types/src/pdf.d.ts +11 -2
  48. package/dist/types/src/{interfaces.d.ts → shared/base_pdf_stream.d.ts} +26 -27
  49. package/dist/types/src/shared/obj_bin_transform_utils.d.ts +26 -0
  50. package/dist/types/src/shared/scripting_utils.d.ts +2 -0
  51. package/dist/types/src/shared/util.d.ts +21 -8
  52. package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
  53. package/dist/types/web/annotation_layer_builder.d.ts +18 -23
  54. package/dist/types/web/app_options.d.ts +1 -1
  55. package/dist/types/web/autolinker.d.ts +3 -2
  56. package/dist/types/web/base_download_manager.d.ts +24 -0
  57. package/dist/types/web/base_pdf_page_view.d.ts +7 -6
  58. package/dist/types/web/comment_manager.d.ts +20 -0
  59. package/dist/types/web/download_manager.d.ts +3 -12
  60. package/dist/types/web/draw_layer_builder.d.ts +0 -12
  61. package/dist/types/web/event_utils.d.ts +1 -1
  62. package/dist/types/web/genericl10n.d.ts +6 -10
  63. package/dist/types/web/l10n.d.ts +3 -6
  64. package/dist/types/web/menu.d.ts +11 -0
  65. package/dist/types/web/pdf_find_controller.d.ts +10 -12
  66. package/dist/types/web/pdf_history.d.ts +3 -3
  67. package/dist/types/web/pdf_link_service.d.ts +10 -7
  68. package/dist/types/web/pdf_page_detail_view.d.ts +2 -7
  69. package/dist/types/web/pdf_page_view.d.ts +39 -17
  70. package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
  71. package/dist/types/web/pdf_thumbnail_view.d.ts +18 -50
  72. package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
  73. package/dist/types/web/pdf_viewer.component.d.ts +1 -1
  74. package/dist/types/web/pdf_viewer.d.ts +95 -29
  75. package/dist/types/web/renderable_view.d.ts +33 -0
  76. package/dist/types/web/sidebar.d.ts +65 -0
  77. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  78. package/dist/types/web/text_accessibility.d.ts +1 -1
  79. package/dist/types/web/text_layer_builder.d.ts +11 -6
  80. package/dist/types/web/ui_utils.d.ts +3 -11
  81. package/dist/types/web/xfa_layer_builder.d.ts +4 -4
  82. package/package.json +18 -15
  83. package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
  84. package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
  85. package/dist/types/src/display/wasm_factory.d.ts +0 -20
  86. package/dist/types/web/interfaces.d.ts +0 -167
@@ -3,11 +3,11 @@ export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
3
3
  export type PageViewport = import("../src/display/display_utils").PageViewport;
4
4
  export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
5
5
  export type EventBus = import("./event_utils").EventBus;
6
- export type IDownloadManager = import("./interfaces").IDownloadManager;
7
- export type IL10n = import("./interfaces").IL10n;
8
- export type IPDFLinkService = import("./interfaces").IPDFLinkService;
9
6
  export type PDFFindController = import("./pdf_find_controller").PDFFindController;
10
7
  export type PDFScriptingManager = import("./pdf_scripting_manager").PDFScriptingManager;
8
+ export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
9
+ export type BaseDownloadManager = import("./base_download_manager.js").BaseDownloadManager;
10
+ export type L10n = import("./l10n.js").L10n;
11
11
  export type PDFViewerOptions = {
12
12
  /**
13
13
  * - The container for the viewer element.
@@ -24,12 +24,12 @@ export type PDFViewerOptions = {
24
24
  /**
25
25
  * - The navigation/linking service.
26
26
  */
27
- linkService?: import("./interfaces").IPDFLinkService | undefined;
27
+ linkService?: import("./pdf_link_service.js").PDFLinkService | undefined;
28
28
  /**
29
29
  * - The download manager
30
30
  * component.
31
31
  */
32
- downloadManager?: import("./interfaces").IDownloadManager | undefined;
32
+ downloadManager?: import("./base_download_manager.js").BaseDownloadManager | undefined;
33
33
  /**
34
34
  * - The find controller
35
35
  * component.
@@ -96,6 +96,12 @@ export type PDFViewerOptions = {
96
96
  * The default value is 32767.
97
97
  */
98
98
  maxCanvasDim?: number | undefined;
99
+ /**
100
+ * - Cap the canvas area to the
101
+ * viewport increased by the value in percent. Use `-1` for no limit.
102
+ * The default value is 200%.
103
+ */
104
+ capCanvasAreaFactor?: number | undefined;
99
105
  /**
100
106
  * - When enabled, if the rendered
101
107
  * pages would need a canvas that is larger than `maxCanvasPixels` or
@@ -104,10 +110,23 @@ export type PDFViewerOptions = {
104
110
  * The default value is `true`.
105
111
  */
106
112
  enableDetailCanvas?: boolean | undefined;
113
+ /**
114
+ * - All images whose width and
115
+ * height are at least this value (in pixels) will be lazily inserted in the
116
+ * dom to allow right-clicking and saving them. Use `-1` to disable this.
117
+ */
118
+ imagesRightClickMinSize?: number | undefined;
119
+ /**
120
+ * - When enabled, PDF
121
+ * rendering will keep track of which areas of the page each PDF operation
122
+ * affects. Then, when rendering a partial page (if `enableDetailCanvas` is
123
+ * enabled), it will only run through the operations that affect that portion.
124
+ */
125
+ enableOptimizedPartialRendering?: boolean | undefined;
107
126
  /**
108
127
  * - Localization service.
109
128
  */
110
- l10n?: import("./interfaces").IL10n | undefined;
129
+ l10n?: import("./l10n.js").L10n | undefined;
111
130
  /**
112
131
  * - Enables PDF document permissions,
113
132
  * when they exist. The default value is `false`.
@@ -119,11 +138,6 @@ export type PDFViewerOptions = {
119
138
  * mode.
120
139
  */
121
140
  pageColors?: Object | undefined;
122
- /**
123
- * - Enables hardware acceleration for
124
- * rendering. The default value is `false`.
125
- */
126
- enableHWA?: boolean | undefined;
127
141
  /**
128
142
  * - Enable zooming on pinch gesture.
129
143
  * The default value is `true`.
@@ -134,6 +148,11 @@ export type PDFViewerOptions = {
134
148
  * text that look like URLs. The default value is `true`.
135
149
  */
136
150
  enableAutoLinking?: boolean | undefined;
151
+ /**
152
+ * - Minimum duration to wait
153
+ * before updating the canvas. The default value is `500`.
154
+ */
155
+ minDurationToUpdateCanvas?: number | undefined;
137
156
  };
138
157
  export namespace PagesCountLimit {
139
158
  let FORCE_SCROLL_MODE_PAGE: number;
@@ -145,8 +164,8 @@ export namespace PagesCountLimit {
145
164
  * @property {HTMLDivElement} container - The container for the viewer element.
146
165
  * @property {HTMLDivElement} [viewer] - The viewer element.
147
166
  * @property {EventBus} eventBus - The application event bus.
148
- * @property {IPDFLinkService} [linkService] - The navigation/linking service.
149
- * @property {IDownloadManager} [downloadManager] - The download manager
167
+ * @property {PDFLinkService} [linkService] - The navigation/linking service.
168
+ * @property {BaseDownloadManager} [downloadManager] - The download manager
150
169
  * component.
151
170
  * @property {PDFFindController} [findController] - The find controller
152
171
  * component.
@@ -178,23 +197,33 @@ export namespace PagesCountLimit {
178
197
  * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
179
198
  * in either width or height. Use `-1` for no limit.
180
199
  * The default value is 32767.
200
+ * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the
201
+ * viewport increased by the value in percent. Use `-1` for no limit.
202
+ * The default value is 200%.
181
203
  * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered
182
204
  * pages would need a canvas that is larger than `maxCanvasPixels` or
183
205
  * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
184
206
  * that only renders the part of the page that is close to the viewport.
185
207
  * The default value is `true`.
186
- * @property {IL10n} [l10n] - Localization service.
208
+ * @property {number} [imagesRightClickMinSize] - All images whose width and
209
+ * height are at least this value (in pixels) will be lazily inserted in the
210
+ * dom to allow right-clicking and saving them. Use `-1` to disable this.
211
+ * @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF
212
+ * rendering will keep track of which areas of the page each PDF operation
213
+ * affects. Then, when rendering a partial page (if `enableDetailCanvas` is
214
+ * enabled), it will only run through the operations that affect that portion.
215
+ * @property {L10n} [l10n] - Localization service.
187
216
  * @property {boolean} [enablePermissions] - Enables PDF document permissions,
188
217
  * when they exist. The default value is `false`.
189
218
  * @property {Object} [pageColors] - Overwrites background and foreground colors
190
219
  * with user defined ones in order to improve readability in high contrast
191
220
  * mode.
192
- * @property {boolean} [enableHWA] - Enables hardware acceleration for
193
- * rendering. The default value is `false`.
194
221
  * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
195
222
  * The default value is `true`.
196
223
  * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from
197
224
  * text that look like URLs. The default value is `true`.
225
+ * @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait
226
+ * before updating the canvas. The default value is `500`.
198
227
  */
199
228
  export class PDFPageViewBuffer {
200
229
  constructor(size: any);
@@ -222,8 +251,8 @@ export class PDFViewer {
222
251
  container: HTMLDivElement;
223
252
  viewer: Element | null;
224
253
  eventBus: import("./event_utils").EventBus;
225
- linkService: import("./interfaces").IPDFLinkService | SimpleLinkService;
226
- downloadManager: import("./interfaces").IDownloadManager | null;
254
+ linkService: import("./pdf_link_service.js").PDFLinkService;
255
+ downloadManager: import("./base_download_manager.js").BaseDownloadManager | null;
227
256
  findController: import("./pdf_find_controller").PDFFindController | null;
228
257
  _scriptingManager: import("./pdf_scripting_manager").PDFScriptingManager | null;
229
258
  imageResourcesPath: string;
@@ -231,8 +260,11 @@ export class PDFViewer {
231
260
  removePageBorders: boolean | undefined;
232
261
  maxCanvasPixels: number | undefined;
233
262
  maxCanvasDim: number | undefined;
263
+ capCanvasAreaFactor: number | undefined;
234
264
  enableDetailCanvas: boolean;
235
- l10n: import("./interfaces").IL10n | GenericL10n | undefined;
265
+ enableOptimizedPartialRendering: boolean;
266
+ imagesRightClickMinSize: number;
267
+ l10n: import("./l10n.js").L10n | undefined;
236
268
  pageColors: Object | null;
237
269
  defaultRenderingQueue: boolean;
238
270
  renderingQueue: PDFRenderingQueue | undefined;
@@ -244,6 +276,7 @@ export class PDFViewer {
244
276
  _eventHandler: (evt: any) => void;
245
277
  };
246
278
  presentationModeState: number;
279
+ get printingAllowed(): boolean;
247
280
  get pagesCount(): number;
248
281
  getPageView(index: any): any;
249
282
  getCachedPageViews(): Set<any>;
@@ -311,7 +344,7 @@ export class PDFViewer {
311
344
  get onePageRendered(): any;
312
345
  get pagesPromise(): any;
313
346
  get _layerProperties(): any;
314
- getAllText(): Promise<string | null>;
347
+ getAllText(interruptSignal?: null): Promise<string | null>;
315
348
  /**
316
349
  * @param {PDFDocumentProxy} pdfDocument
317
350
  */
@@ -319,13 +352,19 @@ export class PDFViewer {
319
352
  pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
320
353
  _scrollMode: any;
321
354
  _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null | undefined;
355
+ onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }: {
356
+ pagesMapper: any;
357
+ type: any;
358
+ hasBeenCut: any;
359
+ pageNumbers: any;
360
+ }): void;
361
+ _pages: any[] | undefined;
322
362
  /**
323
363
  * @param {Array|null} labels
324
364
  */
325
365
  setPageLabels(labels: any[] | null): void;
326
366
  _pageLabels: any[] | null | undefined;
327
367
  _resetView(): void;
328
- _pages: any[] | undefined;
329
368
  _currentScale: any;
330
369
  _currentScaleValue: any;
331
370
  _location: {
@@ -357,12 +396,15 @@ export class PDFViewer {
357
396
  * The default value is `false`.
358
397
  * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in
359
398
  * the destination array. The default value is `false`.
399
+ * @property {string} [center] - Center the view on the specified coordinates.
400
+ * The default value is `null`. Possible values are: `null` (don't center),
401
+ * `horizontal`, `vertical` and `both`.
360
402
  */
361
403
  /**
362
404
  * Scrolls page into view.
363
405
  * @param {ScrollPageIntoViewParameters} params
364
406
  */
365
- scrollPageIntoView({ pageNumber, destArray, allowNegativeOffset, ignoreDestinationZoom, }: {
407
+ scrollPageIntoView({ pageNumber, destArray, allowNegativeOffset, ignoreDestinationZoom, center, }: {
366
408
  /**
367
409
  * - The page number.
368
410
  */
@@ -382,6 +424,12 @@ export class PDFViewer {
382
424
  * the destination array. The default value is `false`.
383
425
  */
384
426
  ignoreDestinationZoom?: boolean | undefined;
427
+ /**
428
+ * - Center the view on the specified coordinates.
429
+ * The default value is `null`. Possible values are: `null` (don't center),
430
+ * `horizontal`, `vertical` and `both`.
431
+ */
432
+ center?: string | undefined;
385
433
  }): void;
386
434
  _updateLocation(firstPage: any): void;
387
435
  update(): void;
@@ -440,10 +488,6 @@ export class PDFViewer {
440
488
  */
441
489
  get spreadMode(): number;
442
490
  _updateSpreadMode(pageNumber?: null): void;
443
- /**
444
- * @private
445
- */
446
- private _getPageAdvance;
447
491
  /**
448
492
  * Go to the next page, taking scroll/spread-modes into account.
449
493
  * @returns {boolean} Whether navigation occurred.
@@ -511,11 +555,15 @@ export class PDFViewer {
511
555
  * @property {string|null} [editId] - ID of the existing annotation to edit.
512
556
  * @property {boolean} [isFromKeyboard] - True if the mode change is due to a
513
557
  * keyboard action.
558
+ * @property {boolean} [mustEnterInEditMode] - True if the editor must enter
559
+ * edit mode.
560
+ * @property {boolean} [editComment] - True if the editor must enter
561
+ * comment edit mode.
514
562
  */
515
563
  /**
516
564
  * @param {AnnotationEditorModeOptions} options
517
565
  */
518
- set annotationEditorMode({ mode, editId, isFromKeyboard }: {
566
+ set annotationEditorMode({ mode, editId, isFromKeyboard, mustEnterInEditMode, editComment, }: {
519
567
  /**
520
568
  * - The editor mode (none, FreeText, ink, ...).
521
569
  */
@@ -529,6 +577,16 @@ export class PDFViewer {
529
577
  * keyboard action.
530
578
  */
531
579
  isFromKeyboard?: boolean | undefined;
580
+ /**
581
+ * - True if the editor must enter
582
+ * edit mode.
583
+ */
584
+ mustEnterInEditMode?: boolean | undefined;
585
+ /**
586
+ * - True if the editor must enter
587
+ * comment edit mode.
588
+ */
589
+ editComment?: boolean | undefined;
532
590
  });
533
591
  get annotationEditorMode(): {
534
592
  /**
@@ -544,10 +602,18 @@ export class PDFViewer {
544
602
  * keyboard action.
545
603
  */
546
604
  isFromKeyboard?: boolean | undefined;
605
+ /**
606
+ * - True if the editor must enter
607
+ * edit mode.
608
+ */
609
+ mustEnterInEditMode?: boolean | undefined;
610
+ /**
611
+ * - True if the editor must enter
612
+ * comment edit mode.
613
+ */
614
+ editComment?: boolean | undefined;
547
615
  };
548
616
  refresh(noUpdate?: boolean, updateArgs?: any): void;
549
617
  #private;
550
618
  }
551
619
  import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
552
- import { SimpleLinkService } from "./pdf_link_service.js";
553
- import { GenericL10n } from "./genericl10n";
@@ -0,0 +1,33 @@
1
+ export class RenderableView {
2
+ /**
3
+ * Unique ID for rendering queue.
4
+ * @type {string}
5
+ */
6
+ renderingId: string;
7
+ /**
8
+ * @type {import("../src/display/api").RenderTask | null}
9
+ */
10
+ renderTask: import("../src/display/api").RenderTask | null;
11
+ /**
12
+ * @type {function | null}
13
+ */
14
+ resume: Function | null;
15
+ /**
16
+ * @param {number} state
17
+ */
18
+ set renderingState(state: number);
19
+ /**
20
+ * @type {number}
21
+ */
22
+ get renderingState(): number;
23
+ /**
24
+ * @returns {Promise} Resolved on draw completion.
25
+ */
26
+ draw(): Promise<any>;
27
+ }
28
+ export namespace RenderingStates {
29
+ let INITIAL: number;
30
+ let RUNNING: number;
31
+ let PAUSED: number;
32
+ let FINISHED: number;
33
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Viewer control to display a sidebar with resizer functionality.
3
+ */
4
+ export class Sidebar {
5
+ /**
6
+ * @typedef {Object} SidebarElements
7
+ * @property {HTMLElement} sidebar - The sidebar element.
8
+ * @property {HTMLElement} resizer - The sidebar resizer element.
9
+ * @property {HTMLElement} toggleButton - The button used to toggle the
10
+ * sidebar.
11
+ */
12
+ /**
13
+ * Create a sidebar with resizer functionality.
14
+ * @param {SidebarElements} sidebarElements
15
+ * @param {boolean} ltr
16
+ * @param {boolean} isResizerOnTheLeft
17
+ */
18
+ constructor({ sidebar, resizer, toggleButton }: {
19
+ /**
20
+ * - The sidebar element.
21
+ */
22
+ sidebar: HTMLElement;
23
+ /**
24
+ * - The sidebar resizer element.
25
+ */
26
+ resizer: HTMLElement;
27
+ /**
28
+ * - The button used to toggle the
29
+ * sidebar.
30
+ */
31
+ toggleButton: HTMLElement;
32
+ }, ltr: boolean, isResizerOnTheLeft: boolean, globalAbortSignal: any);
33
+ _sidebar: HTMLElement;
34
+ _isOpen: boolean;
35
+ /**
36
+ * Set the width of the sidebar in pixels.
37
+ * @param {number} newWidth
38
+ */
39
+ set width(newWidth: number);
40
+ /**
41
+ * Get the current width of the sidebar in pixels.
42
+ * @returns {number}
43
+ */
44
+ get width(): number;
45
+ /**
46
+ * Callback to be executed when the user starts resizing the sidebar.
47
+ */
48
+ onStartResizing(): void;
49
+ /**
50
+ * Callback to be executed when the user stops resizing the sidebar.
51
+ */
52
+ onStopResizing(): void;
53
+ /**
54
+ * Callback to be executed when the sidebar is being resized.
55
+ * @param {number} newWidth - The new width of the sidebar in pixels.
56
+ */
57
+ onResizing(_newWidth: any): void;
58
+ /**
59
+ * Toggle the sidebar's visibility.
60
+ * @param {boolean} [visibility] - The visibility state to set.
61
+ */
62
+ toggle(visibility?: boolean): void;
63
+ destroy(): void;
64
+ #private;
65
+ }
@@ -20,6 +20,6 @@ export class StructTreeLayerBuilder {
20
20
  getAriaAttributes(annotationId: any): Promise<any>;
21
21
  hide(): void;
22
22
  show(): void;
23
- addElementsToTextLayer(): void;
23
+ updateTextLayer(): void;
24
24
  #private;
25
25
  }
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
14
14
  * @param {HTMLElement} e2
15
15
  * @returns {number}
16
16
  */
17
- static "__#6@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
17
+ static "__#private@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
18
18
  setTextMapping(textDivs: any): void;
19
19
  /**
20
20
  * Function called when the text layer has finished rendering.
@@ -1,5 +1,6 @@
1
1
  export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
2
  export type PageViewport = import("../src/display/display_utils").PageViewport;
3
+ export type TextLayerImages = import("../src/display/text_layer_images.js").TextLayerImages;
3
4
  export type TextHighlighter = import("./text_highlighter").TextHighlighter;
4
5
  export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
5
6
  export type TextLayerBuilderOptions = {
@@ -12,9 +13,11 @@ export type TextLayerBuilderOptions = {
12
13
  accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
13
14
  enablePermissions?: boolean | undefined;
14
15
  onAppend?: Function | undefined;
16
+ abortSignal?: AbortSignal | undefined;
15
17
  };
16
18
  export type TextLayerBuilderRenderOptions = {
17
19
  viewport: PageViewport;
20
+ images: TextLayerImages;
18
21
  textContentParams?: Object | undefined;
19
22
  };
20
23
  /**
@@ -25,10 +28,12 @@ export type TextLayerBuilderRenderOptions = {
25
28
  * @property {TextAccessibilityManager} [accessibilityManager]
26
29
  * @property {boolean} [enablePermissions]
27
30
  * @property {function} [onAppend]
31
+ * @property {AbortSignal} [abortSignal]
28
32
  */
29
33
  /**
30
34
  * @typedef {Object} TextLayerBuilderRenderOptions
31
35
  * @property {PageViewport} viewport
36
+ * @property {TextLayerImages} images
32
37
  * @property {Object} [textContentParams]
33
38
  */
34
39
  /**
@@ -37,14 +42,14 @@ export type TextLayerBuilderRenderOptions = {
37
42
  * contain text that matches the PDF text they are overlaying.
38
43
  */
39
44
  export class TextLayerBuilder {
40
- static "__#78@#textLayers": Map<any, any>;
41
- static "__#78@#selectionChangeAbortController": null;
42
- static "__#78@#removeGlobalSelectionListener"(textLayerDiv: any): void;
43
- static "__#78@#enableGlobalSelectionListener"(): void;
45
+ static "__#private@#textLayers": Map<any, any>;
46
+ static "__#private@#selectionChangeAbortController": null;
47
+ static "__#private@#removeGlobalSelectionListener"(textLayerDiv: any): void;
48
+ static "__#private@#enableGlobalSelectionListener"(globalAbortSignal: any): void;
44
49
  /**
45
50
  * @param {TextLayerBuilderOptions} options
46
51
  */
47
- constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: TextLayerBuilderOptions);
52
+ constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, abortSignal, }: TextLayerBuilderOptions);
48
53
  pdfPage: import("../src/display/api").PDFPageProxy;
49
54
  highlighter: import("./text_highlighter").TextHighlighter;
50
55
  accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager;
@@ -54,7 +59,7 @@ export class TextLayerBuilder {
54
59
  * @param {TextLayerBuilderRenderOptions} options
55
60
  * @returns {Promise<void>}
56
61
  */
57
- render({ viewport, textContentParams }: TextLayerBuilderRenderOptions): Promise<void>;
62
+ render({ viewport, images, textContentParams }: TextLayerBuilderRenderOptions): Promise<void>;
58
63
  hide(): void;
59
64
  show(): void;
60
65
  /**
@@ -173,7 +173,7 @@ export function isValidRotation(angle: any): boolean;
173
173
  export function isValidScrollMode(mode: any): boolean;
174
174
  export function isValidSpreadMode(mode: any): boolean;
175
175
  export const MAX_AUTO_SCALE: 1.25;
176
- export const MAX_SCALE: 10;
176
+ export const MAX_SCALE: 25;
177
177
  export const MIN_SCALE: 0.1;
178
178
  export function normalizeWheelEventDelta(evt: any): number;
179
179
  export function normalizeWheelEventDirection(evt: any): number;
@@ -204,12 +204,6 @@ export class ProgressBar {
204
204
  * @param {boolean} [replaceInvisible]
205
205
  */
206
206
  export function removeNullCharacters(str: string, replaceInvisible?: boolean): string;
207
- export namespace RenderingStates {
208
- let INITIAL: number;
209
- let RUNNING: number;
210
- let PAUSED: number;
211
- let FINISHED: number;
212
- }
213
207
  export const SCROLLBAR_PADDING: 40;
214
208
  /**
215
209
  * Scrolls specified element into view of its parent.
@@ -218,14 +212,11 @@ export const SCROLLBAR_PADDING: 40;
218
212
  * specifying the offset from the top left edge.
219
213
  * @param {number} [spot.left]
220
214
  * @param {number} [spot.top]
221
- * @param {boolean} [scrollMatches] - When scrolling search results into view,
222
- * ignore elements that either: Contains marked content identifiers,
223
- * or have the CSS-rule `overflow: hidden;` set. The default value is `false`.
224
215
  */
225
216
  export function scrollIntoView(element: HTMLElement, spot?: {
226
217
  left?: number | undefined;
227
218
  top?: number | undefined;
228
- }, scrollMatches?: boolean): void;
219
+ }): void;
229
220
  export namespace ScrollMode {
230
221
  let UNKNOWN_1: number;
231
222
  export { UNKNOWN_1 as UNKNOWN };
@@ -258,6 +249,7 @@ export namespace TextLayerMode {
258
249
  }
259
250
  export function toggleCheckedBtn(button: any, toggle: any, view?: null): void;
260
251
  export function toggleExpandedBtn(button: any, toggle: any, view?: null): void;
252
+ export function toggleSelectedBtn(button: any, toggle: any, view?: null): void;
261
253
  export const UNKNOWN_SCALE: 0;
262
254
  export const VERTICAL_PADDING: 5;
263
255
  /**
@@ -1,11 +1,11 @@
1
1
  export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
2
  export type AnnotationStorage = import("../src/display/annotation_storage").AnnotationStorage;
3
3
  export type PageViewport = import("../src/display/display_utils").PageViewport;
4
- export type IPDFLinkService = import("./interfaces").IPDFLinkService;
4
+ export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
5
5
  export type XfaLayerBuilderOptions = {
6
6
  pdfPage: PDFPageProxy;
7
7
  annotationStorage?: import("../src/display/annotation_storage").AnnotationStorage | undefined;
8
- linkService: IPDFLinkService;
8
+ linkService: PDFLinkService;
9
9
  xfaHtml?: Object | undefined;
10
10
  };
11
11
  export type XfaLayerBuilderRenderOptions = {
@@ -19,7 +19,7 @@ export type XfaLayerBuilderRenderOptions = {
19
19
  * @typedef {Object} XfaLayerBuilderOptions
20
20
  * @property {PDFPageProxy} pdfPage
21
21
  * @property {AnnotationStorage} [annotationStorage]
22
- * @property {IPDFLinkService} linkService
22
+ * @property {PDFLinkService} linkService
23
23
  * @property {Object} [xfaHtml]
24
24
  */
25
25
  /**
@@ -34,7 +34,7 @@ export class XfaLayerBuilder {
34
34
  constructor({ pdfPage, annotationStorage, linkService, xfaHtml, }: XfaLayerBuilderOptions);
35
35
  pdfPage: import("../src/display/api").PDFPageProxy;
36
36
  annotationStorage: import("../src/display/annotation_storage").AnnotationStorage;
37
- linkService: import("./interfaces").IPDFLinkService;
37
+ linkService: import("./pdf_link_service.js").PDFLinkService;
38
38
  xfaHtml: Object;
39
39
  div: HTMLDivElement | null;
40
40
  _cancelled: boolean;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pdfjs-serverless",
3
3
  "type": "module",
4
- "version": "1.0.1",
5
- "packageManager": "pnpm@10.12.1",
6
- "description": "Serverless redistribution of PDF.js for edge environments",
4
+ "version": "1.2.0",
5
+ "packageManager": "pnpm@10.33.0",
6
+ "description": "PDF.js redistributed as a single bundle for edge and serverless runtimes",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
8
  "license": "MIT",
9
9
  "homepage": "https://github.com/johannschopplich/pdfjs-serverless#readme",
@@ -15,11 +15,15 @@
15
15
  "url": "https://github.com/johannschopplich/pdfjs-serverless/issues"
16
16
  },
17
17
  "keywords": [
18
+ "cloudflare",
19
+ "edge",
18
20
  "nodeless",
19
21
  "parse",
20
22
  "pdf",
23
+ "pdf.js",
21
24
  "pdfjs-dist",
22
25
  "serverless",
26
+ "text-extraction",
23
27
  "workers"
24
28
  ],
25
29
  "sideEffects": false,
@@ -42,18 +46,17 @@
42
46
  "release": "bumpp"
43
47
  },
44
48
  "devDependencies": {
45
- "@antfu/eslint-config": "^4.14.1",
46
- "@rollup/plugin-inject": "^5.0.5",
47
- "@rollup/plugin-node-resolve": "^16.0.1",
48
- "@rollup/plugin-replace": "^6.0.2",
49
- "@rollup/plugin-terser": "^0.4.4",
50
- "@rollup/plugin-typescript": "^12.1.2",
51
- "@types/node": "^22.15.31",
52
- "bumpp": "^10.1.1",
53
- "eslint": "^9.28.0",
54
- "pdfjs-dist": "~5.2.133",
55
- "rollup": "^4.42.0",
49
+ "@antfu/eslint-config": "^8.2.0",
50
+ "@rollup/plugin-node-resolve": "^16.0.3",
51
+ "@rollup/plugin-replace": "^6.0.3",
52
+ "@rollup/plugin-terser": "^1.0.0",
53
+ "@rollup/plugin-typescript": "^12.3.0",
54
+ "@types/node": "^24.12.2",
55
+ "bumpp": "^11.0.1",
56
+ "eslint": "^10.2.0",
57
+ "pdfjs-dist": "~5.6.205",
58
+ "rollup": "^4.60.1",
56
59
  "tslib": "^2.8.1",
57
- "typescript": "^5.8.3"
60
+ "typescript": "^6.0.2"
58
61
  }
59
62
  }
@@ -1,25 +0,0 @@
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
- }
@@ -1,20 +0,0 @@
1
- export class BaseStandardFontDataFactory {
2
- constructor({ baseUrl }: {
3
- baseUrl?: null | undefined;
4
- });
5
- baseUrl: any;
6
- fetch({ filename }: {
7
- filename: any;
8
- }): Promise<Uint8Array<ArrayBufferLike>>;
9
- /**
10
- * @ignore
11
- * @returns {Promise<Uint8Array>}
12
- */
13
- _fetch(url: any): Promise<Uint8Array>;
14
- }
15
- export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
16
- /**
17
- * @ignore
18
- */
19
- _fetch(url: any): Promise<Uint8Array<any>>;
20
- }
@@ -1,20 +0,0 @@
1
- export class BaseWasmFactory {
2
- constructor({ baseUrl }: {
3
- baseUrl?: null | undefined;
4
- });
5
- baseUrl: any;
6
- fetch({ filename }: {
7
- filename: any;
8
- }): Promise<Uint8Array<ArrayBufferLike>>;
9
- /**
10
- * @ignore
11
- * @returns {Promise<Uint8Array>}
12
- */
13
- _fetch(url: any): Promise<Uint8Array>;
14
- }
15
- export class DOMWasmFactory extends BaseWasmFactory {
16
- /**
17
- * @ignore
18
- */
19
- _fetch(url: any): Promise<Uint8Array<any>>;
20
- }