unpdf 0.12.2 → 1.0.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 (80) hide show
  1. package/README.md +147 -79
  2. package/dist/index.cjs +118 -73
  3. package/dist/index.d.cts +24 -41
  4. package/dist/index.d.mts +24 -41
  5. package/dist/index.d.ts +24 -41
  6. package/dist/index.mjs +117 -72
  7. package/dist/pdfjs.mjs +1 -1
  8. package/dist/types/src/display/annotation_layer.d.ts +25 -1
  9. package/dist/types/src/display/annotation_storage.d.ts +1 -8
  10. package/dist/types/src/display/api.d.ts +147 -57
  11. package/dist/types/src/display/canvas.d.ts +21 -28
  12. package/dist/types/src/display/canvas_factory.d.ts +27 -0
  13. package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
  14. package/dist/types/src/display/display_utils.d.ts +40 -60
  15. package/dist/types/src/display/draw_layer.d.ts +7 -19
  16. package/dist/types/src/display/editor/alt_text.d.ts +3 -2
  17. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -11
  18. package/dist/types/src/display/editor/color_picker.d.ts +1 -0
  19. package/dist/types/src/display/editor/draw.d.ts +121 -0
  20. package/dist/types/src/display/editor/drawers/contour.d.ts +3 -0
  21. package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
  22. package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
  23. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +129 -0
  24. package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
  25. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +79 -0
  26. package/dist/types/src/display/editor/editor.d.ts +55 -13
  27. package/dist/types/src/display/editor/freetext.d.ts +5 -16
  28. package/dist/types/src/display/editor/highlight.d.ts +8 -25
  29. package/dist/types/src/display/editor/ink.d.ts +21 -74
  30. package/dist/types/src/display/editor/signature.d.ts +80 -0
  31. package/dist/types/src/display/editor/stamp.d.ts +16 -22
  32. package/dist/types/src/display/editor/toolbar.d.ts +5 -2
  33. package/dist/types/src/display/editor/tools.d.ts +17 -9
  34. package/dist/types/src/display/fetch_stream.d.ts +6 -13
  35. package/dist/types/src/display/filter_factory.d.ts +29 -0
  36. package/dist/types/src/display/font_loader.d.ts +3 -6
  37. package/dist/types/src/display/metadata.d.ts +1 -2
  38. package/dist/types/src/display/network.d.ts +11 -7
  39. package/dist/types/src/display/network_utils.d.ts +7 -6
  40. package/dist/types/src/display/node_stream.d.ts +6 -22
  41. package/dist/types/src/display/node_utils.d.ts +15 -11
  42. package/dist/types/src/display/optional_content_config.d.ts +2 -2
  43. package/dist/types/src/display/pattern_helper.d.ts +4 -2
  44. package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
  45. package/dist/types/src/display/svg_factory.d.ts +14 -0
  46. package/dist/types/src/display/text_layer.d.ts +12 -9
  47. package/dist/types/src/display/touch_manager.d.ts +18 -0
  48. package/dist/types/src/display/transport_stream.d.ts +1 -1
  49. package/dist/types/src/display/wasm_factory.d.ts +20 -0
  50. package/dist/types/src/display/worker_options.d.ts +2 -2
  51. package/dist/types/src/interfaces.d.ts +4 -0
  52. package/dist/types/src/pdf.d.ts +13 -5
  53. package/dist/types/src/shared/message_handler.d.ts +9 -4
  54. package/dist/types/src/shared/util.d.ts +137 -129
  55. package/dist/types/web/annotation_editor_layer_builder.d.ts +20 -5
  56. package/dist/types/web/annotation_layer_builder.d.ts +35 -4
  57. package/dist/types/web/app_options.d.ts +1 -1
  58. package/dist/types/web/autolinker.d.ts +28 -0
  59. package/dist/types/web/base_pdf_page_view.d.ts +27 -0
  60. package/dist/types/web/draw_layer_builder.d.ts +13 -2
  61. package/dist/types/web/event_utils.d.ts +2 -2
  62. package/dist/types/web/genericl10n.d.ts +5 -5
  63. package/dist/types/web/interfaces.d.ts +5 -5
  64. package/dist/types/web/l10n.d.ts +2 -2
  65. package/dist/types/web/pdf_find_controller.d.ts +2 -0
  66. package/dist/types/web/pdf_link_service.d.ts +1 -2
  67. package/dist/types/web/pdf_page_detail_view.d.ts +32 -0
  68. package/dist/types/web/pdf_page_view.d.ts +44 -23
  69. package/dist/types/web/pdf_rendering_queue.d.ts +2 -1
  70. package/dist/types/web/pdf_thumbnail_view.d.ts +23 -3
  71. package/dist/types/web/pdf_thumbnail_viewer.d.ts +21 -1
  72. package/dist/types/web/pdf_viewer.d.ts +44 -16
  73. package/dist/types/web/struct_tree_layer_builder.d.ts +20 -2
  74. package/dist/types/web/text_accessibility.d.ts +1 -1
  75. package/dist/types/web/text_layer_builder.d.ts +25 -17
  76. package/dist/types/web/ui_utils.d.ts +3 -19
  77. package/dist/types/web/xfa_layer_builder.d.ts +14 -3
  78. package/package.json +31 -28
  79. package/dist/types/src/display/base_factory.d.ts +0 -60
  80. package/dist/types/src/display/editor/outliner.d.ts +0 -70
