unpdf 0.11.0 → 0.12.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 (43) hide show
  1. package/README.md +4 -2
  2. package/dist/index.cjs +9 -3
  3. package/dist/index.mjs +9 -3
  4. package/dist/pdfjs.mjs +1 -1
  5. package/dist/types/src/display/annotation_layer.d.ts +3 -3
  6. package/dist/types/src/display/annotation_storage.d.ts +9 -0
  7. package/dist/types/src/display/api.d.ts +48 -26
  8. package/dist/types/src/display/base_factory.d.ts +4 -0
  9. package/dist/types/src/display/canvas.d.ts +2 -0
  10. package/dist/types/src/display/display_utils.d.ts +2 -1
  11. package/dist/types/src/display/draw_layer.d.ts +1 -1
  12. package/dist/types/src/display/editor/alt_text.d.ts +14 -3
  13. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +3 -1
  14. package/dist/types/src/display/editor/editor.d.ts +11 -2
  15. package/dist/types/src/display/editor/freetext.d.ts +2 -2
  16. package/dist/types/src/display/editor/highlight.d.ts +4 -4
  17. package/dist/types/src/display/editor/ink.d.ts +4 -3
  18. package/dist/types/src/display/editor/outliner.d.ts +3 -3
  19. package/dist/types/src/display/editor/stamp.d.ts +21 -0
  20. package/dist/types/src/display/editor/toolbar.d.ts +3 -2
  21. package/dist/types/src/display/editor/tools.d.ts +20 -5
  22. package/dist/types/src/display/node_stream.d.ts +1 -1
  23. package/dist/types/src/display/text_layer.d.ts +10 -11
  24. package/dist/types/src/display/worker_options.d.ts +2 -2
  25. package/dist/types/src/pdf.d.ts +1 -4
  26. package/dist/types/src/shared/util.d.ts +3 -0
  27. package/dist/types/web/annotation_layer_builder.d.ts +1 -0
  28. package/dist/types/web/app_options.d.ts +4 -2
  29. package/dist/types/web/download_manager.d.ts +1 -2
  30. package/dist/types/web/event_utils.d.ts +8 -6
  31. package/dist/types/web/genericl10n.d.ts +5 -5
  32. package/dist/types/web/interfaces.d.ts +2 -9
  33. package/dist/types/web/l10n.d.ts +6 -2
  34. package/dist/types/web/pdf_find_controller.d.ts +24 -0
  35. package/dist/types/web/pdf_link_service.d.ts +1 -1
  36. package/dist/types/web/pdf_page_view.d.ts +12 -6
  37. package/dist/types/web/pdf_thumbnail_view.d.ts +11 -3
  38. package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -1
  39. package/dist/types/web/pdf_viewer.d.ts +22 -6
  40. package/dist/types/web/text_accessibility.d.ts +1 -1
  41. package/dist/types/web/text_layer_builder.d.ts +4 -4
  42. package/dist/types/web/ui_utils.d.ts +7 -2
  43. package/package.json +21 -21
