unpdf 1.6.2 → 1.8.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 (122) hide show
  1. package/README.md +61 -25
  2. package/dist/index.cjs +386 -353
  3. package/dist/index.d.cts +101 -91
  4. package/dist/index.d.mts +101 -91
  5. package/dist/index.mjs +385 -351
  6. package/dist/pdfjs.d.mts +1 -1
  7. package/dist/pdfjs.d.ts +1 -1
  8. package/dist/pdfjs.mjs +52 -59
  9. package/dist/types/external/brotli/decode.d.ts +5 -0
  10. package/dist/types/external/jbig2/jbig2.d.ts +2 -0
  11. package/dist/types/external/openjpeg/openjpeg.d.ts +2 -0
  12. package/dist/types/external/qcms/qcms.d.ts +92 -0
  13. package/dist/types/external/qcms/qcms_utils.d.ts +14 -0
  14. package/dist/types/src/core/ascii_85_stream.d.ts +7 -0
  15. package/dist/types/src/core/ascii_hex_stream.d.ts +7 -0
  16. package/dist/types/src/core/base_stream.d.ts +45 -0
  17. package/dist/types/src/core/brotli_stream.d.ts +9 -0
  18. package/dist/types/src/core/calculate_md5.d.ts +1 -0
  19. package/dist/types/src/core/calculate_sha256.d.ts +1 -0
  20. package/dist/types/src/core/calculate_sha_other.d.ts +2 -0
  21. package/dist/types/src/core/catalog.d.ts +169 -0
  22. package/dist/types/src/core/ccitt_stream.d.ts +18 -0
  23. package/dist/types/src/core/cleanup_helper.d.ts +1 -0
  24. package/dist/types/src/core/colorspace.d.ts +177 -0
  25. package/dist/types/src/core/colorspace_utils.d.ts +21 -0
  26. package/dist/types/src/core/core_utils.d.ts +132 -0
  27. package/dist/types/src/core/crypto.d.ts +136 -0
  28. package/dist/types/src/core/decode_stream.d.ts +32 -0
  29. package/dist/types/src/core/decrypt_stream.d.ts +9 -0
  30. package/dist/types/src/core/file_spec.d.ts +72 -0
  31. package/dist/types/src/core/flate_stream.d.ts +14 -0
  32. package/dist/types/src/core/icc_colorspace.d.ts +22 -0
  33. package/dist/types/src/core/image_utils.d.ts +52 -0
  34. package/dist/types/src/core/jbig2_ccittFax.d.ts +13 -0
  35. package/dist/types/src/core/jbig2_stream.d.ts +17 -0
  36. package/dist/types/src/core/jpeg_stream.d.ts +24 -0
  37. package/dist/types/src/core/jpg.d.ts +62 -0
  38. package/dist/types/src/core/jpx.d.ts +24 -0
  39. package/dist/types/src/core/jpx_stream.d.ts +15 -0
  40. package/dist/types/src/core/lzw_stream.d.ts +19 -0
  41. package/dist/types/src/core/metadata_parser.d.ts +13 -0
  42. package/dist/types/src/core/name_number_tree.d.ts +21 -0
  43. package/dist/types/src/core/parser.d.ts +121 -0
  44. package/dist/types/src/core/pattern.d.ts +63 -0
  45. package/dist/types/src/core/predictor_stream.d.ts +14 -0
  46. package/dist/types/src/core/primitives.d.ts +81 -0
  47. package/dist/types/src/core/run_length_stream.d.ts +6 -0
  48. package/dist/types/src/core/stream.d.ts +20 -0
  49. package/dist/types/src/core/string_utils.d.ts +5 -0
  50. package/dist/types/src/core/struct_tree.d.ts +93 -0
  51. package/dist/types/src/core/unicode.d.ts +5 -0
  52. package/dist/types/src/core/wasm_image.d.ts +21 -0
  53. package/dist/types/src/core/xml_parser.d.ts +79 -0
  54. package/dist/types/src/core/xref.d.ts +52 -0
  55. package/dist/types/src/display/annotation_layer.d.ts +11 -9
  56. package/dist/types/src/display/api.d.ts +92 -65
  57. package/dist/types/src/display/binary_data_factory.d.ts +0 -4
  58. package/dist/types/src/display/canvas.d.ts +58 -12
  59. package/dist/types/src/display/canvas_dependency_tracker.d.ts +2 -2
  60. package/dist/types/src/display/display_utils.d.ts +4 -156
  61. package/dist/types/src/display/draw_layer.d.ts +127 -2
  62. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  63. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +3 -3
  64. package/dist/types/src/display/editor/color_picker.d.ts +3 -2
  65. package/dist/types/src/display/editor/draw.d.ts +10 -3
  66. package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
  67. package/dist/types/src/display/editor/drawers/highlight.d.ts +0 -1
  68. package/dist/types/src/display/editor/drawers/outline.d.ts +0 -1
  69. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  70. package/dist/types/src/display/editor/editor.d.ts +2 -1
  71. package/dist/types/src/display/editor/freetext.d.ts +2 -2
  72. package/dist/types/src/display/editor/highlight.d.ts +3 -3
  73. package/dist/types/src/display/editor/ink.d.ts +2 -0
  74. package/dist/types/src/display/editor/toolbar.d.ts +2 -2
  75. package/dist/types/src/display/editor/tools.d.ts +31 -14
  76. package/dist/types/src/display/filter_factory.d.ts +26 -0
  77. package/dist/types/src/display/node_utils.d.ts +2 -2
  78. package/dist/types/src/display/obj_bin_transform_display.d.ts +2 -6
  79. package/dist/types/src/display/optional_content_config.d.ts +13 -3
  80. package/dist/types/src/display/page_viewport.d.ts +137 -0
  81. package/dist/types/src/display/pattern_helper.d.ts +11 -4
  82. package/dist/types/src/display/text_layer.d.ts +13 -13
  83. package/dist/types/src/display/text_layer_images.d.ts +1 -1
  84. package/dist/types/src/display/webgpu.d.ts +11 -0
  85. package/dist/types/src/display/worker_options.d.ts +2 -2
  86. package/dist/types/src/display/xfa_layer.d.ts +10 -3
  87. package/dist/types/src/display/xfa_text.d.ts +2 -2
  88. package/dist/types/src/pdf.d.ts +10 -9
  89. package/dist/types/src/shared/image_utils.d.ts +11 -0
  90. package/dist/types/src/shared/internal_evt.d.ts +7 -0
  91. package/dist/types/src/shared/math_clamp.d.ts +1 -0
  92. package/dist/types/src/shared/util.d.ts +24 -13
  93. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -5
  94. package/dist/types/web/annotation_layer_builder.d.ts +14 -11
  95. package/dist/types/web/app_options.d.ts +1 -1
  96. package/dist/types/web/autolinker.d.ts +3 -3
  97. package/dist/types/web/base_pdf_page_view.d.ts +1 -0
  98. package/dist/types/web/comment_manager.d.ts +1 -1
  99. package/dist/types/web/draw_layer_builder.d.ts +44 -0
  100. package/dist/types/web/event_utils.d.ts +0 -8
  101. package/dist/types/web/generic_scripting.d.ts +1 -1
  102. package/dist/types/web/genericl10n.d.ts +5 -5
  103. package/dist/types/web/internal_evt.d.ts +7 -0
  104. package/dist/types/web/l10n.d.ts +2 -2
  105. package/dist/types/web/pdf_find_controller.d.ts +16 -5
  106. package/dist/types/web/pdf_history.d.ts +1 -1
  107. package/dist/types/web/pdf_link_service.d.ts +10 -2
  108. package/dist/types/web/pdf_page_view.d.ts +19 -12
  109. package/dist/types/web/pdf_rendering_queue.d.ts +3 -3
  110. package/dist/types/web/pdf_scripting_manager.d.ts +1 -1
  111. package/dist/types/web/pdf_thumbnail_view.d.ts +9 -9
  112. package/dist/types/web/pdf_thumbnail_viewer.d.ts +38 -19
  113. package/dist/types/web/pdf_viewer.d.ts +28 -14
  114. package/dist/types/web/renderable_view.d.ts +2 -2
  115. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  116. package/dist/types/web/text_accessibility.d.ts +1 -1
  117. package/dist/types/web/text_highlighter.d.ts +6 -6
  118. package/dist/types/web/text_layer_builder.d.ts +10 -10
  119. package/dist/types/web/xfa_layer_builder.d.ts +8 -8
  120. package/package.json +25 -24
  121. package/dist/index.d.ts +0 -182
  122. package/dist/types/src/display/webgpu_mesh.d.ts +0 -3