@@ -9,14 +9,14 @@ export class GenericL10n extends L10n implements IL10n {
9
9
  * translations.
10
10
  * @param {String} baseLang - The base language to use for translations.
11
11
  */
12
- static "__#61@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
- static "__#61@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
14
- static "__#61@#getPaths"(): Promise<{
12
+ static "__#69@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
+ static "__#69@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
14
+ static "__#69@#getPaths"(): Promise<{
15
15
  baseURL: any;
16
16
  paths: any;
17
17
  }>;
18
- static "__#61@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
- static "__#61@#createBundleFallback"(lang: any): Promise<any>;
18
+ static "__#69@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
+ static "__#69@#createBundleFallback"(lang: any): Promise<any>;
20
20
  constructor(lang: any);
21
21
  }
22
22
  import { L10n } from "./l10n.js";
@@ -10,14 +10,14 @@ export class IDownloadManager {
10
10
  * @param {string} filename
11
11
  * @param {string} [contentType]
12
12
  */
13
- downloadData(data: Uint8Array, filename: string, contentType?: string | undefined): void;
13
+ downloadData(data: Uint8Array, filename: string, contentType?: string): void;
14
14
  /**
15
15
  * @param {Uint8Array} data
16
16
  * @param {string} filename
17
17
  * @param {string | null} [dest]
18
18
  * @returns {boolean} Indicating if the data was opened.
19
19
  */
20
- openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null | undefined): boolean;
20
+ openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null): boolean;
21
21
  /**
22
22
  * @param {Uint8Array} data
23
23
  * @param {string} url
@@ -46,7 +46,7 @@ export class IL10n {
46
46
  * @param {string} [fallback]
47
47
  * @returns {Promise<string>}
48
48
  */
49
- 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>;
50
50
  /**
51
51
  * Translates HTML element.
52
52
  * @param {HTMLElement} element
@@ -114,7 +114,7 @@ export class IPDFLinkService {
114
114
  * @param {string} url
115
115
  * @param {boolean} [newWindow]
116
116
  */
117
- addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
117
+ addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean): void;
118
118
  /**
119
119
  * @param dest - The PDF destination object.
120
120
  * @returns {string} The hyperlink to the PDF object.
@@ -159,7 +159,7 @@ export class IRenderableView {
159
159
  /**
160
160
  * @type {RenderingStates}
161
161
  */
162
- get renderingState(): any;
162
+ get renderingState(): RenderingStates;
163
163
  /**
164
164
  * @returns {Promise} Resolved on draw completion.
165
165
  */
@@ -7,8 +7,8 @@ export const GenericL10n: null;
7
7
  * @implements {IL10n}
8
8
  */
9
9
  export class L10n implements IL10n {
10
- static "__#60@#fixupLangCode"(langCode: any): any;
11
- static "__#60@#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,8 @@ export namespace FindState {
23
23
  let WRAPPED: number;
24
24
  let PENDING: number;
25
25
  }
26
+ export function getOriginalIndex(diffs: any, pos: any, len: any): any[];
27
+ export function normalize(text: any): any[];
26
28
  /**
27
29
  * @typedef {Object} PDFFindControllerOptions
28
30
  * @property {IPDFLinkService} linkService - The navigation/linking service.
@@ -48,7 +48,6 @@ export namespace LinkTarget {
48
48
  * @implements {IPDFLinkService}
49
49
  */