@@ -1,7 +1,7 @@
1
1
  export class PDFNodeStream {
2
2
  constructor(source: any);
3
3
  source: any;
4
- url: any;
4
+ url: URL;
5
5
  isHttp: boolean;
6
6
  isFsUrl: boolean;
7
7
  httpHeaders: any;
@@ -30,22 +30,22 @@ export type TextLayerUpdateParameters = {
30
30
  */
31
31
  onBefore?: Function | undefined;
32
32
  };
33
- export function renderTextLayer(...args: any[]): {
34
- promise: Promise<any>;
35
- textDivs: HTMLElement[];
36
- textContentItemsStr: string[];
37
- } | undefined;
38
33
  export class TextLayer {
39
- static "__#44@#ascentCache": Map<any, any>;
40
- static "__#44@#canvasContexts": Map<any, any>;
41
- static "__#44@#pendingTextLayers": Set<any>;
34
+ static "__#45@#ascentCache": Map<any, any>;
35
+ static "__#45@#canvasContexts": Map<any, any>;
36
+ static "__#45@#minFontSize": null;
37
+ static "__#45@#pendingTextLayers": Set<any>;
42
38
  /**
43
39
  * Clean-up global textLayer data.
44
40
  * @returns {undefined}
45
41
  */
46
42
  static cleanup(): undefined;
47
- static "__#44@#getCtx"(lang?: null): any;
48
- static "__#44@#getAscent"(fontFamily: any, lang: any): any;
43
+ static "__#45@#getCtx"(lang?: null): any;
44
+ /**
45
+ * Compute the minimum font size enforced by the browser.
46
+ */
47
+ static "__#45@#ensureMinFontSizeComputed"(): void;
48
+ static "__#45@#getAscent"(fontFamily: any, lang: any): any;
49
49
  /**
50
50
  * @param {TextLayerParameters} options
51
51
  */
@@ -80,4 +80,3 @@ export class TextLayer {
80
80
  get textContentItemsStr(): string[];
81
81
  #private;
82
82
  }
83
- export function updateTextLayer(): void;
@@ -1,6 +1,6 @@
1
1
  export class GlobalWorkerOptions {
2
- static "__#39@#port": null;
3
- static "__#39@#src": string;
2
+ static "__#40@#port": null;
3
+ static "__#40@#src": string;
4
4
  /**
5
5
  * @param {Worker | null} workerPort - Defines global port for worker process.
6
6
  * Overrides the `workerSrc` option.
@@ -32,7 +32,6 @@ import { MissingPDFException } from "./shared/util.js";
32
32
  import { noContextMenu } from "./display/display_utils.js";
33
33
  import { normalizeUnicode } from "./shared/util.js";
34
34
  import { OPS } from "./shared/util.js";
35
- import { Outliner } from "./display/editor/outliner.js";
36
35
  import { PasswordResponses } from "./shared/util.js";
37
36
  import { PDFDataRangeTransport } from "./display/api.js";
38
37
  import { PDFDateString } from "./display/display_utils.js";
@@ -40,14 +39,12 @@ import { PDFWorker } from "./display/api.js";
40
39
  import { PermissionFlag } from "./shared/util.js";
41
40
  import { PixelsPerInch } from "./display/display_utils.js";
42
41
  import { RenderingCancelledException } from "./display/display_utils.js";
43
- import { renderTextLayer } from "./display/text_layer.js";
44
42
  import { setLayerDimensions } from "./display/display_utils.js";
45
43
  import { shadow } from "./shared/util.js";
46
44
  import { TextLayer } from "./display/text_layer.js";
47
45
  import { UnexpectedResponseException } from "./shared/util.js";
48
- import { updateTextLayer } from "./display/text_layer.js";
49
46
  import { Util } from "./shared/util.js";
50
47
  import { VerbosityLevel } from "./shared/util.js";
51
48
  import { version } from "./display/api.js";
52
49
  import { XfaLayer } from "./display/xfa_layer.js";
53
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, Outliner, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderTextLayer, setLayerDimensions, shadow, TextLayer, UnexpectedResponseException, updateTextLayer, Util, VerbosityLevel, version, XfaLayer };
50
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, build, CMapCompressionType, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, MissingPDFException, noContextMenu, normalizeUnicode, OPS, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, setLayerDimensions, shadow, TextLayer, UnexpectedResponseException, Util, VerbosityLevel, version, XfaLayer };
@@ -304,6 +304,8 @@ export namespace OPS {
304
304
  let paintImageMaskXObjectRepeat: number;
305
305
  let paintSolidColorImageMask: number;
306
306
  let constructPath: number;
307
+ let setStrokeTransparent: number;
308
+ let setFillTransparent: number;
307
309
  }
308
310
  export namespace PageActionEventType {
309
311
  export let O: string;
@@ -341,6 +343,7 @@ export namespace RenderingIntentFlag {
341
343
  export let ANNOTATIONS_FORMS: number;
342
344
  export let ANNOTATIONS_STORAGE: number;
343
345
  export let ANNOTATIONS_DISABLE: number;
346
+ export let IS_EDITING: number;
344
347
  export let OPLIST: number;
345
348
  }
346
349
  export function setVerbosityLevel(level: any): void;
@@ -76,6 +76,7 @@ export class AnnotationLayerBuilder {
76
76
  render(viewport: PageViewport, intent?: string): Promise<void>;
77
77
  cancel(): void;
78
78
  hide(): void;
79
+ hasEditableAnnotations(): boolean;
79
80
  #private;
80
81
  }
81
82
  import { AnnotationLayer } from "../src/pdf";
@@ -1,14 +1,16 @@
1
1
  export class AppOptions {
2
+ static eventBus: any;
3
+ static "__#64@#opts": Map<any, any>;
2
4
  static get(name: any): any;
3
5
  static getAll(kind?: null, defaultOnly?: boolean): any;
4
6
  static set(name: any, value: any): void;
5
- static setAll(options: any, init?: boolean): void;
6
- static remove(name: any): void;
7
+ static setAll(options: any, prefs?: boolean): void;
7
8
  }
8
9
  export namespace OptionKind {
9
10
  let BROWSER: number;
10
11
  let VIEWER: number;
11
12
  let API: number;
12
13
  let WORKER: number;
14
+ let EVENT_DISPATCH: number;
13
15
  let PREFERENCE: number;
14
16
  }
@@ -3,12 +3,11 @@ export type IDownloadManager = import("./interfaces").IDownloadManager;
3
3
  * @implements {IDownloadManager}
4
4
  */
5
5
  export class DownloadManager implements IDownloadManager {
6
- downloadUrl(url: any, filename: any, _options: any): void;
7
6
  downloadData(data: any, filename: any, contentType: any): void;
8
7
  /**
9
8
  * @returns {boolean} Indicating if the data was opened.
10
9
  */
11
10
  openOrDownloadData(data: any, filename: any, dest?: null): boolean;
12
- download(blob: any, url: any, filename: any, _options: any): void;
11
+ download(data: any, url: any, filename: any): void;
13
12
  #private;
14
13
  }
@@ -14,12 +14,6 @@ export type WaitOnEventOrTimeoutParameters = {
14
14
  */
15
15
  delay: number;
16
16
  };
17
- /**
18
- * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.
19
- */
20
- export class AutomationEventBus extends EventBus {
21
- dispatch(eventName: any, data: any): void;
22
- }
23
17
  /**
24
18
  * Simple event bus for an application. Listeners are attached using the `on`
25
19
  * and `off` methods. To raise an event, the `dispatch` method shall be used.
@@ -52,6 +46,14 @@ export class EventBus {
52
46
  _off(eventName: any, listener: any, options?: null): void;
53
47
  #private;
54
48
  }
49
+ /**
50
+ * NOTE: Only used in the Firefox build-in pdf viewer.
51
+ */
52
+ export class FirefoxEventBus extends EventBus {
53
+ constructor(globalEventNames: any, externalServices: any, isInAutomation: any);
54
+ dispatch(eventName: any, data: any): void;
55
+ #private;
56
+ }
55
57
  /**
56
58
  * @typedef {Object} WaitOnEventOrTimeoutParameters
57
59
  * @property {Object} target - The event target, can for example be:
@@ -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 "__#59@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
13
- static "__#59@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
14
- static "__#59@#getPaths"(): Promise<{
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<{
15
15
  baseURL: any;
16
16
  paths: any;
17
17
  }>;
18
- static "__#59@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
- static "__#59@#createBundleFallback"(lang: any): Promise<any>;
18
+ static "__#61@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
19
+ static "__#61@#createBundleFallback"(lang: any): Promise<any>;
20
20
  constructor(lang: any);
21
21
  }
22
22
  import { L10n } from "./l10n.js";
@@ -5,12 +5,6 @@ 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
@@ -25,12 +19,11 @@ export class IDownloadManager {
25
19
  */
26
20
  openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null | undefined): 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
@@ -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 "__#60@#fixupLangCode"(langCode: any): any;
11
+ static "__#60@#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 "__#57@#isValidExplicitDest"(dest: any): boolean;
52
52
  /**
53
53
  * @param {PDFLinkServiceOptions} options
54
54
  */
@@ -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,7 +110,7 @@ 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
115
  zoomLayer: ParentNode | null;
111
116
  xfaLayer: XfaLayerBuilder | null;
@@ -116,6 +121,7 @@ export class PDFPageView implements IRenderableView {
116
121
  get renderingState(): number;
117
122
  setPdfPage(pdfPage: any): void;
118
123
  destroy(): void;
124
+ hasEditableAnnotations(): boolean;
119
125
  get _textHighlighter(): any;
120
126
  /**
121
127
  * @private
@@ -128,6 +134,7 @@ export class PDFPageView implements IRenderableView {
128
134
  keepXfaLayer?: boolean | undefined;
129
135
  keepTextLayer?: boolean | undefined;
130
136
  }): void;
137
+ toggleEditingMode(isEditing: any): void;
131
138
  /**
132
139
  * @typedef {Object} PDFPageViewUpdateParameters
133
140
  * @property {number} [scale] The new scale, if specified.
@@ -151,7 +158,7 @@ export class PDFPageView implements IRenderableView {
151
158
  */
152
159
  rotation?: number | undefined;
153
160
  /**
154
- * A promise that is resolved with an {@link OptionalContentConfig }instance. The default value is `null`.
161
+ * A promise that is resolved with an {@link OptionalContentConfig}instance. The default value is `null`.
155
162
  */
156
163
  optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
157
164
  drawingDelay?: number | undefined;
@@ -194,7 +201,6 @@ export class PDFPageView implements IRenderableView {
194
201
  }
195
202
  import { GenericL10n } from "./genericl10n";
196
203
  import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
197
- import { AnnotationEditorLayerBuilder } from "./annotation_editor_layer_builder.js";
198
204
  import { TextLayerBuilder } from "./text_layer_builder.js";
199
205
  import { XfaLayerBuilder } from "./xfa_layer_builder.js";
200
206
  import { OutputScale } from "./ui_utils.js";
@@ -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 "__#72@#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,11 @@ 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;
108
113
  };
109
114
  export namespace PagesCountLimit {
110
115
  let FORCE_SCROLL_MODE_PAGE: number;
@@ -152,6 +157,8 @@ export namespace PagesCountLimit {
152
157
  * @property {Object} [pageColors] - Overwrites background and foreground colors
153
158
  * with user defined ones in order to improve readability in high contrast
154
159
  * mode.
160
+ * @property {boolean} [enableHWA] - Enables hardware acceleration for
161
+ * rendering. The default value is `false`.
155
162
  */
156
163
  export class PDFPageViewBuffer {
157
164
  constructor(size: any);
@@ -231,7 +238,7 @@ export class PDFViewer {
231
238
  /**
232
239
  * @param {string} val - The page label.
233
240
  */
234
- set currentPageLabel(val: string | null);
241
+ set currentPageLabel(val: string);
235
242
  /**
236
243
  * @type {string|null} Returns the current page label, or `null` if no page
237
244
  * labels exist.
@@ -368,7 +375,7 @@ export class PDFViewer {
368
375
  * @param {Promise<OptionalContentConfig>} promise - A promise that is
369
376
  * resolved with an {@link OptionalContentConfig} instance.
370
377
  */
371
- set optionalContentConfigPromise(promise: Promise<import("../src/display/optional_content_config").OptionalContentConfig | null>);
378
+ set optionalContentConfigPromise(promise: Promise<import("../src/display/optional_content_config").OptionalContentConfig>);
372
379
  /**
373
380
  * @type {Promise<OptionalContentConfig | null>}
374
381
  */
@@ -486,21 +493,30 @@ export class PDFViewer {
486
493
  isFromKeyboard?: boolean | undefined;
487
494
  });
488
495
  get annotationEditorMode(): {
496
+ /**
497
+ * - The editor mode (none, FreeText, ink, ...).
498
+ */
489
499
  /**
490
500
  * - The editor mode (none, FreeText, ink, ...).
491
501
  */
492
502
  mode: number;
503
+ /**
504
+ * - ID of the existing annotation to edit.
505
+ */
493
506
  /**
494
507
  * - ID of the existing annotation to edit.
495
508
  */
496
509
  editId?: string | null | undefined;
510
+ /**
511
+ * - True if the mode change is due to a
512
+ * keyboard action.
513
+ */
497
514
  /**
498
515
  * - True if the mode change is due to a
499
516
  * keyboard action.
500
517
  */
501
518
  isFromKeyboard?: boolean | undefined;
502
519
  };
503
- set annotationEditorParams({ type, value }: any);
504
520
  refresh(noUpdate?: boolean, updateArgs?: any): void;
505
521
  #private;
506
522
  }
@@ -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 "__#7@#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.
@@ -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 "__#68@#textLayers": Map<any, any>;
30
+ static "__#68@#selectionChangeAbortController": null;
31
+ static "__#68@#removeGlobalSelectionListener"(textLayerDiv: any): void;
32
+ static "__#68@#enableGlobalSelectionListener"(): void;
33
33
  constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: {
34
34
  pdfPage: any;
35
35
  highlighter?: null | undefined;
@@ -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;
@@ -100,6 +101,11 @@ export const DEFAULT_SCALE: 1;
100
101
  export const DEFAULT_SCALE_DELTA: 1.1;
101
102
  export const DEFAULT_SCALE_VALUE: "auto";
102
103
  export const docStyle: CSSStyleDeclaration | null;
104
+ /**
105
+ * @param {number} x - A positive number to round to a multiple of `div`.
106
+ * @param {number} div - A natural number.
107
+ */
108
+ export function floorToDivide(x: number, div: number): number;
103
109
  /**
104
110
  * Get the active or focused element in current DOM.
105
111
  *
@@ -220,7 +226,6 @@ export namespace RenderingStates {
220
226
  let PAUSED: number;
221
227
  let FINISHED: number;
222
228
  }
223
- export function roundToDivide(x: any, div: any): any;
224
229
  export const SCROLLBAR_PADDING: 40;
225
230
  /**
226
231
  * Scrolls specified element into view of its parent.
@@ -275,7 +280,7 @@ export const VERTICAL_PADDING: 5;
275
280
  * Helper function to start monitoring the scroll event and converting them into
276
281
  * PDF.js friendly one: with scroll debounce and scroll direction.
277
282
  */
278
- export function watchScroll(viewAreaElement: any, callback: any): {
283
+ export function watchScroll(viewAreaElement: any, callback: any, abortSignal?: undefined): {
279
284
  right: boolean;
280
285
  down: boolean;
281
286
  lastX: any;