@@ -1,14 +1,58 @@
1
+ /**
2
+ * Configuration for {@linkcode DrawLayerBuilder}.
3
+ */
4
+ export type DrawLayerBuilderOptions = {
5
+ /**
6
+ * Zero-based page index.
7
+ */
8
+ pageIndex: number;
9
+ /**
10
+ * Text layer element (optional).
11
+ */
12
+ textLayer?: Element | null | undefined;
13
+ /**
14
+ * Filter factory used to style selections (optional).
15
+ */
16
+ filterFactory?: Object | null | undefined;
17
+ /**
18
+ * Page foreground/background colors for HCM (optional).
19
+ */
20
+ pageColors?: Object | null | undefined;
21
+ };
1
22
  export type DrawLayerBuilderRenderOptions = {
2
23
  /**
3
24
  * - The default value is "display".
4
25
  */
5
26
  intent?: string | undefined;
6
27
  };
28
+ /**
29
+ * @typedef DrawLayerBuilderOptions
30
+ * Configuration for {@linkcode DrawLayerBuilder}.
31
+ * @property {number} pageIndex
32
+ * Zero-based page index.
33
+ * @property {Element | null} [textLayer]
34
+ * Text layer element (optional).
35
+ * @property {Object | null} [filterFactory]
36
+ * Filter factory used to style selections (optional).
37
+ * @property {Object | null} [pageColors]
38
+ * Page foreground/background colors for HCM (optional).
39
+ */
7
40
  /**
8
41
  * @typedef {Object} DrawLayerBuilderRenderOptions
9
42
  * @property {string} [intent] - The default value is "display".
10
43
  */
