pdfjs-serverless 0.5.1 → 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 (66) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.mts +1 -0
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/types/src/display/annotation_layer.d.ts +14 -4
  6. package/dist/types/src/display/annotation_storage.d.ts +9 -0
  7. package/dist/types/src/display/api.d.ts +119 -53
  8. package/dist/types/src/display/canvas.d.ts +4 -1
  9. package/dist/types/src/display/canvas_factory.d.ts +27 -0
  10. package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
  11. package/dist/types/src/display/display_utils.d.ts +29 -59
  12. package/dist/types/src/display/draw_layer.d.ts +6 -19
  13. package/dist/types/src/display/editor/alt_text.d.ts +17 -5
  14. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +15 -9
  15. package/dist/types/src/display/editor/color_picker.d.ts +1 -0
  16. package/dist/types/src/display/editor/draw.d.ts +120 -0
  17. package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
  18. package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
  19. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +128 -0
  20. package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
  21. package/dist/types/src/display/editor/editor.d.ts +60 -12
  22. package/dist/types/src/display/editor/freetext.d.ts +7 -18
  23. package/dist/types/src/display/editor/highlight.d.ts +9 -27
  24. package/dist/types/src/display/editor/ink.d.ts +15 -73
  25. package/dist/types/src/display/editor/stamp.d.ts +27 -10
  26. package/dist/types/src/display/editor/toolbar.d.ts +3 -1
  27. package/dist/types/src/display/editor/tools.d.ts +32 -7
  28. package/dist/types/src/display/fetch_stream.d.ts +6 -13
  29. package/dist/types/src/display/filter_factory.d.ts +29 -0
  30. package/dist/types/src/display/font_loader.d.ts +3 -1
  31. package/dist/types/src/display/network.d.ts +10 -6
  32. package/dist/types/src/display/network_utils.d.ts +5 -3
  33. package/dist/types/src/display/node_stream.d.ts +7 -23
  34. package/dist/types/src/display/node_utils.d.ts +8 -11
  35. package/dist/types/src/display/optional_content_config.d.ts +1 -1
  36. package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
  37. package/dist/types/src/display/svg_factory.d.ts +14 -0
  38. package/dist/types/src/display/text_layer.d.ts +15 -13
  39. package/dist/types/src/display/touch_manager.d.ts +14 -0
  40. package/dist/types/src/display/transport_stream.d.ts +1 -1
  41. package/dist/types/src/display/worker_options.d.ts +2 -2
  42. package/dist/types/src/interfaces.d.ts +4 -0
  43. package/dist/types/src/pdf.d.ts +5 -6
  44. package/dist/types/src/shared/message_handler.d.ts +10 -4
  45. package/dist/types/src/shared/util.d.ts +12 -20
  46. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -2
  47. package/dist/types/web/annotation_layer_builder.d.ts +3 -1
  48. package/dist/types/web/app_options.d.ts +4 -2
  49. package/dist/types/web/download_manager.d.ts +1 -2
  50. package/dist/types/web/event_utils.d.ts +10 -8
  51. package/dist/types/web/genericl10n.d.ts +5 -5
  52. package/dist/types/web/interfaces.d.ts +7 -14
  53. package/dist/types/web/l10n.d.ts +6 -2
  54. package/dist/types/web/pdf_find_controller.d.ts +24 -0
  55. package/dist/types/web/pdf_link_service.d.ts +2 -2
  56. package/dist/types/web/pdf_page_view.d.ts +17 -17
  57. package/dist/types/web/pdf_rendering_queue.d.ts +1 -1
  58. package/dist/types/web/pdf_thumbnail_view.d.ts +11 -3
  59. package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -1
  60. package/dist/types/web/pdf_viewer.d.ts +24 -11
  61. package/dist/types/web/struct_tree_layer_builder.d.ts +4 -2
  62. package/dist/types/web/text_layer_builder.d.ts +5 -5
  63. package/dist/types/web/ui_utils.d.ts +10 -21
  64. package/package.json +19 -19
  65. package/dist/types/src/display/base_factory.d.ts +0 -56
  66. package/dist/types/src/display/editor/outliner.d.ts +0 -70
@@ -5,32 +5,25 @@ export type RenderingStates = any;
5
5
  * @interface
6
6
  */