50
50
  export class PDFLinkService implements IPDFLinkService {
51
- static "__#57@#isValidExplicitDest"(dest: any): boolean;
52
51
  /**
53
52
  * @param {PDFLinkServiceOptions} options
54
53
  */
@@ -107,7 +106,7 @@ export class PDFLinkService implements IPDFLinkService {
107
106
  * @param {string} url
108
107
  * @param {boolean} [newWindow]
109
108
  */
110
- addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean | undefined): void;
109
+ addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean): void;
111
110
  /**
112
111
  * @param {string|Array} dest - The PDF destination object.
113
112
  * @returns {string} The hyperlink to the PDF object.
@@ -0,0 +1,32 @@
1
+ export type IRenderableView = import("./interfaces").IRenderableView;
2
+ /** @typedef {import("./interfaces").IRenderableView} IRenderableView */
3
+ /**
4
+ * @implements {IRenderableView}
5
+ */
6
+ export class PDFPageDetailView extends BasePDFPageView implements IRenderableView {
7
+ constructor({ pageView }: {
8
+ pageView: any;
9
+ });
10
+ /**
11
+ * @type {boolean} True when the last rendering attempt of the view was
12
+ * cancelled due to a `.reset()` call. This will happen when
13
+ * the visible area changes so much during the rendering that
14
+ * we need to cancel the rendering and start over.
15
+ */
16
+ renderingCancelled: boolean;
17
+ pageView: any;
18
+ renderingId: string;
19
+ div: any;
20
+ setPdfPage(pdfPage: any): void;
21
+ get pdfPage(): any;
22
+ reset({ keepCanvas }?: {
23
+ keepCanvas?: boolean | undefined;
24
+ }): void;
25
+ update({ visibleArea, underlyingViewUpdated }?: {
26
+ visibleArea?: null | undefined;
27
+ underlyingViewUpdated?: boolean | undefined;
28
+ }): void;
29
+ draw(): Promise<void>;
30
+ #private;
31
+ }
32
+ import { BasePDFPageView } from "./base_pdf_page_view.js";
@@ -60,6 +60,20 @@ export type PDFPageViewOptions = {
60
60
  * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
61
61
  */
62
62
  maxCanvasPixels?: number | undefined;
63
+ /**
64
+ * - The maximum supported canvas dimension,
65
+ * in either width or height. Use `-1` for no limit.
66
+ * The default value is 32767.
67
+ */
68
+ maxCanvasDim?: number | undefined;
69
+ /**
70
+ * - When enabled, if the rendered
71
+ * pages would need a canvas that is larger than `maxCanvasPixels` or
72
+ * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
73
+ * that only renders the part of the page that is close to the viewport.
74
+ * The default value is `true`.
75
+ */
76
+ enableDetailCanvas?: boolean | undefined;
63
77
  /**
64
78
  * - Overwrites background and foreground colors
65
79
  * with user defined ones in order to improve readability in high contrast
@@ -80,16 +94,20 @@ export type PDFPageViewOptions = {
80
94
  * rendering. The default value is `false`.
81
95
  */
82
96
  enableHWA?: boolean | undefined;
97
+ /**
98
+ * - Enable creation of hyperlinks from
99
+ * text that look like URLs. The default value is `true`.
100
+ */
101
+ enableAutoLinking?: boolean | undefined;
83
102
  };
84
103
  /**
85
104
  * @implements {IRenderableView}
86
105
  */