11
44
  export class DrawLayerBuilder {
45
+ /**
46
+ * @param {DrawLayerBuilderOptions} options
47
+ * Configuration.
48
+ * @returns
49
+ * Instance.
50
+ */
51
+ constructor(options: DrawLayerBuilderOptions);
52
+ pageIndex: number;
53
+ textLayer: Element | null;
54
+ filterFactory: Object | null;
55
+ pageColors: Object | null;
12
56
  /**
13
57
  * @param {DrawLayerBuilderRenderOptions} options
14
58
  * @returns {Promise<void>}
@@ -36,14 +36,6 @@ export class EventBus {
36
36
  * @param {Object} data
37
37
  */
38
38
  dispatch(eventName: string, data: Object): void;
39
- /**
40
- * @ignore
41
- */
42
- _on(eventName: any, listener: any, options?: null): void;
43
- /**
44
- * @ignore
45
- */
46
- _off(eventName: any, listener: any, options?: null): void;
47
39
  #private;
48
40
  }
49
41
  /**
@@ -1,6 +1,6 @@
1
1
  export function docProperties(pdfDocument: any): Promise<any>;
2
2
  export class GenericScripting {
3
- constructor(sandboxBundleSrc: any);
3
+ constructor(sandboxBundleSrc: any, wasmUrl: any);
4
4
  _ready: Promise<any>;
5
5
  createSandbox(data: any): Promise<void>;
6
6
  dispatchEventInSandbox(event: any): Promise<void>;
@@ -5,14 +5,14 @@ export class GenericL10n extends L10n {
5
5
  * translations.
6
6
  * @param {String} baseLang - The base language to use for translations.
7
7
  */
8
- static "__#private@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
9
- static "__#private@#createBundle"(lang: any, baseURL: any, paths: any): Promise<any>;
10
- static "__#private@#getPaths"(): Promise<{
8
+ static #generateBundles(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;
9
+ static #createBundle(lang: any, baseURL: any, paths: any): Promise<any>;
10
+ static #getPaths(): Promise<{
11
11
  baseURL: any;
12
12
  paths: any;
13
13
  }>;
14
- static "__#private@#generateBundlesFallback"(lang: any): AsyncGenerator<any, void, unknown>;
15
- static "__#private@#createBundleFallback"(lang: any): Promise<any>;
14
+ static #generateBundlesFallback(lang: any): AsyncGenerator<any, void, unknown>;
15
+ static #createBundleFallback(lang: any): Promise<any>;
16
16
  constructor(lang: any);
17
17
  }
18
18
  import { L10n } from "./l10n.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Keep this file in sync with `src/shared/internal_evt.js`.
3
+ */
4
+ export const INTERNAL_EVT: any;
5
+ export const internalOpt: Readonly<{
6
+ internal: any;
7
+ }>;
@@ -4,8 +4,8 @@ export const GenericL10n: null;
4
4
  * internally.
5
5
  */