7
7
  export class IDownloadManager {
8
- /**
9
- * @param {string} url
10
- * @param {string} filename
11
- * @param {Object} [options]
12
- */
13
- downloadUrl(url: string, filename: string, options?: Object | undefined): void;
14
8
  /**
15
9
  * @param {Uint8Array} data
16
10
  * @param {string} filename
17
11
  * @param {string} [contentType]
18
12
  */
19
- downloadData(data: Uint8Array, filename: string, contentType?: string | undefined): void;
13
+ downloadData(data: Uint8Array, filename: string, contentType?: string): void;
20
14
  /**
21
15
  * @param {Uint8Array} data
22
16
  * @param {string} filename
23
17
  * @param {string | null} [dest]
24
18
  * @returns {boolean} Indicating if the data was opened.
25
19
  */
26
- openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null | undefined): boolean;
20
+ openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null): boolean;
27
21
  /**
28
- * @param {Blob} blob
22
+ * @param {Uint8Array} data
29
23
  * @param {string} url
30
24
  * @param {string} filename
31
- * @param {Object} [options]
32
25
  */
33
- download(blob: Blob, url: string, filename: string, options?: Object | undefined): void;
26
+ download(data: Uint8Array, url: string, filename: string): void;
34
27
  }
35
28
  /**
36
29
  * @interface
@@ -53,7 +46,7 @@ export class IL10n {
53
46
  * @param {string} [fallback]
54
47
  * @returns {Promise<string>}
55
48
  */
56
- get(ids: any[] | string, args?: Object | null | undefined, fallback?: string | undefined): Promise<string>;
49
+ get(ids: any[] | string, args?: Object | null, fallback?: string): Promise<string>;
57
50
  /**
58
51
  * Translates HTML element.
59
52
  * @param {HTMLElement} element
@@ -121,7 +114,7 @@ export class IPDFLinkService {
121
114
  * @param {string} url
122
115
  * @param {boolean} [newWindow]
123
116
  */
124
- addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
117
+ addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean): void;
125
118
  /**
126
119
  * @param dest - The PDF destination object.
127
120
  * @returns {string} The hyperlink to the PDF object.
@@ -166,7 +159,7 @@ export class IRenderableView {
166
159
  /**
167
160
  * @type {RenderingStates}
168
161
  */
169
- get renderingState(): any;
162
+ get renderingState(): RenderingStates;
170
163
  /**
171
164
  * @returns {Promise} Resolved on draw completion.
172
165
  */
@@ -7,8 +7,8 @@ export const GenericL10n: null;
7
7
  * @implements {IL10n}
8
8
  */
