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
@@ -0,0 +1,137 @@
1
+ export type PageViewportParameters = {
2
+ /**
3
+ * - The xMin, yMin, xMax and
4
+ * yMax coordinates.
5
+ */
6
+ viewBox: Array<number>;
7
+ /**
8
+ * - The size of units.
9
+ */
10
+ userUnit: number;
11
+ /**
12
+ * - The scale of the viewport.
13
+ */
14
+ scale: number;
15
+ /**
16
+ * - The rotation, in degrees, of the viewport.
17
+ */
18
+ rotation: number;
19
+ /**
20
+ * - The horizontal, i.e. x-axis, offset. The
21
+ * default value is `0`.
22
+ */
23
+ offsetX?: number | undefined;
24
+ /**
25
+ * - The vertical, i.e. y-axis, offset. The
26
+ * default value is `0`.
27
+ */
28
+ offsetY?: number | undefined;
29
+ /**
30
+ * - If true, the y-axis will not be flipped.
31
+ * The default value is `false`.
32
+ */
33
+ dontFlip?: boolean | undefined;
34
+ };
35
+ export type PageViewportCloneParameters = {
36
+ /**
37
+ * - The scale, overriding the one in the cloned
38
+ * viewport. The default value is `this.scale`.
39
+ */
40
+ scale?: number | undefined;
41
+ /**
42
+ * - The rotation, in degrees, overriding the one
43
+ * in the cloned viewport. The default value is `this.rotation`.
44
+ */
45
+ rotation?: number | undefined;
46
+ /**
47
+ * - The horizontal, i.e. x-axis, offset.
48
+ * The default value is `this.offsetX`.
49
+ */
50
+ offsetX?: number | undefined;
51
+ /**
52
+ * - The vertical, i.e. y-axis, offset.
53
+ * The default value is `this.offsetY`.
54
+ */
55
+ offsetY?: number | undefined;
56
+ /**
57
+ * - If true, the x-axis will not be flipped.
58
+ * The default value is `false`.
59
+ */
60
+ dontFlip?: boolean | undefined;
61
+ };
62
+ /**
63
+ * @typedef {Object} PageViewportParameters
64
+ * @property {Array<number>} viewBox - The xMin, yMin, xMax and
65
+ * yMax coordinates.
66
+ * @property {number} userUnit - The size of units.
67
+ * @property {number} scale - The scale of the viewport.
68
+ * @property {number} rotation - The rotation, in degrees, of the viewport.
69
+ * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The
70
+ * default value is `0`.
71
+ * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The
72
+ * default value is `0`.
73
+ * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.
74
+ * The default value is `false`.
75
+ */
76
+ /**
77
+ * @typedef {Object} PageViewportCloneParameters
78
+ * @property {number} [scale] - The scale, overriding the one in the cloned
79
+ * viewport. The default value is `this.scale`.
80
+ * @property {number} [rotation] - The rotation, in degrees, overriding the one
81
+ * in the cloned viewport. The default value is `this.rotation`.
82
+ * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.
83
+ * The default value is `this.offsetX`.
84
+ * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.
85
+ * The default value is `this.offsetY`.
86
+ * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.
87
+ * The default value is `false`.
88
+ */
89
+ /**
90
+ * PDF page viewport created based on scale, rotation and offset.
91
+ */
92
+ export class PageViewport {
93
+ /**
94
+ * @param {PageViewportParameters}
95
+ */
96
+ constructor({ viewBox, userUnit, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
97
+ viewBox: number[];
98
+ userUnit: number;
99
+ scale: number;
100
+ rotation: number;
101
+ offsetX: number;
102
+ offsetY: number;
103
+ transform: number[];
104
+ width: number;
105
+ height: number;
106
+ /**
107
+ * The original, un-scaled, viewport dimensions.
108
+ * @type {Object}
109
+ */
110
+ get rawDims(): Object;
111
+ /**
112
+ * Clones viewport, with optional additional properties.
113
+ * @param {PageViewportCloneParameters} [params]
114
+ * @returns {PageViewport} Cloned viewport.
115
+ */
116
+ clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters): PageViewport;
117
+ /**
118
+ * Converts PDF point to the viewport coordinates. For examples, useful for
119
+ * converting PDF location into canvas pixel coordinates.
120
+ * @param {number} x - The x-coordinate.
121
+ * @param {number} y - The y-coordinate.
122
+ * @returns {Array} Array containing `x`- and `y`-coordinates of the
123
+ * point in the viewport coordinate space.
124
+ * @see {@link convertToPdfPoint}
125
+ */
126
+ convertToViewportPoint(x: number, y: number): any[];
127
+ /**
128
+ * Converts viewport coordinates to the PDF location. For examples, useful
129
+ * for converting canvas pixel location into PDF one.
130
+ * @param {number} x - The x-coordinate.
131
+ * @param {number} y - The y-coordinate.
132
+ * @returns {Array} Array containing `x`- and `y`-coordinates of the
133
+ * point in the PDF coordinate space.
134
+ * @see {@link convertToViewportPoint}
135
+ */
136
+ convertToPdfPoint(x: number, y: number): any[];
137
+ }
@@ -15,9 +15,16 @@ export class TilingPattern {
15
15
  ystep: any;
16
16
  paintType: any;
17
17
  tilingType: any;
18
+ needsIsolation: any;
18
19
  ctx: any;
19
20
  canvasGraphicsFactory: any;
20
21
  baseTransform: any;
22
+ patternBaseMatrix: any;
23
+ canSkipPatternCanvas([width, height, offsetX, offsetY]: [any, any, any, any]): number[] | null;
24
+ updatePatternDims(clippedBBox: any, dims: any): void;
25
+ _renderTileCanvas(owner: any, opIdx: any, dimx: any, dimy: any): any;
26
+ _getCombinedScales(): number[];
27
+ drawPattern(owner: any, path: any, useEOFill: boolean | undefined, [n, m]: [any, any], opIdx: any): void;
21
28
  createPatternCanvas(owner: any, opIdx: any): {
22
29
  canvas: any;
23
30
  canvasEntry: any;
@@ -47,16 +54,16 @@ declare class RadialAxialShadingPattern extends BaseShadingPattern {
47
54
  matrix: any;
48
55
  isOriginBased(): boolean;
49
56
  isRadial(): boolean;
50
- _isCircleCenterOutside(): boolean;
57
+ areConic(): boolean;
51
58
  _createGradient(ctx: any, transform?: null): any;
52
59
  _createReversedGradient(ctx: any, transform?: null): any;
53
60
  getPattern(ctx: any, owner: any, inverse: any, pathType: any): any;
54
61
  }
55
62
  declare class MeshShadingPattern extends BaseShadingPattern {
56
63
  constructor(IR: any);
57
- _coords: any;
58
- _colors: any;
59
- _figures: any;
64
+ _posData: any;
65
+ _colData: any;
66
+ _vertexCount: any;
60
67
  _bounds: any;
61
68
  _bbox: any;
62
69
  _background: any;
@@ -1,6 +1,6 @@
1
- export type PageViewport = import("./display_utils").PageViewport;
2
- export type TextContent = import("./api").TextContent;
3
- export type TextLayerImages = import("./text_layer_images").TextLayerImages;
1
+ export type PageViewport = import("./page_viewport.js").PageViewport;
2
+ export type TextContent = import("./api.js").TextContent;
3
+ export type TextLayerImages = import("./text_layer_images.js").TextLayerImages;
4
4
  export type TextLayerParameters = {
5
5
  /**
6
6
  * - Text content to
@@ -22,7 +22,7 @@ export type TextLayerParameters = {
22
22
  * - An optional TextLayerImages instance
23
23
  * that handles right clicking on images.
24
24
  */
25
- images?: import("./text_layer_images").TextLayerImages | undefined;
25
+ images?: import("./text_layer_images.js").TextLayerImages | undefined;
26
26
  };
27
27
  export type TextLayerUpdateParameters = {
28
28
  /**
@@ -37,24 +37,24 @@ export type TextLayerUpdateParameters = {
37
37
  onBefore?: Function | undefined;
38
38
  };
39
39
  export class TextLayer {
40
- static "__#private@#ascentCache": Map<any, any>;
41
- static "__#private@#canvasContexts": Map<any, any>;
42
- static "__#private@#canvasCtxFonts": WeakMap<object, any>;
43
- static "__#private@#minFontSize": null;
44
- static "__#private@#pendingTextLayers": Set<any>;
40
+ static #ascentCache: Map<any, any>;
41
+ static #canvasContexts: Map<any, any>;
42
+ static #canvasCtxFonts: WeakMap<object, any>;
43
+ static #minFontSize: null;
44
+ static #pendingTextLayers: Set<any>;
45
45
  static get fontFamilyMap(): any;
46
46
  /**
47
47
  * Clean-up global textLayer data.
48
48
  * @returns {undefined}
49
49
  */
50
50
  static cleanup(): undefined;
51
- static "__#private@#getCtx"(lang?: null): any;
52
- static "__#private@#ensureCtxFont"(ctx: any, size: any, family: any): void;
51
+ static #getCtx(lang?: null): any;
52
+ static #ensureCtxFont(ctx: any, size: any, family: any): void;
53
53
  /**
54
54
  * Compute the minimum font size enforced by the browser.
55
55
  */
56
- static "__#private@#ensureMinFontSizeComputed"(): void;
57
- static "__#private@#getAscent"(fontFamily: any, style: any, lang: any): any;
56
+ static #ensureMinFontSizeComputed(): void;
57
+ static #getAscent(fontFamily: any, style: any, lang: any): any;
58
58
  /**
59
59
  * @param {TextLayerParameters} options
60
60
  */
@@ -3,7 +3,7 @@
3
3
  * are populated with the corresponding image extracted from the PDF page.
4
4
  */
5
5
  export class TextLayerImages {
6
- static "__#private@#activeImage": null;
6
+ static #activeImage: null;
7
7
  constructor(minSize: any, coordinates: any, viewport: any, getPageCanvas: any);
8
8
  render(): HTMLDivElement;
9
9
  #private;
@@ -0,0 +1,11 @@
1
+ export function drawMeshWithGPU(posData: any, colData: any, vertexCount: any, context: any, backgroundColor: any, paddedWidth: any, paddedHeight: any, borderSize: any): ImageBitmap;
2
+ /**
3
+ * Start GPU initialization as early as possible.
4
+ * @returns {Promise<boolean>} true if a GPU device was acquired.
5
+ */
6
+ export function initGPU(): Promise<boolean>;
7
+ export function isGPUReady(): boolean;
8
+ /**
9
+ * Pre-compile the Gouraud-mesh WGSL pipeline.
10
+ */
11
+ export function loadMeshShader(): void;
@@ -1,6 +1,6 @@
1
1
  export class GlobalWorkerOptions {
2
- static "__#private@#port": null;
3
- static "__#private@#src": string;
2
+ static #port: null;
3
+ static #src: string;
4
4
  /**
5
5
  * @param {Worker | null} workerPort - Defines global port for worker process.
6
6
  * Overrides the `workerSrc` option.
@@ -1,11 +1,10 @@
1
- export type AnnotationStorage = import("./annotation_storage").AnnotationStorage;
2
- export type PageViewport = import("./display_utils").PageViewport;
1
+ export type AnnotationStorage = import("./annotation_storage.js").AnnotationStorage;
3
2
  export type PDFLinkService = import("../../web/pdf_link_service.js").PDFLinkService;
4
3
  export type XfaLayerParameters = {
5
4
  viewport: PageViewport;
6
5
  div: HTMLDivElement;
7
6
  xfaHtml: Object;
8
- annotationStorage?: import("./annotation_storage").AnnotationStorage | undefined;
7
+ annotationStorage?: import("./annotation_storage.js").AnnotationStorage | undefined;
9
8
  linkService: PDFLinkService;
10
9
  /**
11
10
  * - (default value is 'display').
@@ -44,4 +43,12 @@ export class XfaLayer {
44
43
  * @param {XfaLayerParameters} parameters
45
44
  */
46
45
  static update(parameters: XfaLayerParameters): void;
46
+ /**
47
+ * NOTE: This is (mostly) intended to support printing of XFA forms.
48
+ */
49
+ static getPageViewport(xfaPage: any, { scale, rotation }: {
50
+ scale?: number | undefined;
51
+ rotation?: number | undefined;
52
+ }): PageViewport;
47
53
  }
54
+ import { PageViewport } from "./page_viewport.js";
@@ -1,5 +1,5 @@
1
- export type TextContent = import("./api").TextContent;
2
- /** @typedef {import("./api").TextContent} TextContent */
1
+ export type TextContent = import("./api.js").TextContent;
2
+ /** @typedef {import("./api.js").TextContent} TextContent */
3
3
  export class XfaText {
4
4
  /**
5
5
  * Walk an XFA tree and create an array of text nodes that is compatible
@@ -1,9 +1,9 @@
1
- export type OnProgressParameters = import("./display/api").OnProgressParameters;
2
- export type PDFDocumentLoadingTask = import("./display/api").PDFDocumentLoadingTask;
3
- export type PDFDocumentProxy = import("./display/api").PDFDocumentProxy;
4
- export type PDFPageProxy = import("./display/api").PDFPageProxy;
5
- export type RenderTask = import("./display/api").RenderTask;
6
- export type PageViewport = import("./display/display_utils").PageViewport;
1
+ export type OnProgressParameters = import("./display/api.js").OnProgressParameters;
2
+ export type PDFDocumentLoadingTask = import("./display/api.js").PDFDocumentLoadingTask;
3
+ export type PDFDocumentProxy = import("./display/api.js").PDFDocumentProxy;
4
+ export type PDFPageProxy = import("./display/api.js").PDFPageProxy;
5
+ export type RenderTask = import("./display/api.js").RenderTask;
6
+ export type PageViewport = import("./display/page_viewport.js").PageViewport;
7
7
  import { AbortException } from "./shared/util.js";
8
8
  import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js";
9
9
  import { AnnotationEditorParamsType } from "./shared/util.js";
@@ -26,8 +26,8 @@ import { getDocument } from "./display/api.js";
26
26
  import { getFilenameFromUrl } from "./display/display_utils.js";
27
27
  import { getPdfFilenameFromUrl } from "./display/display_utils.js";
28
28
  import { getRGB } from "./display/display_utils.js";
29
+ import { getRGBA } from "./display/display_utils.js";
29
30
  import { getUuid } from "./shared/util.js";
30
- import { getXfaPageViewport } from "./display/display_utils.js";
31
31
  import { GlobalWorkerOptions } from "./display/worker_options.js";
32
32
  import { ImageKind } from "./shared/util.js";
33
33
  import { InvalidPDFException } from "./shared/util.js";
@@ -37,11 +37,12 @@ import { isValidExplicitDest } from "./display/api_utils.js";
37
37
  import { makeArr } from "./shared/util.js";
38
38
  import { makeMap } from "./shared/util.js";
39
39
  import { makeObj } from "./shared/util.js";
40
- import { MathClamp } from "./shared/util.js";
40
+ import { MathClamp } from "./shared/math_clamp.js";
41
41
  import { noContextMenu } from "./display/display_utils.js";
42
42
  import { normalizeUnicode } from "./shared/util.js";
43
43
  import { OPS } from "./shared/util.js";
44
44
  import { OutputScale } from "./display/display_utils.js";
45
+ import { PasswordException } from "./shared/util.js";
45
46
  import { PasswordResponses } from "./shared/util.js";
46
47
  import { PDFDataRangeTransport } from "./display/api.js";
47
48
  import { PDFDateString } from "./display/display_utils.js";
@@ -64,4 +65,4 @@ import { Util } from "./shared/util.js";
64
65
  import { VerbosityLevel } from "./shared/util.js";
65
66
  import { version } from "./display/api.js";
66
67
  import { XfaLayer } from "./display/xfa_layer.js";
67
- export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
68
+ export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, applyOpacity, build, ColorPicker, createValidAbsoluteUrl, CSSConstants, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, findContrastColor, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getRGBA, getUuid, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, makeArr, makeMap, makeObj, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordException, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, renderRichText, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TextLayerImages, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer };
@@ -10,6 +10,17 @@ export function convertBlackAndWhiteToRGBA({ src, srcPos, dest, width, height, n
10
10
  srcPos: number;
11
11
  destPos: number;
12
12
  };
13
+ export function convertRGBToRGBA({ src, srcPos, dest, destPos, width, height, }: {
14
+ src: any;
15
+ srcPos?: number | undefined;
16
+ dest: any;
17
+ destPos?: number | undefined;
18
+ width: any;
19
+ height: any;
20
+ }): {
21
+ srcPos: number;
22
+ destPos: number;
23
+ };
13
24
  export function convertToRGBA(params: any): {
14
25
  srcPos: number;
15
26
  destPos: number;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Keep this file in sync with `web/internal_evt.js`.
3
+ */
4
+ export const INTERNAL_EVT: any;
5
+ export const internalOpt: Readonly<{
6
+ internal: any;
7
+ }>;
@@ -0,0 +1 @@
1
+ export function MathClamp(v: any, min: any, max: any): number;
@@ -39,6 +39,7 @@ export namespace AnnotationEditorParamsType {
39
39
  let INK_COLOR: number;
40
40
  let INK_THICKNESS: number;
41
41
  let INK_OPACITY: number;
42
+ let INK_COLOR_AND_OPACITY: number;
42
43
  let HIGHLIGHT_COLOR: number;
43
44
  let HIGHLIGHT_THICKNESS: number;
44
45
  let HIGHLIGHT_FREE: number;
@@ -99,6 +100,13 @@ export namespace AnnotationMode {
99
100
  export let ENABLE_STORAGE: number;
100
101
  }
101
102
  export const AnnotationPrefix: "pdfjs_internal_id_";
103
+ export namespace AnnotationRenditionOperation {
104
+ let PLAY_OR_RESUME: number;
105
+ let STOP: number;
106
+ let PAUSE: number;
107
+ let RESUME: number;
108
+ let PLAY: number;
109
+ }
102
110
  export namespace AnnotationReplyType {
103
111
  let GROUP: string;
104
112
  let REPLY: string;
@@ -136,6 +144,7 @@ export namespace AnnotationType {
136
144
  export let WATERMARK: number;
137
145
  export let THREED: number;
138
146
  export let REDACT: number;
147
+ export let RICHMEDIA: number;
139
148
  }
140
149
  export function assert(cond: any, msg: any): void;
141
150
  /**
@@ -143,6 +152,7 @@ export function assert(cond: any, msg: any): void;
143
152
  */
144
153
  export const BaseException: any;
145
154
  export const BASELINE_FACTOR: number;
155
+ export const BBOX_INIT: number[];
146
156
  export function bytesToString(bytes: any): string;
147
157
  /**
148
158
  * Attempts to create a valid absolute URL.
@@ -167,15 +177,17 @@ export namespace DrawOPS {
167
177
  let quadraticCurveTo: number;
168
178
  let closePath: number;
169
179
  }
180
+ export const F32_BBOX_INIT: Float32Array<ArrayBuffer>;
170
181
  export class FeatureTest {
171
182
  static get isLittleEndian(): any;
172
- static get isEvalSupported(): any;
173
183
  static get isOffscreenCanvasSupported(): any;
174
184
  static get isImageDecoderSupported(): any;
175
185
  static get isFloat16ArraySupported(): any;
176
186
  static get isSanitizerSupported(): any;
177
187
  static get platform(): any;
178
- static get isCSSRoundSupported(): any;
188
+ static get isCanvasFilterSupported(): any;
189
+ static get isAlphaColorInputSupported(): any;
190
+ static get isBackdropFilterSupported(): any;
179
191
  }
180
192
  export const FONT_IDENTITY_MATRIX: number[];
181
193
  declare const FormatError_base: any;
@@ -186,10 +198,8 @@ export class FormatError extends FormatError_base {
186
198
  [x: string]: any;
187
199
  constructor(msg: any);
188
200
  }
189
- export function getModificationDate(date?: Date): string;
190
201
  export function getUuid(): string;
191
202
  export function getVerbosityLevel(): number;
192
- export const hexNumbers: string[];
193
203
  export namespace ImageKind {
194
204
  let GRAYSCALE_1BPP: number;
195
205
  let RGB_24BPP: number;
@@ -208,7 +218,6 @@ export const LINE_FACTOR: 1.35;
208
218
  export function makeArr(): never[];
209
219
  export function makeMap(): Map<any, any>;
210
220
  export function makeObj(): any;
211
- export function MathClamp(v: any, min: any, max: any): number;
212
221
  export namespace MeshFigureType {
213
222
  let TRIANGLES: number;
214
223
  let LATTICE: number;
@@ -360,11 +369,10 @@ export class ResponseException extends ResponseException_base {
360
369
  }
361
370
  export function setVerbosityLevel(level: any): void;
362
371
  export function shadow(obj: any, prop: any, value: any, nonSerializable?: boolean): any;
363
- export function string32(value: any): string;
364
- export function stringToBytes(str: any): Uint8Array<any>;
365
- export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string;
372
+ export function stringToBytes(str: any): Uint8Array<ArrayBuffer>;
366
373
  export function stringToUTF8String(str: any): string;
367
374
  export function stripPath(str: any): any;
375
+ export const SVG_NS: "http://www.w3.org/2000/svg";
368
376
  export namespace TextRenderingMode {
369
377
  export let FILL: number;
370
378
  export let STROKE: number;
@@ -384,7 +392,11 @@ export class UnknownErrorException extends UnknownErrorException_base {
384
392
  constructor(msg: any, details: any);
385
393
  details: any;
386
394
  }
387
- export function unreachable(msg: any): void;
395
+ /**
396
+ * @param {string} msg
397
+ * @returns {never}
398
+ */
399
+ export function unreachable(msg: string): never;
388
400
  /**
389
401
  * Remove, or replace, the hash property of the URL.
390
402
  *
@@ -396,9 +408,8 @@ export function unreachable(msg: any): void;
396
408
  export function updateUrlHash(url: URL | string, hash: string, allowRel?: boolean): string;
397
409
  export function utf8StringToString(str: any): string;
398
410
  export class Util {
411
+ static get hexNums(): any;
399
412
  static makeHexColor(r: any, g: any, b: any): string;
400
- static domMatrixToTransform(dm: any): any[];
401
- static scaleMinMax(transform: any, minMax: any): void;
402
413
  static transform(m1: any, m2: any): any[];
403
414
  static multiplyByDOMMatrix(m: any, md: any): any[];
404
415
  static applyTransform(p: any, m: any, pos?: number): void;
@@ -411,8 +422,8 @@ export class Util {
411
422
  static intersect(rect1: any, rect2: any): number[] | null;
412
423
  static pointBoundingBox(x: any, y: any, minMax: any): void;
413
424
  static rectBoundingBox(x0: any, y0: any, x1: any, y1: any, minMax: any): void;
414
- static "__#private@#getExtremumOnCurve"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void;
415
- static "__#private@#getExtremum"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void;
425
+ static #getExtremumOnCurve(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void;
426
+ static #getExtremum(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void;
416
427
  static bezierBoundingBox(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void;
417
428
  }
418
429
  export namespace VerbosityLevel {
@@ -1,16 +1,16 @@
1
- export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
- export type PageViewport = import("../src/display/display_utils").PageViewport;
1
+ export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
2
+ export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
3
3
  export type AnnotationEditorUIManager = import("../src/display/editor/tools.js").AnnotationEditorUIManager;
4
4
  export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
5
5
  export type AnnotationLayer = import("../src/display/annotation_layer.js").AnnotationLayer;
6
6
  export type StructTreeLayerBuilder = any;
7
7
  export type AnnotationEditorLayerBuilderOptions = {
8
- uiManager?: import("../src/pdf").AnnotationEditorUIManager | undefined;
8
+ uiManager?: import("../src/pdf.js").AnnotationEditorUIManager | undefined;
9
9
  pageIndex: number;
10
10
  l10n?: L10n;
11
11
  structTreeLayer?: StructTreeLayerBuilder;
12
12
  accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
13
- annotationLayer?: import("../src/pdf").AnnotationLayer | undefined;
13
+ annotationLayer?: import("../src/pdf.js").AnnotationLayer | undefined;
14
14
  textLayer?: TextLayer;
15
15
  drawLayer?: DrawLayer;
16
16
  onAppend?: Function | undefined;
@@ -61,4 +61,4 @@ export class AnnotationEditorLayerBuilder {
61
61
  show(): void;
62
62
  #private;
63
63
  }
64
- import { AnnotationEditorLayer } from "../src/pdf";
64
+ import { AnnotationEditorLayer } from "../src/pdf.js";
@@ -1,6 +1,6 @@
1
- export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
- export type PageViewport = import("../src/display/display_utils").PageViewport;
3
- export type AnnotationStorage = import("../src/display/annotation_storage").AnnotationStorage;
1
+ export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
2
+ export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
3
+ export type AnnotationStorage = import("../src/display/annotation_storage.js").AnnotationStorage;
4
4
  export type StructTreeLayerBuilder = import("./struct_tree_layer_builder.js").StructTreeLayerBuilder;
5
5
  export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager;
6
6
  export type AnnotationEditorUIManager = import("../src/display/editor/tools.js").AnnotationEditorUIManager;
@@ -9,7 +9,7 @@ export type PDFLinkService = import("./pdf_link_service.js").PDFLinkService;
9
9
  export type BaseDownloadManager = import("./base_download_manager.js").BaseDownloadManager;
10
10
  export type AnnotationLayerBuilderOptions = {
11
11
  pdfPage: PDFPageProxy;
12
- annotationStorage?: import("../src/display/annotation_storage").AnnotationStorage | undefined;
12
+ annotationStorage?: import("../src/display/annotation_storage.js").AnnotationStorage | undefined;
13
13
  /**
14
14
  * - Path for image resources, mainly
15
15
  * for annotation icons. Include trailing slash.
@@ -26,7 +26,7 @@ export type AnnotationLayerBuilderOptions = {
26
26
  } | null> | undefined;
27
27
  annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
28
28
  accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined;
29
- annotationEditorUIManager?: import("../src/pdf").AnnotationEditorUIManager | undefined;
29
+ annotationEditorUIManager?: import("../src/pdf.js").AnnotationEditorUIManager | undefined;
30
30
  onAppend?: Function | undefined;
31
31
  commentManager?: import("./comment_manager.js").CommentManager | undefined;
32
32
  };
@@ -37,6 +37,7 @@ export type AnnotationLayerBuilderRenderOptions = {
37
37
  */
38
38
  intent?: string | undefined;
39
39
  structTreeLayer?: import("./struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined;
40
+ optionalContentConfigPromise?: Promise<any> | undefined;
40
41
  };
41
42
  /**
42
43
  * @typedef {Object} AnnotationLayerBuilderOptions
@@ -63,18 +64,19 @@ export type AnnotationLayerBuilderRenderOptions = {
63
64
  * @property {PageViewport} viewport
64
65
  * @property {string} [intent] - The default value is "display".
65
66
  * @property {StructTreeLayerBuilder} [structTreeLayer]
67
+ * @property {Promise} [optionalContentConfigPromise]
66
68
  */
67
69
  export class AnnotationLayerBuilder {
68
70
  /**
69
71
  * @param {AnnotationLayerBuilderOptions} options
70
72
  */
71
73
  constructor({ pdfPage, linkService, downloadManager, annotationStorage, imageResourcesPath, renderForms, enableComment, commentManager, enableScripting, hasJSActionsPromise, fieldObjectsPromise, annotationCanvasMap, accessibilityManager, annotationEditorUIManager, onAppend, }: AnnotationLayerBuilderOptions);
72
- pdfPage: import("../src/display/api").PDFPageProxy;
74
+ pdfPage: import("../src/display/api.js").PDFPageProxy;
73
75
  linkService: import("./pdf_link_service.js").PDFLinkService;
74
76
  downloadManager: import("./base_download_manager.js").BaseDownloadManager | undefined;
75
77
  imageResourcesPath: string;
76
78
  renderForms: boolean;
77
- annotationStorage: import("../src/display/annotation_storage").AnnotationStorage;
79
+ annotationStorage: import("../src/display/annotation_storage.js").AnnotationStorage;
78
80
  enableComment: boolean;
79
81
  enableScripting: boolean;
80
82
  _hasJSActionsPromise: Promise<boolean>;
@@ -83,7 +85,7 @@ export class AnnotationLayerBuilder {
83
85
  } | null>;
84
86
  _annotationCanvasMap: Map<string, HTMLCanvasElement>;
85
87
  _accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager;
86
- _annotationEditorUIManager: import("../src/pdf").AnnotationEditorUIManager;
88
+ _annotationEditorUIManager: import("../src/pdf.js").AnnotationEditorUIManager;
87
89
  annotationLayer: AnnotationLayer | null;
88
90
  div: HTMLDivElement | null;
89
91
  _cancelled: boolean;
@@ -93,9 +95,10 @@ export class AnnotationLayerBuilder {
93
95
  * @returns {Promise<void>} A promise that is resolved when rendering of the
94
96
  * annotations is complete.
95
97
  */
96
- render({ viewport, intent, structTreeLayer }: AnnotationLayerBuilderRenderOptions): Promise<void>;
98
+ render({ viewport, intent, structTreeLayer, optionalContentConfigPromise, }: AnnotationLayerBuilderRenderOptions): Promise<void>;
97
99
  cancel(): void;
98
- hide(internal?: boolean): void;
100
+ refreshCanvases(): void;
101
+ hide(): void;
99
102
  hasEditableAnnotations(): boolean;
100
103
  /**
101
104
  * @param {Array<Object>} inferredLinks
@@ -105,4 +108,4 @@ export class AnnotationLayerBuilder {
105
108
  injectLinkAnnotations(inferredLinks: Array<Object>): Promise<void>;
106
109
  #private;
107
110
  }
108
- import { AnnotationLayer } from "../src/pdf";
111
+ import { AnnotationLayer } from "../src/pdf.js";
@@ -1,6 +1,6 @@
1
1
  export class AppOptions {
2
2
  static eventBus: any;
3
- static "__#private@#opts": Map<any, any>;
3
+ static #opts: Map<any, any>;
4
4
  static get(name: any): any;
5
5
  static getAll(kind?: null, defaultOnly?: boolean): any;
6
6
  static set(name: any, value: any): void;
@@ -1,7 +1,7 @@
1
1
  export class Autolinker {
2
- static "__#private@#index": number;
3
- static "__#private@#regex": any;
4
- static "__#private@#numericTLDRegex": any;
2
+ static #index: number;
3
+ static #regex: any;
4
+ static #numericTLDRegex: any;
5
5
  static findLinks(text: any): {
6
6
  url: string;
7
7
  index: any;
@@ -4,6 +4,7 @@ export class BasePDFPageView extends RenderableView {
4
4
  /** @type {null | HTMLDivElement} */
5
5
  div: null | HTMLDivElement;
6
6
  enableOptimizedPartialRendering: boolean;
7
+ enableSelectionRendering: boolean;
7
8
  imagesRightClickMinSize: number;
8
9
  eventBus: null;
9
10
  id: null;
@@ -1,5 +1,5 @@
1
1
  export class CommentManager {
2
- static "__#private@#hasForcedColors": null;
2
+ static #hasForcedColors: null;
3
3
  static _makeCommentColor(color: any, opacity: any): string | null;
4
4
  constructor(commentDialog: any, sidebar: any, eventBus: any, linkService: any, overlayManager: any, ltr: any, hasForcedColors: any, globalAbortSignal: any);
5
5
  dialogElement: any;