87
- export class PDFPageView implements IRenderableView {
106
+ export class PDFPageView extends BasePDFPageView implements IRenderableView {
88
107
  /**
89
108
  * @param {PDFPageViewOptions} options
90
109
  */
91
110
  constructor(options: PDFPageViewOptions);
92
- id: number;
93
111
  renderingId: string;
94
112
  pdfPage: any;
95
113
  pageLabel: string | null;
@@ -99,42 +117,35 @@ export class PDFPageView implements IRenderableView {
99
117
  pdfPageRotate: number;
100
118
  _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
101
119
  imageResourcesPath: string;
120
+ enableDetailCanvas: boolean;
102
121
  maxCanvasPixels: any;
103
- pageColors: Object | null;
104
- eventBus: import("./event_utils").EventBus;
105
- renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue | undefined;
122
+ maxCanvasDim: any;
106
123
  l10n: import("./interfaces").IL10n | GenericL10n | undefined;
107
- renderTask: any;
108
- resume: (() => void) | null;
109
124
  _isStandalone: boolean | undefined;
110
125
  _container: HTMLDivElement | undefined;
111
126
  _annotationCanvasMap: any;
112
127
  annotationLayer: AnnotationLayerBuilder | null;
113
128
  annotationEditorLayer: any;
114
129
  textLayer: TextLayerBuilder | null;
115
- zoomLayer: ParentNode | null;
116
130
  xfaLayer: XfaLayerBuilder | null;
117
131
  structTreeLayer: any;
118
132
  drawLayer: any;
133
+ detailView: any;
119
134
  div: HTMLDivElement;
120
- set renderingState(state: number);
121
- get renderingState(): number;
122
135
  setPdfPage(pdfPage: any): void;
123
136
  destroy(): void;
124
137
  hasEditableAnnotations(): boolean;
125
138
  get _textHighlighter(): any;
126
- /**
127
- * @private
128
- */
129
- private _resetZoomLayer;
130
- reset({ keepZoomLayer, keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, }?: {
131
- keepZoomLayer?: boolean | undefined;
139
+ reset({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, keepCanvasWrapper, preserveDetailViewState, }?: {
132
140
  keepAnnotationLayer?: boolean | undefined;
133
141
  keepAnnotationEditorLayer?: boolean | undefined;
134
142
  keepXfaLayer?: boolean | undefined;
135
143
  keepTextLayer?: boolean | undefined;
144
+ keepCanvasWrapper?: boolean | undefined;
145
+ preserveDetailViewState?: boolean | undefined;
136
146
  }): void;
137
147
  toggleEditingMode(isEditing: any): void;
148
+ updateVisibleArea(visibleArea: any): void;
138
149
  /**
139
150
  * @typedef {Object} PDFPageViewUpdateParameters
140
151
  * @property {number} [scale] The new scale, if specified.
@@ -163,6 +174,7 @@ export class PDFPageView implements IRenderableView {
163
174
  optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
164
175
  drawingDelay?: number | undefined;
165
176
  }): void;
177
+ outputScale: OutputScale | undefined;
166
178
  /**
167
179
  * PLEASE NOTE: Most likely you want to use the `this.reset()` method,
168
180
  * rather than calling this one directly.
@@ -174,8 +186,7 @@ export class PDFPageView implements IRenderableView {
174
186
  keepTextLayer?: boolean | undefined;
175
187
  cancelExtraDelay?: number | undefined;
176
188
  }): void;
177
- cssTransform({ target, redrawAnnotationLayer, redrawAnnotationEditorLayer, redrawXfaLayer, redrawTextLayer, hideTextLayer, }: {
178
- target: any;
189
+ cssTransform({ redrawAnnotationLayer, redrawAnnotationEditorLayer, redrawXfaLayer, redrawTextLayer, hideTextLayer, }: {
179
190
  redrawAnnotationLayer?: boolean | undefined;
180
191
  redrawAnnotationEditorLayer?: boolean | undefined;
181
192
  redrawXfaLayer?: boolean | undefined;
@@ -185,9 +196,18 @@ export class PDFPageView implements IRenderableView {
185
196
  get width(): number;
186
197
  get height(): number;
187
198
  getPagePoint(x: any, y: any): any[];
188
- draw(): Promise<any>;
189
- canvas: HTMLCanvasElement | undefined;
190
- outputScale: OutputScale | undefined;
199
+ _ensureCanvasWrapper(): null;
200
+ _getRenderingContext(canvasContext: any, transform: any): {
201
+ canvasContext: any;
202
+ transform: any;
203
+ viewport: import("../src/display/display_utils").PageViewport;
204
+ annotationMode: number;
205
+ optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
206
+ annotationCanvasMap: any;
207
+ pageColors: null;
208
+ isEditing: boolean;
209
+ };
210
+ draw(): Promise<void>;
191
211
  /**
192
212
  * @param {string|null} label
193
213
  */
@@ -196,11 +216,12 @@ export class PDFPageView implements IRenderableView {
196
216
  * For use by the `PDFThumbnailView.setImage`-method.
197
217
  * @ignore
198
218
  */
199
- get thumbnailCanvas(): HTMLCanvasElement | null | undefined;
219
+ get thumbnailCanvas(): null;
200
220
  #private;
201
221
  }
222
+ import { BasePDFPageView } from "./base_pdf_page_view.js";
202
223
  import { GenericL10n } from "./genericl10n";
203
224
  import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
204
225
  import { TextLayerBuilder } from "./text_layer_builder.js";
205
226
  import { XfaLayerBuilder } from "./xfa_layer_builder.js";
206
- import { OutputScale } from "./ui_utils.js";
227
+ import { OutputScale } from "../src/pdf";
@@ -35,8 +35,9 @@ export class PDFRenderingQueue {
35
35
  * @param {Array} views
36
36
  * @param {boolean} scrolledDown
37
37
  * @param {boolean} [preRenderExtra]
38
+ * @param {boolean} [ignoreDetailViews]
38
39
  */
39
- getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean | undefined): any;
40
+ getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): any;
40
41
  /**
41
42
  * @param {IRenderableView} view
42
43
  * @returns {boolean}
@@ -35,6 +35,18 @@ export type PDFThumbnailViewOptions = {
35
35
  * - The rendering queue object.
36
36
  */
37
37
  renderingQueue: PDFRenderingQueue;
38
+ /**
39
+ * - The maximum supported canvas size in
40
+ * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
41
+ * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
42
+ */
43
+ maxCanvasPixels?: number | undefined;
44
+ /**
45
+ * - The maximum supported canvas dimension,
46
+ * in either width or height. Use `-1` for no limit.
47
+ * The default value is 32767.
48
+ */
49
+ maxCanvasDim?: number | undefined;
38
50
  /**
39
51
  * - Overwrites background and foreground colors
40
52
  * with user defined ones in order to improve readability in high contrast
@@ -54,7 +66,7 @@ export class PDFThumbnailView implements IRenderableView {
54
66
  /**
55
67
  * @param {PDFThumbnailViewOptions} options
56
68
  */
57
- constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, pageColors, enableHWA, }: PDFThumbnailViewOptions);
69
+ constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, enableHWA, }: PDFThumbnailViewOptions);
58
70
  id: number;