9
9
  export class L10n implements IL10n {
10
- static "__#58@#fixupLangCode"(langCode: any): any;
11
- static "__#58@#isRTL"(lang: any): boolean;
10
+ static "__#68@#fixupLangCode"(langCode: any): any;
11
+ static "__#68@#isRTL"(lang: any): boolean;
12
12
  constructor({ lang, isRTL }: {
13
13
  lang: any;
14
14
  isRTL: any;
@@ -23,6 +23,10 @@ export class L10n implements IL10n {
23
23
  /** @inheritdoc */
24
24
  translate(element: any): Promise<void>;
25
25
  /** @inheritdoc */
26
+ translateOnce(element: any): Promise<void>;
27
+ /** @inheritdoc */
28
+ destroy(): Promise<void>;
29
+ /** @inheritdoc */
26
30
  pause(): void;
27
31
  /** @inheritdoc */
28
32
  resume(): void;
@@ -104,5 +104,29 @@ export class PDFFindController {
104
104
  _resumePageIdx: any;
105
105
  _firstPageCapability: any;
106
106
  _rawQuery: any;
107
+ /**
108
+ * @typedef {Object} FindMatch
109
+ * @property {number} index - The start of the matched text in the page's
110
+ * string contents.
111
+ * @property {number} length - The length of the matched text.
112
+ */
113
+ /**
114
+ * @param {string | string[]} query - The search query.
115
+ * @param {string} pageContent - The text content of the page to search in.
116
+ * @param {number} pageIndex - The index of the page that is being processed.
117
+ * @returns {FindMatch[] | undefined} An array of matches in the provided
118
+ * page.
119
+ */
120
+ match(query: string | string[], pageContent: string, pageIndex: number): {
121
+ /**
122
+ * - The start of the matched text in the page's
123
+ * string contents.
124
+ */
125
+ index: number;
126
+ /**
127
+ * - The length of the matched text.
128
+ */
129
+ length: number;
130
+ }[] | undefined;
107
131
  #private;
108
132
  }
@@ -48,7 +48,7 @@ export namespace LinkTarget {
48
48
  * @implements {IPDFLinkService}
49
49
  */
50
50
  export class PDFLinkService implements IPDFLinkService {
51
- static "__#55@#isValidExplicitDest"(dest: any): boolean;
51
+ static "__#65@#isValidExplicitDest"(dest: any): boolean;
52
52
  /**
53
53
  * @param {PDFLinkServiceOptions} options
54
54
  */
@@ -107,7 +107,7 @@ export class PDFLinkService implements IPDFLinkService {
107
107
  * @param {string} url
108
108
  * @param {boolean} [newWindow]
109
109
  */
110
- addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
110
+ addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean): void;
111
111
  /**
112
112
  * @param {string|Array} dest - The PDF destination object.
113
113
  * @returns {string} The hyperlink to the PDF object.
@@ -27,7 +27,7 @@ export type PDFPageViewOptions = {
27
27
  defaultViewport: PageViewport;
28
28
  /**
29
29
  * -
30
- * A promise that is resolved with an {@link OptionalContentConfig } instance.
30
+ * A promise that is resolved with an {@link OptionalContentConfig} instance.
31
31
  * The default value is `null`.
32
32
  */
33
33
  optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
@@ -44,8 +44,8 @@ export type PDFPageViewOptions = {
44
44
  /**
45
45
  * - Controls if the annotation layer is
46
46
  * created, and if interactive form elements or `AnnotationStorage`-data are
47
- * being rendered. The constants from {@link AnnotationMode } should be used;
48
- * see also {@link RenderParameters } and {@link GetOperatorListParameters }.
47
+ * being rendered. The constants from {@link AnnotationMode} should be used;
48
+ * see also {@link RenderParameters} and {@link GetOperatorListParameters}.
49
49
  * The default value is `AnnotationMode.ENABLE_FORMS`.
50
50
  */
51
51
  annotationMode?: number | undefined;
@@ -75,6 +75,11 @@ export type PDFPageViewOptions = {
75
75
  * the necessary layer-properties.
76
76
  */
77
77
  layerProperties?: Object | undefined;
78
+ /**
79
+ * - Enables hardware acceleration for
80
+ * rendering. The default value is `false`.
81
+ */
82
+ enableHWA?: boolean | undefined;
78
83
  };
79
84
  /**
80
85
  * @implements {IRenderableView}
@@ -105,9 +110,8 @@ export class PDFPageView implements IRenderableView {
105
110
  _container: HTMLDivElement | undefined;
106
111
  _annotationCanvasMap: any;
107
112
  annotationLayer: AnnotationLayerBuilder | null;
108
- annotationEditorLayer: AnnotationEditorLayerBuilder | null;
113
+ annotationEditorLayer: any;
109
114
  textLayer: TextLayerBuilder | null;
110
- zoomLayer: ParentNode | null;
111
115
  xfaLayer: XfaLayerBuilder | null;
112
116
  structTreeLayer: any;
113
117
  drawLayer: any;
@@ -116,18 +120,17 @@ export class PDFPageView implements IRenderableView {
116
120
  get renderingState(): number;
117
121
  setPdfPage(pdfPage: any): void;
118
122
  destroy(): void;
123
+ hasEditableAnnotations(): boolean;
119
124
  get _textHighlighter(): any;
120
- /**
121
- * @private
122
- */
123
- private _resetZoomLayer;
124
- reset({ keepZoomLayer, keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, }?: {
125
- keepZoomLayer?: boolean | undefined;
125
+ canvas: HTMLCanvasElement | null | undefined;
126
+ reset({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, keepCanvasWrapper, }?: {
126
127
  keepAnnotationLayer?: boolean | undefined;
127
128
  keepAnnotationEditorLayer?: boolean | undefined;
128
129
  keepXfaLayer?: boolean | undefined;
129
130
  keepTextLayer?: boolean | undefined;
131
+ keepCanvasWrapper?: boolean | undefined;
130
132
  }): void;
133
+ toggleEditingMode(isEditing: any): void;
131
134
  /**
132
135
  * @typedef {Object} PDFPageViewUpdateParameters
133
136
  * @property {number} [scale] The new scale, if specified.
@@ -151,7 +154,7 @@ export class PDFPageView implements IRenderableView {
151
154
  */
152
155
  rotation?: number | undefined;
153
156
  /**
154
- * A promise that is resolved with an {@link OptionalContentConfig }instance. The default value is `null`.
157
+ * A promise that is resolved with an {@link OptionalContentConfig}instance. The default value is `null`.
155
158
  */
156
159
  optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
157
160
  drawingDelay?: number | undefined;
@@ -167,8 +170,7 @@ export class PDFPageView implements IRenderableView {
167
170
  keepTextLayer?: boolean | undefined;
168
171
  cancelExtraDelay?: number | undefined;
169
172
  }): void;
170
- cssTransform({ target, redrawAnnotationLayer, redrawAnnotationEditorLayer, redrawXfaLayer, redrawTextLayer, hideTextLayer, }: {
171
- target: any;
173
+ cssTransform({ redrawAnnotationLayer, redrawAnnotationEditorLayer, redrawXfaLayer, redrawTextLayer, hideTextLayer, }: {
172
174
  redrawAnnotationLayer?: boolean | undefined;
173
175
  redrawAnnotationEditorLayer?: boolean | undefined;
174
176
  redrawXfaLayer?: boolean | undefined;
@@ -179,7 +181,6 @@ export class PDFPageView implements IRenderableView {
179
181
  get height(): number;
180
182
  getPagePoint(x: any, y: any): any[];
181
183
  draw(): Promise<any>;
182
- canvas: HTMLCanvasElement | undefined;
183
184
  outputScale: OutputScale | undefined;
184
185
  /**
185
186
  * @param {string|null} label
@@ -194,7 +195,6 @@ export class PDFPageView implements IRenderableView {
194
195
  }
195
196
  import { GenericL10n } from "./genericl10n";
196
197
  import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
197
- import { AnnotationEditorLayerBuilder } from "./annotation_editor_layer_builder.js";
198
198
  import { TextLayerBuilder } from "./text_layer_builder.js";
199
199
  import { XfaLayerBuilder } from "./xfa_layer_builder.js";
200
- import { OutputScale } from "./ui_utils.js";
200
+ import { OutputScale } from "../src/pdf";
@@ -36,7 +36,7 @@ export class PDFRenderingQueue {
36
36
  * @param {boolean} scrolledDown
37
37
  * @param {boolean} [preRenderExtra]
38
38
  */
39
- getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean | undefined): any;
39
+ getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean): any;
40
40
  /**
41
41
  * @param {IRenderableView} view
42
42
  * @returns {boolean}
@@ -23,7 +23,7 @@ export type PDFThumbnailViewOptions = {
23
23
  defaultViewport: PageViewport;
24
24
  /**
25
25
  * -
26
- * A promise that is resolved with an {@link OptionalContentConfig } instance.
26
+ * A promise that is resolved with an {@link OptionalContentConfig} instance.
27
27
  * The default value is `null`.
28
28
  */
29
29
  optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
@@ -41,6 +41,11 @@ export type PDFThumbnailViewOptions = {
41
41
  * mode.
42
42
  */
43
43
  pageColors?: Object | undefined;
44
+ /**
45
+ * - Enables hardware acceleration for
46
+ * rendering. The default value is `false`.
47
+ */
48
+ enableHWA?: boolean | undefined;
44
49
  };
45
50
  /**
46
51
  * @implements {IRenderableView}
@@ -49,7 +54,7 @@ export class PDFThumbnailView implements IRenderableView {
49
54
  /**
50
55
  * @param {PDFThumbnailViewOptions} options
51
56
  */
52
- constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, pageColors, }: PDFThumbnailViewOptions);
57
+ constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, pageColors, enableHWA, }: PDFThumbnailViewOptions);
53
58
  id: number;
54
59
  renderingId: string;
55
60
  pageLabel: string | null;
@@ -59,6 +64,7 @@ export class PDFThumbnailView implements IRenderableView {
59
64
  pdfPageRotate: number;
60
65
  _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
61
66
  pageColors: Object | null;
67
+ enableHWA: boolean;
62
68
  eventBus: import("./event_utils").EventBus;
63
69
  linkService: import("./interfaces").IPDFLinkService;
64
70
  renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
@@ -104,9 +110,11 @@ export class PDFThumbnailView implements IRenderableView {
104
110
  * @property {Object} [pageColors] - Overwrites background and foreground colors
105
111
  * with user defined ones in order to improve readability in high contrast
106
112
  * mode.
113
+ * @property {boolean} [enableHWA] - Enables hardware acceleration for
114
+ * rendering. The default value is `false`.
107
115
  */
108
116
  export class TempImageFactory {
109
- static "__#69@#tempCanvas": null;
117
+ static "__#79@#tempCanvas": null;
110
118
  static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
111
119
  static destroyCanvas(): void;
112
120
  }
@@ -27,6 +27,16 @@ export type PDFThumbnailViewerOptions = {
27
27
  * mode.
28
28
  */
29
29
  pageColors?: Object | undefined;
30
+ /**
31
+ * - The AbortSignal for the window
32
+ * events.
33
+ */
34
+ abortSignal?: AbortSignal | undefined;
35
+ /**
36
+ * - Enables hardware acceleration for
37
+ * rendering. The default value is `false`.
38
+ */
39
+ enableHWA?: boolean | undefined;
30
40
  };
31
41
  /**
32
42
  * @typedef {Object} PDFThumbnailViewerOptions
@@ -38,6 +48,10 @@ export type PDFThumbnailViewerOptions = {
38
48
  * @property {Object} [pageColors] - Overwrites background and foreground colors
39
49
  * with user defined ones in order to improve readability in high contrast
40
50
  * mode.
51
+ * @property {AbortSignal} [abortSignal] - The AbortSignal for the window
52
+ * events.
53
+ * @property {boolean} [enableHWA] - Enables hardware acceleration for
54
+ * rendering. The default value is `false`.
41
55
  */
42
56
  /**
43
57
  * Viewer control to display thumbnails for pages in a PDF document.
@@ -46,12 +60,13 @@ export class PDFThumbnailViewer {
46
60
  /**
47
61
  * @param {PDFThumbnailViewerOptions} options
48
62
  */
49
- constructor({ container, eventBus, linkService, renderingQueue, pageColors, }: PDFThumbnailViewerOptions);
63
+ constructor({ container, eventBus, linkService, renderingQueue, pageColors, abortSignal, enableHWA, }: PDFThumbnailViewerOptions);
50
64
  container: HTMLDivElement;
51
65
  eventBus: import("./event_utils").EventBus;
52
66
  linkService: import("./interfaces").IPDFLinkService;
53
67
  renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
54
68
  pageColors: Object | null;
69
+ enableHWA: boolean;
55
70
  scroll: {
56
71
  right: boolean;
57
72
  down: boolean;
@@ -58,14 +58,14 @@ export type PDFViewerOptions = {
58
58
  /**
59
59
  * - Controls if the annotation layer is
60
60
  * created, and if interactive form elements or `AnnotationStorage`-data are
61
- * being rendered. The constants from {@link AnnotationMode } should be used;
62
- * see also {@link RenderParameters } and {@link GetOperatorListParameters }.
61
+ * being rendered. The constants from {@link AnnotationMode} should be used;
62
+ * see also {@link RenderParameters} and {@link GetOperatorListParameters}.
63
63
  * The default value is `AnnotationMode.ENABLE_FORMS`.
64
64
  */
65
65
  annotationMode?: number | undefined;
66
66
  /**
67
67
  * - Enables the creation and editing
68
- * of new Annotations. The constants from {@link AnnotationEditorType } should
68
+ * of new Annotations. The constants from {@link AnnotationEditorType} should
69
69
  * be used. The default value is `AnnotationEditorType.NONE`.
70
70
  */
71
71
  annotationEditorMode?: number | undefined;
@@ -105,6 +105,16 @@ export type PDFViewerOptions = {
105
105
  * mode.
106
106
  */
107
107
  pageColors?: Object | undefined;
108
+ /**
109
+ * - Enables hardware acceleration for
110
+ * rendering. The default value is `false`.
111
+ */
112
+ enableHWA?: boolean | undefined;
113
+ /**
114
+ * - Enable zooming on pinch gesture.
115
+ * The default value is `true`.
116
+ */
117
+ supportsPinchToZoom?: boolean | undefined;
108
118
  };
109
119
  export namespace PagesCountLimit {
110
120
  let FORCE_SCROLL_MODE_PAGE: number;
@@ -152,6 +162,10 @@ export namespace PagesCountLimit {
152
162
  * @property {Object} [pageColors] - Overwrites background and foreground colors
153
163
  * with user defined ones in order to improve readability in high contrast
154
164
  * mode.
165
+ * @property {boolean} [enableHWA] - Enables hardware acceleration for
166
+ * rendering. The default value is `false`.
167
+ * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
168
+ * The default value is `true`.
155
169
  */
156
170
  export class PDFPageViewBuffer {
157
171
  constructor(size: any);
@@ -165,7 +179,7 @@ export class PDFPageViewBuffer {
165
179
  */
166
180
  resize(newSize: any, idsToKeep?: null): void;
167
181
  has(view: any): boolean;
168
- [Symbol.iterator](): IterableIterator<any>;
182
+ [Symbol.iterator](): SetIterator<any>;
169
183
  #private;
170
184
  }
171
185
  /**
@@ -231,7 +245,7 @@ export class PDFViewer {
231
245
  /**
232
246
  * @param {string} val - The page label.
233
247
  */
234
- set currentPageLabel(val: string | null);
248
+ set currentPageLabel(val: string);
235
249
  /**
236
250
  * @type {string|null} Returns the current page label, or `null` if no page
237
251
  * labels exist.
@@ -368,11 +382,11 @@ export class PDFViewer {
368
382
  * @param {Promise<OptionalContentConfig>} promise - A promise that is
369
383
  * resolved with an {@link OptionalContentConfig} instance.
370
384
  */
371
- set optionalContentConfigPromise(promise: Promise<import("../src/display/optional_content_config").OptionalContentConfig | null>);
385
+ set optionalContentConfigPromise(promise: Promise<OptionalContentConfig>);
372
386
  /**
373
387
  * @type {Promise<OptionalContentConfig | null>}
374
388
  */
375
- get optionalContentConfigPromise(): Promise<import("../src/display/optional_content_config").OptionalContentConfig | null>;
389
+ get optionalContentConfigPromise(): Promise<OptionalContentConfig | null>;
376
390
  /**
377
391
  * @param {number} mode - The direction in which the document pages should be
378
392
  * laid out within the scrolling container.
@@ -430,7 +444,7 @@ export class PDFViewer {
430
444
  * transformation origin.
431
445
  */
432
446
  origin?: any[] | undefined;
433
- } | undefined): void;
447
+ }): void;
434
448
  /**
435
449
  * Increase the current zoom level one, or more, times.
436
450
  * @param {ChangeScaleOptions} [options]
@@ -444,7 +458,7 @@ export class PDFViewer {
444
458
  * transformation origin.
445
459
  */
446
460
  origin?: any[] | undefined;
447
- } | undefined): void;
461
+ }): void;
448
462
  /**
449
463
  * Decrease the current zoom level one, or more, times.
450
464
  * @param {ChangeScaleOptions} [options]
@@ -458,7 +472,7 @@ export class PDFViewer {
458
472
  * transformation origin.
459
473
  */
460
474
  origin?: any[] | undefined;
461
- } | undefined): void;
475
+ }): void;
462
476
  get containerTopLeft(): number[];
463
477
  /**
464
478
  * @typedef {Object} AnnotationEditorModeOptions
@@ -500,7 +514,6 @@ export class PDFViewer {
500
514
  */
501
515
  isFromKeyboard?: boolean | undefined;
502
516
  };
503
- set annotationEditorParams({ type, value }: any);
504
517
  refresh(noUpdate?: boolean, updateArgs?: any): void;
505
518
  #private;
506
519
  }