6
6
  export class L10n {
7
- static "__#private@#fixupLangCode"(langCode: any): any;
8
- static "__#private@#isRTL"(lang: any): boolean;
7
+ static #fixupLangCode(langCode: any): any;
8
+ static #isRTL(lang: any): boolean;
9
9
  constructor({ lang, isRTL }: {
10
10
  lang: any;
11
11
  isRTL: any;
@@ -1,5 +1,5 @@
1
- export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
2
- export type EventBus = import("./event_utils").EventBus;
1
+ export type PDFDocumentProxy = import("../src/display/api.js").PDFDocumentProxy;
2
+ export type EventBus = import("./event_utils.js").EventBus;
3
3
  export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
4
4
  export type PDFFindControllerOptions = {
5
5
  /**
@@ -10,6 +10,13 @@ export type PDFFindControllerOptions = {
10
10
  * - The application event bus.
11
11
  */
12
12
  eventBus: EventBus;
13
+ /**
14
+ * - The number of milliseconds to delay execution of
15
+ * find commands. In the viewer each keystroke in the find bar triggers a
16
+ * `find` event, so this delay avoids triggering a search prematurely when the
17
+ * user is still typing the query. The default value is 250.
18
+ */
19
+ delay?: number | undefined;
13
20
  /**
14
21
  * - True if the matches
15
22
  * count must be updated on progress or only when the last page is reached.
@@ -29,6 +36,10 @@ export function normalize(text: any, options?: {}): any[];
29
36
  * @typedef {Object} PDFFindControllerOptions
30
37
  * @property {PDFLinkService} linkService - The navigation/linking service.
31
38
  * @property {EventBus} eventBus - The application event bus.
39
+ * @property {number} [delay] - The number of milliseconds to delay execution of
40
+ * find commands. In the viewer each keystroke in the find bar triggers a
41
+ * `find` event, so this delay avoids triggering a search prematurely when the
42
+ * user is still typing the query. The default value is 250.
32
43
  * @property {boolean} [updateMatchesCountOnProgress] - True if the matches
33
44
  * count must be updated on progress or only when the last page is reached.
34
45
  * The default value is `true`.
@@ -40,9 +51,9 @@ export class PDFFindController {
40
51
  /**
41
52
  * @param {PDFFindControllerOptions} options
42
53
  */
43
- constructor({ linkService, eventBus, updateMatchesCountOnProgress }: PDFFindControllerOptions);
54
+ constructor({ linkService, eventBus, delay, updateMatchesCountOnProgress, }: PDFFindControllerOptions);
44
55
  _linkService: import("./pdf_link_service.js").PDFLinkService;
45
- _eventBus: import("./event_utils").EventBus;
56
+ _eventBus: import("./event_utils.js").EventBus;
46
57
  /**
47
58
  * Callback used to check if a `pageNumber` is currently visible.
48
59
  * @type {function}
@@ -63,7 +74,7 @@ export class PDFFindController {
63
74
  * @param {PDFDocumentProxy} pdfDocument - The PDF document to search.
64
75
  */
65
76
  setDocument(pdfDocument: PDFDocumentProxy): void;
66
- _pdfDocument: import("../src/display/api").PDFDocumentProxy | null | undefined;
77
+ _pdfDocument: import("../src/display/api.js").PDFDocumentProxy | null | undefined;
67
78
  _dirtyMatch: boolean | undefined;
68
79
  _findTimeout: any;
69
80
  _highlightMatches: boolean | undefined;
@@ -38,7 +38,7 @@ export type PushParameters = {
38
38
  */
39
39
  pageNumber: number;
40
40
  };
41
- export type EventBus = import("./event_utils").EventBus;
41
+ export type EventBus = import("./event_utils.js").EventBus;
42
42
  export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
43
43
  export function isDestArraysEqual(firstDest: any, secondDest: any): boolean;
44
44
  export function isDestHashesEqual(destHash: any, pushHash: any): boolean;
@@ -1,4 +1,4 @@
1
- export type EventBus = import("./event_utils").EventBus;
1
+ export type EventBus = import("./event_utils.js").EventBus;
2
2
  export type PDFLinkServiceOptions = {
3
3
  /**
4
4
  * - The application event bus.
@@ -51,7 +51,7 @@ export class PDFLinkService {
51
51
  */
52
52
  constructor({ eventBus, externalLinkTarget, externalLinkRel, ignoreDestinationZoom, }?: PDFLinkServiceOptions);
53
53
  externalLinkEnabled: boolean;
54
- eventBus: import("./event_utils").EventBus;
54
+ eventBus: import("./event_utils.js").EventBus;
55
55
  externalLinkTarget: number;
56
56
  externalLinkRel: string;
57
57
  _ignoreDestinationZoom: boolean;
@@ -106,6 +106,13 @@ export class PDFLinkService {
106
106
  * @param {Object} [options]
107
107
  */
108
108
  goToXY(pageNumber: number, x: number, y: number, options?: Object): void;
109
+ /**
110
+ * @param {string} id
111
+ * Unique attachment identifier (required).
112
+ * @returns {Promise<CatalogAttachmentContent>}
113
+ * Content.
114
+ */
115
+ getAttachmentContent(id: string): Promise<CatalogAttachmentContent>;
109
116
  /**
110
117
  * Adds various attributes (href, title, target, rel) to hyperlinks.
111
118
  * @param {HTMLAnchorElement} link
@@ -140,3 +147,4 @@ export class PDFLinkService {
140
147
  }
141
148
  export class SimpleLinkService extends PDFLinkService {
142
149
  }
150
+ import type { CatalogAttachmentContent } from "../src/core/catalog.js";
@@ -1,7 +1,7 @@
1
- export type PageViewport = import("../src/display/display_utils").PageViewport;
2
- export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
3
- export type EventBus = import("./event_utils").EventBus;
4
- export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
1
+ export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
2
+ export type OptionalContentConfig = import("../src/display/optional_content_config.js").OptionalContentConfig;
3
+ export type EventBus = import("./event_utils.js").EventBus;
4
+ export type PDFRenderingQueue = import("./pdf_rendering_queue.js").PDFRenderingQueue;
5
5
  export type CommentManager = import("./comment_manager.js").CommentManager;
6
6
  export type L10n = import("./l10n.js").L10n;
7
7
  export type PDFPageViewOptions = {
@@ -30,11 +30,11 @@ export type PDFPageViewOptions = {
30
30
  * A promise that is resolved with an {@link OptionalContentConfig} instance.
31
31
  * The default value is `null`.
32
32
  */
33
- optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
33
+ optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | undefined;
34
34
  /**
35
35
  * - The rendering queue object.
36
36
  */
37
- renderingQueue?: import("./pdf_rendering_queue").PDFRenderingQueue | undefined;
37
+ renderingQueue?: import("./pdf_rendering_queue.js").PDFRenderingQueue | undefined;
38
38
  /**
39
39
  * - Controls if the text layer used for
40
40
  * selection and searching is created. The constants from {TextLayerMode}
@@ -86,6 +86,12 @@ export type PDFPageViewOptions = {
86
86
  * dom to allow right-clicking and saving them. Use `-1` to disable this.
87
87
  */
88
88
  imagesRightClickMinSize?: number | undefined;
89
+ /**
90
+ * - When enabled, renders text
91
+ * selections in the draw layer.
92
+ * The default value is `true`.
93
+ */
94
+ enableSelectionRendering?: boolean | undefined;
89
95
  /**
90
96
  * - When enabled, PDF
91
97
  * rendering will keep track of which areas of the page each PDF operation
@@ -130,9 +136,9 @@ export class PDFPageView extends BasePDFPageView {
130
136
  pageLabel: string | null;
131
137
  rotation: number;
132
138
  scale: number;
133
- viewport: import("../src/display/display_utils").PageViewport;
139
+ viewport: import("../src/display/page_viewport.js").PageViewport;
134
140
  pdfPageRotate: number;
135
- _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
141
+ _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null;
136
142
  imageResourcesPath: string;
137
143
  enableDetailCanvas: boolean;
138
144
  maxCanvasPixels: any;
@@ -157,6 +163,7 @@ export class PDFPageView extends BasePDFPageView {
157
163
  deleteMe(isCut: any): void;
158
164
  hasEditableAnnotations(): boolean;
159
165
  get _textHighlighter(): any;
166
+ _refreshAnnotationLayer(): void;
160
167
  reset({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, keepCanvasWrapper, preserveDetailViewState, }?: {
161
168
  keepAnnotationLayer?: boolean | undefined;
162
169
  keepAnnotationEditorLayer?: boolean | undefined;
@@ -192,7 +199,7 @@ export class PDFPageView extends BasePDFPageView {
192
199
  /**
193
200
  * A promise that is resolved with an {@link OptionalContentConfig}instance. The default value is `null`.
194
201
  */
195
- optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
202
+ optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | undefined;
196
203
  drawingDelay?: number | undefined;
197
204
  }): void;
198
205
  outputScale: OutputScale | undefined;
@@ -221,9 +228,9 @@ export class PDFPageView extends BasePDFPageView {
221
228
  _getRenderingContext(canvas: any, transform: any, recordOperations: any, recordImages: any): {
222
229
  canvas: any;
223
230
  transform: any;
224
- viewport: import("../src/display/display_utils").PageViewport;
231
+ viewport: import("../src/display/page_viewport.js").PageViewport;
225
232
  annotationMode: number;
226
- optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
233
+ optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null;
227
234
  annotationCanvasMap: any;
228
235
  pageColors: null;
229
236
  isEditing: boolean;
@@ -246,4 +253,4 @@ import { BasePDFPageView } from "./base_pdf_page_view.js";
246
253
  import { AnnotationLayerBuilder } from "./annotation_layer_builder.js";
247
254
  import { TextLayerBuilder } from "./text_layer_builder.js";
248
255
  import { XfaLayerBuilder } from "./xfa_layer_builder.js";
249
- import { OutputScale } from "../src/pdf";
256
+ import { OutputScale } from "../src/pdf.js";
@@ -1,6 +1,6 @@
1
- export type PDFViewer = import("./pdf_viewer").PDFViewer;
2
- export type PDFThumbnailViewer = import("./pdf_thumbnail_viewer").PDFThumbnailViewer;
3
- export type RenderableView = import("./renderable_view").RenderableView;
1
+ export type PDFViewer = import("./pdf_viewer.js").PDFViewer;
2
+ export type PDFThumbnailViewer = import("./pdf_thumbnail_viewer.js").PDFThumbnailViewer;
3
+ export type RenderableView = import("./renderable_view.js").RenderableView;
4
4
  /**
5
5
  * Controls rendering of the views for pages and thumbnails.
6
6
  */
@@ -1,4 +1,4 @@
1
- export type EventBus = import("./event_utils").EventBus;
1
+ export type EventBus = import("./event_utils.js").EventBus;
2
2
  export type PDFScriptingManagerOptions = {
3
3
  /**
4
4
  * - The application event bus.
@@ -1,7 +1,3 @@
1
- export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
2
- export type PageViewport = import("../src/display/display_utils").PageViewport;
3
- export type EventBus = import("./event_utils").EventBus;
4
- export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
5
1
  export type PDFThumbnailViewOptions = {
6
2
  /**
7
3
  * - The viewer element.
@@ -24,7 +20,7 @@ export type PDFThumbnailViewOptions = {
24
20
  * A promise that is resolved with an {@link OptionalContentConfig} instance.
25
21
  * The default value is `null`.
26
22
  */
27
- optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
23
+ optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | undefined;
28
24
  /**
29
25
  * - The navigation/linking service.
30
26
  */
@@ -52,6 +48,10 @@ export type PDFThumbnailViewOptions = {
52
48
  */
53
49
  pageColors?: Object | undefined;
54
50
  };
51
+ export type OptionalContentConfig = import("../src/display/optional_content_config.js").OptionalContentConfig;
52
+ export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
53
+ export type EventBus = import("./event_utils.js").EventBus;
54
+ export type PDFRenderingQueue = import("./pdf_rendering_queue.js").PDFRenderingQueue;
55
55
  export class PDFThumbnailView extends RenderableView {
56
56
  /**
57
57
  * @param {PDFThumbnailViewOptions} options
@@ -61,15 +61,15 @@ export class PDFThumbnailView extends RenderableView {
61
61
  pageLabel: string | null;
62
62
  pdfPage: any;
63
63
  rotation: number;
64
- viewport: import("../src/display/display_utils").PageViewport;
64
+ viewport: import("../src/display/page_viewport.js").PageViewport;
65
65
  pdfPageRotate: number;
66
- _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
66
+ _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null;
67
67
  maxCanvasPixels: any;
68
68
  maxCanvasDim: any;
69
69
  pageColors: Object | null;
70
- eventBus: import("./event_utils").EventBus;
70
+ eventBus: import("./event_utils.js").EventBus;
71
71
  linkService: PDFLinkService;
72
- renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
72
+ renderingQueue: import("./pdf_rendering_queue.js").PDFRenderingQueue;
73
73
  placeholder: any;
74
74
  div: HTMLDivElement;
75
75
  imageContainer: HTMLDivElement;
@@ -1,7 +1,7 @@
1
- export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
2
- export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
3
- export type EventBus = import("./event_utils").EventBus;
4
- export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
1
+ export type PDFDocumentProxy = import("../src/display/api.js").PDFDocumentProxy;
2
+ export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
3
+ export type EventBus = import("./event_utils.js").EventBus;
4
+ export type PDFRenderingQueue = import("./pdf_rendering_queue.js").PDFRenderingQueue;
5
5
  export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
6
6
  export type PDFThumbnailViewerOptions = {
7
7
  /**
@@ -49,6 +49,11 @@ export type PDFThumbnailViewerOptions = {
49
49
  * and merge features.
50
50
  */
51
51
  enableNewBadge?: boolean | undefined;
52
+ /**
53
+ * - Enables the merge feature.
54
+ * The default value is `false`.
55
+ */
56
+ enableMerge?: boolean | undefined;
52
57
  /**
53
58
  * - Enables split and merge features.
54
59
  * The default value is `false`.
@@ -70,13 +75,15 @@ export type PDFThumbnailViewerOptions = {
70
75
  */
71
76
  manageMenu?: Object | undefined;
72
77
  /**
73
- * - The button that opens a dialog
74
- * to add a PDF file to merge with the current one.
75
- *
76
- * /**
77
- * Viewer control to display thumbnails for pages in a PDF document.
78
+ * - The waiting bar elements shown during
79
+ * long-running operations.
80
+ */
81
+ waitingBar?: Object | undefined;
82
+ /**
83
+ * - The file picker and button used to
84
+ * add one or more PDF files to merge with the current one.
78
85
  */
79
- addFileButton: HTMLButtonElement;
86
+ addFileComponent?: Object | undefined;
80
87
  };
81
88
  /**
82
89
  * @typedef {Object} PDFThumbnailViewerOptions
@@ -98,6 +105,8 @@ export type PDFThumbnailViewerOptions = {
98
105
  * events.
99
106
  * @property {boolean} [enableNewBadge] - Enables the "new" badge for the split
100
107
  * and merge features.
108
+ * @property {boolean} [enableMerge] - Enables the merge feature.
109
+ * The default value is `false`.
101
110
  * @property {boolean} [enableSplitMerge] - Enables split and merge features.
102
111
  * The default value is `false`.
103
112
  * @property {Object} [statusBar] - The status bar elements to manage the status
@@ -106,24 +115,34 @@ export type PDFThumbnailViewerOptions = {
106
115
  * action.
107
116
  * @property {Object} [manageMenu] - The menu elements to manage saving edited
108
117
  * PDF.
109
- * @property {HTMLButtonElement} addFileButton - The button that opens a dialog
110
- * to add a PDF file to merge with the current one.
111
-
118
+ * @property {Object} [waitingBar] - The waiting bar elements shown during
119
+ * long-running operations.
120
+ * @property {Object} [addFileComponent] - The file picker and button used to
121
+ * add one or more PDF files to merge with the current one.
122
+ */
112
123
  /**
113
124
  * Viewer control to display thumbnails for pages in a PDF document.
114
125
  */
115
126
  export class PDFThumbnailViewer {
116
- static "__#private@#draggingScaleFactor": number;
117
- static "__#private@#getScaleFactor"(image: any): number;
127
+ static #draggingScaleFactor: number;
128
+ static #getScaleFactor(image: any): number;
129
+ static #fitImageDimensions(width: any, height: any, { minSide, maxSide }: {
130
+ minSide?: number | undefined;
131
+ maxSide: any;
132
+ }): {
133
+ width: any;
134
+ height: any;
135
+ };
136
+ static #fileToImageBitmap(file: any): Promise<ImageBitmap>;
118
137
  /**
119
138
  * @param {PDFThumbnailViewerOptions} options
120
139
  */
121
- constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableSplitMerge, enableNewBadge, statusBar, undoBar, manageMenu, addFileButton, }: PDFThumbnailViewerOptions);
140
+ constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableMerge, enableSplitMerge, enableNewBadge, statusBar, undoBar, waitingBar, manageMenu, addFileComponent, }: PDFThumbnailViewerOptions);
122
141
  scrollableContainer: HTMLElement | null;
123
142
  container: HTMLDivElement;
124
- eventBus: import("./event_utils").EventBus;
143
+ eventBus: import("./event_utils.js").EventBus;
125
144
  linkService: import("./pdf_link_service.js").PDFLinkService;
126
- renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
145
+ renderingQueue: import("./pdf_rendering_queue.js").PDFRenderingQueue;
127
146
  maxCanvasPixels: number | undefined;
128
147
  maxCanvasDim: number | undefined;
129
148
  pageColors: Object | null;
@@ -148,7 +167,7 @@ export class PDFThumbnailViewer {
148
167
  * @param {PDFDocumentProxy} pdfDocument
149
168
  */
150
169
  setDocument(pdfDocument: PDFDocumentProxy): void;
151
- pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
170
+ pdfDocument: import("../src/display/api.js").PDFDocumentProxy | undefined;
152
171
  /**
153
172
  * @param {Array|null} labels
154
173
  */
@@ -1,10 +1,10 @@
1
- export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
2
- export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
3
- export type PageViewport = import("../src/display/display_utils").PageViewport;
4
- export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
5
- export type EventBus = import("./event_utils").EventBus;
6
- export type PDFFindController = import("./pdf_find_controller").PDFFindController;
7
- export type PDFScriptingManager = import("./pdf_scripting_manager").PDFScriptingManager;
1
+ export type PDFDocumentProxy = import("../src/display/api.js").PDFDocumentProxy;
2
+ export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
3
+ export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
4
+ export type OptionalContentConfig = import("../src/display/optional_content_config.js").OptionalContentConfig;
5
+ export type EventBus = import("./event_utils.js").EventBus;
6
+ export type PDFFindController = import("./pdf_find_controller.js").PDFFindController;
7
+ export type PDFScriptingManager = import("./pdf_scripting_manager.js").PDFScriptingManager;
8
8
  export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
9
9
  export type BaseDownloadManager = import("./base_download_manager.js").BaseDownloadManager;
10
10
  export type L10n = import("./l10n.js").L10n;
@@ -34,12 +34,12 @@ export type PDFViewerOptions = {
34
34
  * - The find controller
35
35
  * component.
36
36
  */
37
- findController?: import("./pdf_find_controller").PDFFindController | undefined;
37
+ findController?: import("./pdf_find_controller.js").PDFFindController | undefined;
38
38
  /**
39
39
  * - The scripting manager
40
40
  * component.
41
41
  */
42
- scriptingManager?: import("./pdf_scripting_manager").PDFScriptingManager | undefined;
42
+ scriptingManager?: import("./pdf_scripting_manager.js").PDFScriptingManager | undefined;
43
43
  /**
44
44
  * - The rendering queue object.
45
45
  */
@@ -110,6 +110,12 @@ export type PDFViewerOptions = {
110
110
  * The default value is `true`.
111
111
  */
112
112
  enableDetailCanvas?: boolean | undefined;
113
+ /**
114
+ * - Enables rendering of text
115
+ * selections in the draw layer.
116
+ * The default value is `true`.
117
+ */
118
+ enableSelectionRendering?: boolean | undefined;
113
119
  /**
114
120
  * - All images whose width and
115
121
  * height are at least this value (in pixels) will be lazily inserted in the
@@ -205,6 +211,9 @@ export namespace PagesCountLimit {
205
211
  * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,
206
212
  * that only renders the part of the page that is close to the viewport.
207
213
  * The default value is `true`.
214
+ * @property {boolean} [enableSelectionRendering] - Enables rendering of text
215
+ * selections in the draw layer.
216
+ * The default value is `true`.
208
217
  * @property {number} [imagesRightClickMinSize] - All images whose width and
209
218
  * height are at least this value (in pixels) will be lazily inserted in the
210
219
  * dom to allow right-clicking and saving them. Use `-1` to disable this.
@@ -250,11 +259,11 @@ export class PDFViewer {
250
259
  constructor(options: PDFViewerOptions);
251
260
  container: HTMLDivElement;
252
261
  viewer: Element | null;
253
- eventBus: import("./event_utils").EventBus;
262
+ eventBus: import("./event_utils.js").EventBus;
254
263
  linkService: import("./pdf_link_service.js").PDFLinkService;
255
264
  downloadManager: import("./base_download_manager.js").BaseDownloadManager | null;
256
- findController: import("./pdf_find_controller").PDFFindController | null;
257
- _scriptingManager: import("./pdf_scripting_manager").PDFScriptingManager | null;
265
+ findController: import("./pdf_find_controller.js").PDFFindController | null;
266
+ _scriptingManager: import("./pdf_scripting_manager.js").PDFScriptingManager | null;
258
267
  imageResourcesPath: string;
259
268
  enablePrintAutoRotate: boolean;
260
269
  removePageBorders: boolean | undefined;
@@ -263,6 +272,7 @@ export class PDFViewer {
263
272
  capCanvasAreaFactor: number | undefined;
264
273
  enableDetailCanvas: boolean;
265
274
  enableOptimizedPartialRendering: boolean;
275
+ enableSelectionRendering: boolean;
266
276
  imagesRightClickMinSize: number;
267
277
  l10n: import("./l10n.js").L10n | undefined;
268
278
  pageColors: Object | null;
@@ -284,6 +294,10 @@ export class PDFViewer {
284
294
  * @type {boolean} - True if all {PDFPageView} objects are initialized.
285
295
  */
286
296
  get pageViewsReady(): boolean;
297
+ /**
298
+ * Clear text selections within the viewer.
299
+ */
300
+ clearSelection(): void;
287
301
  /**
288
302
  * @type {boolean}
289
303
  */
@@ -349,9 +363,9 @@ export class PDFViewer {
349
363
  * @param {PDFDocumentProxy} pdfDocument
350
364
  */
351
365
  setDocument(pdfDocument: PDFDocumentProxy): void;
352
- pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined;
366
+ pdfDocument: import("../src/display/api.js").PDFDocumentProxy | undefined;
353
367
  _scrollMode: any;
354
- _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null | undefined;
368
+ _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null | undefined;
355
369
  onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }: {
356
370
  pagesMapper: any;
357
371
  type: any;
@@ -5,9 +5,9 @@ export class RenderableView {
5
5
  */
6
6
  renderingId: string;
7
7
  /**
8
- * @type {import("../src/display/api").RenderTask | null}
8
+ * @type {import("../src/display/api.js").RenderTask | null}
9
9
  */
10
- renderTask: import("../src/display/api").RenderTask | null;
10
+ renderTask: import("../src/display/api.js").RenderTask | null;
11
11
  /**
12
12
  * @type {function | null}
13
13
  */
@@ -1,4 +1,4 @@
1
- export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
1
+ export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
2
2
  export type StructTreeLayerBuilderOptions = {
3
3
  pdfPage: PDFPageProxy;
4
4
  rawDims: Object;
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
14
14
  * @param {HTMLElement} e2
15
15
  * @returns {number}
16
16
  */
17
- static "__#private@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
17
+ static #compareElementPositions(e1: HTMLElement, e2: HTMLElement): number;
18
18
  setTextMapping(textDivs: any): void;
19
19
  /**
20
20
  * Function called when the text layer has finished rendering.
@@ -1,5 +1,5 @@
1
- export type EventBus = import("./event_utils").EventBus;
2
- export type PDFFindController = import("./pdf_find_controller").PDFFindController;
1
+ export type EventBus = import("./event_utils.js").EventBus;
2
+ export type PDFFindController = import("./pdf_find_controller.js").PDFFindController;
3
3
  export type TextHighlighterOptions = {
4
4
  findController: PDFFindController;
5
5
  /**
@@ -11,8 +11,8 @@ export type TextHighlighterOptions = {
11
11
  */
12
12
  pageIndex: number;
13
13
  };
14
- /** @typedef {import("./event_utils").EventBus} EventBus */
15
- /** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */
14
+ /** @typedef {import("./event_utils.js").EventBus} EventBus */
15
+ /** @typedef {import("./pdf_find_controller.js").PDFFindController} PDFFindController */
16
16
  /**
17
17
  * @typedef {Object} TextHighlighterOptions
18
18
  * @property {PDFFindController} findController
@@ -28,9 +28,9 @@ export class TextHighlighter {
28
28
  * @param {TextHighlighterOptions} options
29
29
  */
30
30
  constructor({ findController, eventBus, pageIndex }: TextHighlighterOptions);
31
- findController: import("./pdf_find_controller").PDFFindController;
31
+ findController: import("./pdf_find_controller.js").PDFFindController;
32
32
  matches: any[];
33
- eventBus: import("./event_utils").EventBus;
33
+ eventBus: import("./event_utils.js").EventBus;
34
34
  pageIdx: number;
35
35
  textDivs: Node[] | null;
36
36
  textContentItemsStr: string[] | null;