59
71
  renderingId: string;
60
72
  pageLabel: string | null;
@@ -63,6 +75,8 @@ export class PDFThumbnailView implements IRenderableView {
63
75
  viewport: import("../src/display/display_utils").PageViewport;
64
76
  pdfPageRotate: number;
65
77
  _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
78
+ maxCanvasPixels: any;
79
+ maxCanvasDim: any;
66
80
  pageColors: Object | null;
67
81
  enableHWA: boolean;
68
82
  eventBus: import("./event_utils").EventBus;
@@ -88,7 +102,7 @@ export class PDFThumbnailView implements IRenderableView {
88
102
  */
89
103
  cancelRendering(): void;
90
104
  image: HTMLImageElement | undefined;
91
- draw(): Promise<any>;
105
+ draw(): Promise<void>;
92
106
  setImage(pageView: any): void;
93
107
  /**
94
108
  * @param {string|null} label
@@ -107,6 +121,12 @@ export class PDFThumbnailView implements IRenderableView {
107
121
  * The default value is `null`.
108
122
  * @property {IPDFLinkService} linkService - The navigation/linking service.
109
123
  * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
124
+ * @property {number} [maxCanvasPixels] - The maximum supported canvas size in
125
+ * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
126
+ * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
127
+ * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
128
+ * in either width or height. Use `-1` for no limit.
129
+ * The default value is 32767.
110
130
  * @property {Object} [pageColors] - Overwrites background and foreground colors
111
131
  * with user defined ones in order to improve readability in high contrast
112
132
  * mode.
@@ -114,7 +134,7 @@ export class PDFThumbnailView implements IRenderableView {
114
134
  * rendering. The default value is `false`.
115
135
  */
116
136
  export class TempImageFactory {
117
- static "__#72@#tempCanvas": null;
137
+ static "__#82@#tempCanvas": null;
118
138
  static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
119
139
  static destroyCanvas(): void;
120
140
  }
@@ -21,6 +21,18 @@ export type PDFThumbnailViewerOptions = {
21
21
  * - The rendering queue object.
22
22
  */
23
23
  renderingQueue: PDFRenderingQueue;
24
+ /**
25
+ * - The maximum supported canvas size in
26
+ * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
27
+ * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
28
+ */
29
+ maxCanvasPixels?: number | undefined;
30
+ /**
31
+ * - The maximum supported canvas dimension,
32
+ * in either width or height. Use `-1` for no limit.
33
+ * The default value is 32767.
34
+ */
35
+ maxCanvasDim?: number | undefined;
24
36
  /**
25
37
  * - Overwrites background and foreground colors
26
38
  * with user defined ones in order to improve readability in high contrast
@@ -45,6 +57,12 @@ export type PDFThumbnailViewerOptions = {
45
57
  * @property {EventBus} eventBus - The application event bus.
46
58
  * @property {IPDFLinkService} linkService - The navigation/linking service.
47
59
  * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
60
+ * @property {number} [maxCanvasPixels] - The maximum supported canvas size in
61
+ * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
62
+ * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
63
+ * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
64
+ * in either width or height. Use `-1` for no limit.
65
+ * The default value is 32767.
48
66
  * @property {Object} [pageColors] - Overwrites background and foreground colors
49
67
  * with user defined ones in order to improve readability in high contrast
50
68
  * mode.
@@ -60,11 +78,13 @@ export class PDFThumbnailViewer {
60
78
  /**
61
79
  * @param {PDFThumbnailViewerOptions} options
62
80
  */
63
- constructor({ container, eventBus, linkService, renderingQueue, pageColors, abortSignal, enableHWA, }: PDFThumbnailViewerOptions);
81
+ constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableHWA, }: PDFThumbnailViewerOptions);
64
82
  container: HTMLDivElement;
65
83
  eventBus: import("./event_utils").EventBus;
66
84
  linkService: import("./interfaces").IPDFLinkService;
67
85
  renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
86
+ maxCanvasPixels: number | undefined;
87
+ maxCanvasDim: number | undefined;
68
88
  pageColors: Object | null;
69
89
  enableHWA: boolean;
70
90
  scroll: {
@@ -90,6 +90,20 @@ export type PDFViewerOptions = {
90
90
  * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
91
91
  */
92
92
  maxCanvasPixels?: number | undefined;
93
+ /**
94
+ * - The maximum supported canvas dimension,
95
+ * in either width or height. Use `-1` for no limit.
96
+ * The default value is 32767.
97
+ */
98
+ maxCanvasDim?: number | undefined;
99
+ /**
100
+ * - When enabled, if the rendered
101
+ * pages would need a canvas that is larger than `maxCanvasPixels` or
102
+ * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
103
+ * that only renders the part of the page that is close to the viewport.
104
+ * The default value is `true`.
105
+ */
106
+ enableDetailCanvas?: boolean | undefined;
93
107
  /**
94
108
  * - Localization service.
95
109
  */
@@ -110,6 +124,16 @@ export type PDFViewerOptions = {
110
124
  * rendering. The default value is `false`.
111
125
  */
112
126
  enableHWA?: boolean | undefined;
127
+ /**
128
+ * - Enable zooming on pinch gesture.
129
+ * The default value is `true`.
130
+ */
131
+ supportsPinchToZoom?: boolean | undefined;
132
+ /**
133
+ * - Enable creation of hyperlinks from
134
+ * text that look like URLs. The default value is `true`.
135
+ */
136
+ enableAutoLinking?: boolean | undefined;
113
137
  };
114
138
  export namespace PagesCountLimit {
115
139
  let FORCE_SCROLL_MODE_PAGE: number;
@@ -151,6 +175,14 @@ export namespace PagesCountLimit {
151
175
  * @property {number} [maxCanvasPixels] - The maximum supported canvas size in
152
176
  * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for
153
177
  * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).
178
+ * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
179
+ * in either width or height. Use `-1` for no limit.
180
+ * The default value is 32767.
181
+ * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered
182
+ * pages would need a canvas that is larger than `maxCanvasPixels` or
183
+ * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
184
+ * that only renders the part of the page that is close to the viewport.
185
+ * The default value is `true`.
154
186
  * @property {IL10n} [l10n] - Localization service.
155
187
  * @property {boolean} [enablePermissions] - Enables PDF document permissions,
156
188
  * when they exist. The default value is `false`.
@@ -159,6 +191,10 @@ export namespace PagesCountLimit {
159
191
  * mode.
160
192
  * @property {boolean} [enableHWA] - Enables hardware acceleration for
161
193
  * rendering. The default value is `false`.
194
+ * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
195
+ * The default value is `true`.
196
+ * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from
197
+ * text that look like URLs. The default value is `true`.
162
198
  */
163
199
  export class PDFPageViewBuffer {
164
200
  constructor(size: any);
@@ -172,7 +208,7 @@ export class PDFPageViewBuffer {
172
208
  */
173
209
  resize(newSize: any, idsToKeep?: null): void;
174
210
  has(view: any): boolean;
175
- [Symbol.iterator](): IterableIterator<any>;
211
+ [Symbol.iterator](): SetIterator<any>;
176
212
  #private;
177
213
  }
178
214
  /**
@@ -194,6 +230,8 @@ export class PDFViewer {
194
230
  enablePrintAutoRotate: boolean;
195
231
  removePageBorders: boolean | undefined;
196
232
  maxCanvasPixels: number | undefined;
233
+ maxCanvasDim: number | undefined;
234
+ enableDetailCanvas: boolean;
197
235
  l10n: import("./interfaces").IL10n | GenericL10n | undefined;
198
236
  pageColors: Object | null;
199
237
  defaultRenderingQueue: boolean;
@@ -375,11 +413,11 @@ export class PDFViewer {
375
413
  * @param {Promise<OptionalContentConfig>} promise - A promise that is
376
414
  * resolved with an {@link OptionalContentConfig} instance.
377
415
  */
378
- set optionalContentConfigPromise(promise: Promise<import("../src/display/optional_content_config").OptionalContentConfig>);
416
+ set optionalContentConfigPromise(promise: Promise<OptionalContentConfig>);
379
417
  /**
380
418
  * @type {Promise<OptionalContentConfig | null>}
381
419
  */
382
- get optionalContentConfigPromise(): Promise<import("../src/display/optional_content_config").OptionalContentConfig | null>;
420
+ get optionalContentConfigPromise(): Promise<OptionalContentConfig | null>;
383
421
  /**
384
422
  * @param {number} mode - The direction in which the document pages should be
385
423
  * laid out within the scrolling container.
@@ -437,7 +475,7 @@ export class PDFViewer {
437
475
  * transformation origin.
438
476
  */
439
477
  origin?: any[] | undefined;
440
- } | undefined): void;
478
+ }): void;
441
479
  /**
442
480
  * Increase the current zoom level one, or more, times.
443
481
  * @param {ChangeScaleOptions} [options]
@@ -451,7 +489,7 @@ export class PDFViewer {
451
489
  * transformation origin.
452
490
  */
453
491
  origin?: any[] | undefined;
454
- } | undefined): void;
492
+ }): void;
455
493
  /**
456
494
  * Decrease the current zoom level one, or more, times.
457
495
  * @param {ChangeScaleOptions} [options]
@@ -465,7 +503,7 @@ export class PDFViewer {
465
503
  * transformation origin.
466
504
  */