@@ -1,7 +1,9 @@
1
1
  export class StructTreeLayerBuilder {
2
- get renderingDone(): boolean;
3
- render(structTree: any): HTMLSpanElement | null;
2
+ constructor(pdfPage: any, rawDims: any);
3
+ render(): Promise<any>;
4
+ getAriaAttributes(annotationId: any): Promise<any>;
4
5
  hide(): void;
5
6
  show(): void;
7
+ addElementsToTextLayer(): void;
6
8
  #private;
7
9
  }
@@ -26,10 +26,10 @@ export type TextLayerBuilderOptions = {
26
26
  * contain text that matches the PDF text they are overlaying.
27
27
  */
28
28
  export class TextLayerBuilder {
29
- static "__#65@#textLayers": Map<any, any>;
30
- static "__#65@#selectionChangeAbortController": null;
31
- static "__#65@#removeGlobalSelectionListener"(textLayerDiv: any): void;
32
- static "__#65@#enableGlobalSelectionListener"(): void;
29
+ static "__#75@#textLayers": Map<any, any>;
30
+ static "__#75@#selectionChangeAbortController": null;
31
+ static "__#75@#removeGlobalSelectionListener"(textLayerDiv: any): void;
32
+ static "__#75@#enableGlobalSelectionListener"(): void;
33
33
  constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: {
34
34
  pdfPage: any;
35
35
  highlighter?: null | undefined;
@@ -46,7 +46,7 @@ export class TextLayerBuilder {
46
46
  * @param {PageViewport} viewport
47
47
  * @param {Object} [textContentParams]
48
48
  */
49
- render(viewport: PageViewport, textContentParams?: Object | undefined): Promise<void>;
49
+ render(viewport: PageViewport, textContentParams?: Object): Promise<void>;
50
50
  hide(): void;
51
51
  show(): void;
52
52
  /**
@@ -66,6 +66,7 @@ export function apiPageModeToSidebarView(mode: string): number;
66
66
  * @param {number} x - Positive float number.
67
67
  * @returns {Array} Estimated fraction: the first array item is a numerator,
68
68
  * the second one is a denominator.
69
+ * They are both natural numbers.
69
70
  */
70
71
  export function approximateFraction(x: number): any[];
71
72
  export const AutoPrintRegExp: RegExp;
@@ -91,6 +92,7 @@ export function backtrackBeforeAllVisibleElements(index: number, views: any[], t
91
92
  * or |items.length| if no such element exists.
92
93
  */
93
94
  export function binarySearchFirstItem(items: any, condition: any, start?: number): number;
95
+ export const calcRound: ((x: number) => number) | ((x: any) => any);
94
96
  export namespace CursorTool {
95
97
  let SELECT: number;
96
98
  let HAND: number;
@@ -100,6 +102,11 @@ export const DEFAULT_SCALE: 1;
100
102
  export const DEFAULT_SCALE_DELTA: 1.1;
101
103
  export const DEFAULT_SCALE_VALUE: "auto";
102
104
  export const docStyle: CSSStyleDeclaration | null;
105
+ /**
106
+ * @param {number} x - A positive number to round to a multiple of `div`.
107
+ * @param {number} div - A natural number.
108
+ */
109
+ export function floorToDivide(x: number, div: number): number;
103
110
  /**
104
111
  * Get the active or focused element in current DOM.
105
112
  *
@@ -170,23 +177,6 @@ export const MAX_SCALE: 10;
170
177
  export const MIN_SCALE: 0.1;
171
178
  export function normalizeWheelEventDelta(evt: any): number;
172
179
  export function normalizeWheelEventDirection(evt: any): number;
173
- /**
174
- * Scale factors for the canvas, necessary with HiDPI displays.
175
- */
176
- export class OutputScale {
177
- /**
178
- * @type {number} Horizontal scale.
179
- */
180
- sx: number;
181
- /**
182
- * @type {number} Vertical scale.
183
- */
184
- sy: number;
185
- /**
186
- * @type {boolean} Returns `true` when scaling is required, `false` otherwise.
187
- */
188
- get scaled(): boolean;
189
- }
190
180
  /**
191
181
  * Helper function to parse query string (e.g. ?param1=value&param2=...).
192
182
  * @param {string} query
@@ -213,14 +203,13 @@ export class ProgressBar {
213
203
  * @param {string} str
214
204
  * @param {boolean} [replaceInvisible]
215
205
  */
216
- export function removeNullCharacters(str: string, replaceInvisible?: boolean | undefined): string;
206
+ export function removeNullCharacters(str: string, replaceInvisible?: boolean): string;
217
207
  export namespace RenderingStates {
218
208
  let INITIAL: number;
219
209
  let RUNNING: number;
220
210
  let PAUSED: number;
221
211
  let FINISHED: number;
222
212
  }
223
- export function roundToDivide(x: any, div: any): any;
224
213
  export const SCROLLBAR_PADDING: 40;
225
214
  /**
226
215
  * Scrolls specified element into view of its parent.
@@ -236,7 +225,7 @@ export const SCROLLBAR_PADDING: 40;
236
225
  export function scrollIntoView(element: HTMLElement, spot?: {
237
226
  left?: number | undefined;
238
227
  top?: number | undefined;
239
- } | undefined, scrollMatches?: boolean | undefined): void;
228
+ }, scrollMatches?: boolean): void;
240
229
  export namespace ScrollMode {
241
230
  let UNKNOWN_1: number;
242
231
  export { UNKNOWN_1 as UNKNOWN };
@@ -275,7 +264,7 @@ export const VERTICAL_PADDING: 5;
275
264
  * Helper function to start monitoring the scroll event and converting them into
276
265
  * PDF.js friendly one: with scroll debounce and scroll direction.
277
266
  */
278
- export function watchScroll(viewAreaElement: any, callback: any): {
267
+ export function watchScroll(viewAreaElement: any, callback: any, abortSignal?: undefined): {
279
268
  right: boolean;
280
269
  down: boolean;
281
270
  lastX: any;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "pdfjs-serverless",
3
3
  "type": "module",
4
- "version": "0.5.1",
5
- "packageManager": "pnpm@9.3.0",
4
+ "version": "0.7.0",
5
+ "packageManager": "pnpm@10.4.1",
6
6
  "description": "Serverless build of PDF.js for Deno, workers, and other nodeless environments",
7
7
  "author": "Johann Schopplich <hello@johannschopplich.com>",
8
8
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  "sideEffects": false,
26
26
  "exports": {
27
27
  ".": {
28
- "types": "./dist/index.d.ts",
28
+ "types": "./dist/index.d.mts",
29
29
  "import": "./dist/index.mjs"
30
30
  }
31
31
  },
@@ -39,29 +39,29 @@
39
39
  "build": "pnpm run build:pre && pnpm run build:post",
40
40
  "lint": "eslint .",
41
41
  "lint:fix": "eslint . --fix",
42
- "release": "bumpp --commit --push --tag"
42
+ "release": "bumpp"
43
43
  },
44
44
  "devDependencies": {
45
- "@antfu/eslint-config": "^2.21.1",
46
- "@rollup/plugin-alias": "^5.1.0",
47
- "@rollup/plugin-commonjs": "^26.0.1",
45
+ "@antfu/eslint-config": "^4.3.0",
46
+ "@rollup/plugin-alias": "^5.1.1",
47
+ "@rollup/plugin-commonjs": "^28.0.2",
48
48
  "@rollup/plugin-inject": "^5.0.5",
49
- "@rollup/plugin-node-resolve": "^15.2.3",
50
- "@rollup/plugin-replace": "^5.0.7",
49
+ "@rollup/plugin-node-resolve": "^16.0.0",
50
+ "@rollup/plugin-replace": "^6.0.2",
51
51
  "@rollup/plugin-terser": "^0.4.4",
52
- "@rollup/plugin-typescript": "^11.1.6",
53
- "@types/node": "^20.14.2",
54
- "bumpp": "^9.4.1",
55
- "eslint": "^9.4.0",
56
- "pdfjs-dist": "^4.3.136",
57
- "rollup": "^4.18.0",
58
- "tslib": "^2.6.3",
59
- "typescript": "^5.4.5",
60
- "unenv": "^1.9.0"
52
+ "@rollup/plugin-typescript": "^12.1.2",
53
+ "@types/node": "^22.13.4",
54
+ "bumpp": "^10.0.3",
55
+ "eslint": "^9.20.1",
56
+ "pdfjs-dist": "^4.10.38",
57
+ "rollup": "^4.34.8",
58
+ "tslib": "^2.8.1",
59
+ "typescript": "^5.7.3",
60
+ "unenv": "^1.10.0"
61
61
  },
62
62
  "pnpm": {
63
63
  "patchedDependencies": {
64
- "pdfjs-dist@4.3.136": "patches/pdfjs-dist@4.3.136.patch"
64
+ "pdfjs-dist@4.10.38": "patches/pdfjs-dist@4.10.38.patch"
65
65
  }
66
66
  }
67
67
  }