467
505
  origin?: any[] | undefined;
468
- } | undefined): void;
506
+ }): void;
469
507
  get containerTopLeft(): number[];
470
508
  /**
471
509
  * @typedef {Object} AnnotationEditorModeOptions
@@ -493,24 +531,14 @@ export class PDFViewer {
493
531
  isFromKeyboard?: boolean | undefined;
494
532
  });
495
533
  get annotationEditorMode(): {
496
- /**
497
- * - The editor mode (none, FreeText, ink, ...).
498
- */
499
534
  /**
500
535
  * - The editor mode (none, FreeText, ink, ...).
501
536
  */
502
537
  mode: number;
503
- /**
504
- * - ID of the existing annotation to edit.
505
- */
506
538
  /**
507
539
  * - ID of the existing annotation to edit.
508
540
  */
509
541
  editId?: string | null | undefined;
510
- /**
511
- * - True if the mode change is due to a
512
- * keyboard action.
513
- */
514
542
  /**
515
543
  * - True if the mode change is due to a
516
544
  * keyboard action.
@@ -1,7 +1,25 @@
1
+ export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
+ export type StructTreeLayerBuilderOptions = {
3
+ pdfPage: PDFPageProxy;
4
+ rawDims: Object;
5
+ };
6
+ /**
7
+ * @typedef {Object} StructTreeLayerBuilderOptions
8
+ * @property {PDFPageProxy} pdfPage
9
+ * @property {Object} rawDims
10
+ */
1
11
  export class StructTreeLayerBuilder {
2
- get renderingDone(): boolean;
3
- render(structTree: any): HTMLSpanElement | null;
12
+ /**
13
+ * @param {StructTreeLayerBuilderOptions} options
14
+ */
15
+ constructor(pdfPage: any, rawDims: any);
16
+ /**
17
+ * @returns {Promise<void>}
18
+ */
19
+ render(): Promise<void>;
20
+ getAriaAttributes(annotationId: any): Promise<any>;
4
21
  hide(): void;
5
22
  show(): void;
23
+ addElementsToTextLayer(): void;
6
24
  #private;
7
25
  }
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
14
14
  * @param {HTMLElement} e2
15
15
  * @returns {number}
16
16
  */
17
- static "__#7@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
17
+ static "__#6@#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.
@@ -10,43 +10,51 @@ export type TextLayerBuilderOptions = {
10
10
  */
11
11
  highlighter?: import("./text_highlighter").TextHighlighter | undefined;
12
12
  accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
13
+ enablePermissions?: boolean | undefined;
13
14
  onAppend?: Function | undefined;
14
15
  };
16
+ export type TextLayerBuilderRenderOptions = {
17
+ viewport: PageViewport;
18
+ textContentParams?: Object | undefined;
19
+ };
15
20
  /**
16
21
  * @typedef {Object} TextLayerBuilderOptions
17
22
  * @property {PDFPageProxy} pdfPage
18
23
  * @property {TextHighlighter} [highlighter] - Optional object that will handle
19
24
  * highlighting text from the find controller.
20
25
  * @property {TextAccessibilityManager} [accessibilityManager]
26
+ * @property {boolean} [enablePermissions]
21
27
  * @property {function} [onAppend]
22
28
  */
29
+ /**
30
+ * @typedef {Object} TextLayerBuilderRenderOptions
31
+ * @property {PageViewport} viewport
32
+ * @property {Object} [textContentParams]
33
+ */
23
34
  /**
24
35
  * The text layer builder provides text selection functionality for the PDF.
25
36
  * It does this by creating overlay divs over the PDF's text. These divs
26
37
  * contain text that matches the PDF text they are overlaying.
27
38
  */
28
39
  export class TextLayerBuilder {
29
- static "__#68@#textLayers": Map<any, any>;
30
- static "__#68@#selectionChangeAbortController": null;
31
- static "__#68@#removeGlobalSelectionListener"(textLayerDiv: any): void;
32
- static "__#68@#enableGlobalSelectionListener"(): void;
33
- constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: {
34
- pdfPage: any;
35
- highlighter?: null | undefined;
36
- accessibilityManager?: null | undefined;
37
- enablePermissions?: boolean | undefined;
38
- onAppend?: null | undefined;
39
- });
40
- pdfPage: any;
41
- highlighter: any;
42
- accessibilityManager: any;
40
+ static "__#78@#textLayers": Map<any, any>;
41
+ static "__#78@#selectionChangeAbortController": null;
42
+ static "__#78@#removeGlobalSelectionListener"(textLayerDiv: any): void;
43
+ static "__#78@#enableGlobalSelectionListener"(): void;
44
+ /**
45
+ * @param {TextLayerBuilderOptions} options
46
+ */
47
+ constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: TextLayerBuilderOptions);
48
+ pdfPage: import("../src/display/api").PDFPageProxy;
49
+ highlighter: import("./text_highlighter").TextHighlighter;
50
+ accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager;
43
51
  div: HTMLDivElement;
44
52
  /**
45
53
  * Renders the text layer.
46
- * @param {PageViewport} viewport
47
- * @param {Object} [textContentParams]
54
+ * @param {TextLayerBuilderRenderOptions} options
55
+ * @returns {Promise<void>}
48
56
  */
49
- render(viewport: PageViewport, textContentParams?: Object | undefined): Promise<void>;
57
+ render({ viewport, textContentParams }: TextLayerBuilderRenderOptions): Promise<void>;
50
58
  hide(): void;
51
59
  show(): void;
52
60
  /**