unpdf 1.8.0 → 1.9.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 (94) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.cts +15 -15
  4. package/dist/index.d.mts +15 -15
  5. package/dist/index.mjs +1 -1
  6. package/dist/pdfjs.mjs +37 -37
  7. package/dist/types/external/qcms/qcms.d.ts +11 -7
  8. package/dist/types/external/qcms/qcms_utils.d.ts +1 -6
  9. package/dist/types/src/core/base_stream.d.ts +8 -1
  10. package/dist/types/src/core/catalog.d.ts +12 -12
  11. package/dist/types/src/core/colorspace.d.ts +6 -15
  12. package/dist/types/src/core/core_utils.d.ts +18 -14
  13. package/dist/types/src/core/crypto.d.ts +0 -1
  14. package/dist/types/src/core/file_spec.d.ts +4 -9
  15. package/dist/types/src/core/icc_colorspace.d.ts +0 -1
  16. package/dist/types/src/core/image_resizer.d.ts +24 -0
  17. package/dist/types/src/core/image_utils.d.ts +4 -4
  18. package/dist/types/src/core/jpeg_stream.d.ts +1 -1
  19. package/dist/types/src/core/jpg.d.ts +9 -13
  20. package/dist/types/src/core/parser.d.ts +0 -2
  21. package/dist/types/src/core/pattern.d.ts +0 -2
  22. package/dist/types/src/core/primitives.d.ts +30 -16
  23. package/dist/types/src/core/sasl_prep.d.ts +1 -0
  24. package/dist/types/src/core/sound.d.ts +39 -0
  25. package/dist/types/src/core/string_utils.d.ts +1 -1
  26. package/dist/types/src/core/struct_tree.d.ts +3 -3
  27. package/dist/types/src/core/xml_parser.d.ts +1 -2
  28. package/dist/types/src/core/xref.d.ts +2 -15
  29. package/dist/types/src/display/annotation_layer.d.ts +9 -20
  30. package/dist/types/src/display/annotation_storage.d.ts +7 -7
  31. package/dist/types/src/display/api.d.ts +155 -108
  32. package/dist/types/src/display/canvas.d.ts +2 -1
  33. package/dist/types/src/display/canvas_dependency_tracker.d.ts +8 -3
  34. package/dist/types/src/display/content_disposition.d.ts +0 -1
  35. package/dist/types/src/display/display_utils.d.ts +2 -2
  36. package/dist/types/src/display/draw_layer.d.ts +2 -6
  37. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +18 -19
  38. package/dist/types/src/display/editor/color_picker.d.ts +1 -1
  39. package/dist/types/src/display/editor/comment.d.ts +1 -1
  40. package/dist/types/src/display/editor/draw.d.ts +78 -27
  41. package/dist/types/src/display/editor/drawers/freedraw.d.ts +11 -9
  42. package/dist/types/src/display/editor/drawers/highlight.d.ts +99 -15
  43. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +7 -2
  44. package/dist/types/src/display/editor/drawers/outline.d.ts +65 -2
  45. package/dist/types/src/display/editor/editor.d.ts +24 -22
  46. package/dist/types/src/display/editor/freetext.d.ts +1 -1
  47. package/dist/types/src/display/editor/highlight.d.ts +44 -35
  48. package/dist/types/src/display/editor/ink.d.ts +7 -2
  49. package/dist/types/src/display/editor/stamp.d.ts +1 -1
  50. package/dist/types/src/display/editor/tools.d.ts +21 -19
  51. package/dist/types/src/display/filter_factory.d.ts +1 -3
  52. package/dist/types/src/display/font_loader.d.ts +1 -15
  53. package/dist/types/src/display/network_utils.d.ts +1 -0
  54. package/dist/types/src/display/obj_bin_transform_display.d.ts +25 -38
  55. package/dist/types/src/display/page_viewport.d.ts +5 -5
  56. package/dist/types/src/display/pages_mapper.d.ts +10 -4
  57. package/dist/types/src/display/pattern_helper.d.ts +4 -3
  58. package/dist/types/src/display/pdf_objects.d.ts +1 -3
  59. package/dist/types/src/display/text_layer.d.ts +2 -0
  60. package/dist/types/src/display/touch_manager.d.ts +46 -9
  61. package/dist/types/src/display/worker_options.d.ts +2 -2
  62. package/dist/types/src/display/xfa_layer.d.ts +7 -12
  63. package/dist/types/src/display/xfa_text.d.ts +2 -5
  64. package/dist/types/src/pdf.d.ts +2 -1
  65. package/dist/types/src/shared/base_pdf_stream.d.ts +6 -7
  66. package/dist/types/src/shared/css_utils.d.ts +8 -0
  67. package/dist/types/src/shared/message_handler.d.ts +2 -11
  68. package/dist/types/src/shared/obj_bin_transform_utils.d.ts +4 -3
  69. package/dist/types/src/shared/util.d.ts +4 -6
  70. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -3
  71. package/dist/types/web/annotation_layer_builder.d.ts +8 -12
  72. package/dist/types/web/draw_layer_builder.d.ts +7 -9
  73. package/dist/types/web/event_utils.d.ts +12 -13
  74. package/dist/types/web/genericl10n.d.ts +2 -2
  75. package/dist/types/web/l10n.d.ts +1 -1
  76. package/dist/types/web/pdf_find_controller.d.ts +5 -6
  77. package/dist/types/web/pdf_find_utils.d.ts +8 -14
  78. package/dist/types/web/pdf_history.d.ts +1 -1
  79. package/dist/types/web/pdf_link_service.d.ts +5 -7
  80. package/dist/types/web/pdf_page_view.d.ts +3 -3
  81. package/dist/types/web/pdf_rendering_queue.d.ts +4 -5
  82. package/dist/types/web/pdf_scripting_manager.d.ts +4 -4
  83. package/dist/types/web/pdf_thumbnail_view.d.ts +2 -2
  84. package/dist/types/web/pdf_thumbnail_viewer.d.ts +14 -15
  85. package/dist/types/web/pdf_viewer.d.ts +36 -16
  86. package/dist/types/web/renderable_view.d.ts +1 -1
  87. package/dist/types/web/sidebar.d.ts +3 -3
  88. package/dist/types/web/struct_tree_layer_builder.d.ts +20 -6
  89. package/dist/types/web/text_accessibility.d.ts +4 -2
  90. package/dist/types/web/text_highlighter.d.ts +1 -2
  91. package/dist/types/web/text_layer_builder.d.ts +5 -5
  92. package/dist/types/web/ui_utils.d.ts +8 -13
  93. package/dist/types/web/xfa_layer_builder.d.ts +7 -7
  94. package/package.json +11 -11
@@ -1,11 +1,15 @@
1
1
  /**
2
+ * Converts `src` and hands the result to `copy_result`, laid out as RGB, or as
3
+ * RGBA with an opaque alpha when `add_alpha` is set.
4
+ *
2
5
  * # Safety
3
6
  *
4
7
  * This function is called directly from JavaScript.
5
8
  * @param {number} transformer
6
9
  * @param {Uint8Array} src
10
+ * @param {boolean} add_alpha
7
11
  */
8
- export function qcms_convert_array(transformer: number, src: Uint8Array): void;
12
+ export function qcms_convert_array(transformer: number, src: Uint8Array, add_alpha: boolean): void;
9
13
  /**
10
14
  * # Safety
11
15
  *
@@ -15,18 +19,18 @@ export function qcms_convert_array(transformer: number, src: Uint8Array): void;
15
19
  * @param {number} src2
16
20
  * @param {number} src3
17
21
  * @param {number} src4
18
- * @param {boolean} css
22
+ * @returns {number}
19
23
  */
20
- export function qcms_convert_four(transformer: number, src1: number, src2: number, src3: number, src4: number, css: boolean): void;
24
+ export function qcms_convert_four(transformer: number, src1: number, src2: number, src3: number, src4: number): number;
21
25
  /**
22
26
  * # Safety
23
27
  *
24
28
  * This function is called directly from JavaScript.
25
29
  * @param {number} transformer
26
30
  * @param {number} src
27
- * @param {boolean} css
31
+ * @returns {number}
28
32
  */
29
- export function qcms_convert_one(transformer: number, src: number, css: boolean): void;
33
+ export function qcms_convert_one(transformer: number, src: number): number;
30
34
  /**
31
35
  * # Safety
32
36
  *
@@ -35,9 +39,9 @@ export function qcms_convert_one(transformer: number, src: number, css: boolean)
35
39
  * @param {number} src1
36
40
  * @param {number} src2
37
41
  * @param {number} src3
38
- * @param {boolean} css
42
+ * @returns {number}
39
43
  */
40
- export function qcms_convert_three(transformer: number, src1: number, src2: number, src3: number, css: boolean): void;
44
+ export function qcms_convert_three(transformer: number, src1: number, src2: number, src3: number): number;
41
45
  /**
42
46
  * # Safety
43
47
  *
@@ -1,14 +1,9 @@
1
1
  export function copy_result(ptr: any, len: any): void;
2
- export function copy_rgb(ptr: any): void;
3
- export function make_cssRGB(ptr: any): void;
4
2
  export class QCMS {
5
3
  static #memoryArray: null;
6
4
  static _memory: null;
7
- static _mustAddAlpha: boolean;
8
5
  static _destBuffer: null;
9
6
  static _destOffset: number;
10
- static _destLength: number;
11
- static _cssColor: string;
12
- static _makeHexColor: null;
7
+ static _keepAlpha: boolean;
13
8
  static get _memoryArray(): Uint8Array<any>;
14
9
  }
@@ -1,15 +1,18 @@
1
1
  export class BaseStream {
2
2
  /**
3
+ * @abstract
3
4
  * @returns {number}
4
5
  */
5
6
  get length(): number;
6
7
  /**
8
+ * @abstract
7
9
  * @returns {boolean}
8
10
  */
9
11
  get isEmpty(): boolean;
10
12
  get isDataLoaded(): any;
11
13
  getByte(): void;
12
14
  /**
15
+ * @abstract
13
16
  * @param {number | undefined} [length]
14
17
  * @returns {Uint8Array}
15
18
  */
@@ -25,7 +28,11 @@ export class BaseStream {
25
28
  get isAsyncDecoder(): boolean;
26
29
  get isImageStream(): boolean;
27
30
  get canAsyncDecodeImageFromBuffer(): boolean;
28
- getTransferableImage(): Promise<null>;
31
+ /**
32
+ * @param {number} width - The width from the image dictionary.
33
+ * @param {number} height - The height from the image dictionary.
34
+ */
35
+ getTransferableImage(width: number, height: number): Promise<null>;
29
36
  peekByte(): void;
30
37
  peekBytes(length: any): Uint8Array<ArrayBufferLike>;
31
38
  getUint16(): any;
@@ -29,9 +29,9 @@ export type CatalogAttachment = {
29
29
  };
30
30
  export class Catalog {
31
31
  /**
32
- * @typedef {Object} ParseDestDictionaryParameters
32
+ * @typedef {object} ParseDestDictionaryParameters
33
33
  * @property {Dict} destDict - The dictionary containing the destination.
34
- * @property {Object} resultObj - The object where the parsed destination
34
+ * @property {object} resultObj - The object where the parsed destination
35
35
  * properties will be placed.
36
36
  * @property {string} [docBaseUrl] - The document base URL that is used when
37
37
  * attempting to recover valid absolute URLs from relative ones.
@@ -60,7 +60,7 @@ export class Catalog {
60
60
  * - The object where the parsed destination
61
61
  * properties will be placed.
62
62
  */
63
- resultObj: Object;
63
+ resultObj: object;
64
64
  /**
65
65
  * - The document base URL that is used when
66
66
  * attempting to recover valid absolute URLs from relative ones.
@@ -74,13 +74,13 @@ export class Catalog {
74
74
  }): void;
75
75
  constructor(pdfManager: any, xref: any);
76
76
  builtInCMapCache: Map<any, any>;
77
- fontCache: RefSetCache;
77
+ fontCache: RefMap;
78
78
  globalColorSpaceCache: GlobalColorSpaceCache;
79
79
  globalImageCache: GlobalImageCache;
80
80
  nonBlendModesSet: RefSet;
81
- pageDictCache: RefSetCache;
82
- pageIndexCache: RefSetCache;
83
- pageKidsCountCache: RefSetCache;
81
+ pageDictCache: RefMap;
82
+ pageIndexCache: RefMap;
83
+ pageKidsCountCache: RefMap;
84
84
  standardFontDataCache: Map<any, any>;
85
85
  systemFontCache: Map<any, any>;
86
86
  pdfManager: any;
@@ -92,13 +92,15 @@ export class Catalog {
92
92
  * The id is registered here rather than parsed from a public string prefix in
93
93
  * `attachmentContent`, since catalog attachment names can be arbitrary PDF
94
94
  * strings and may otherwise collide with annotation-local ids.
95
- *
96
95
  * @param {Ref} ref
97
96
  * File-spec or embedded-file stream reference.
97
+ * @param {boolean} [isSound]
98
+ * When set, the referenced stream holds raw PDF sound samples that
99
+ * `attachmentContent` wraps in a WAV container on fetch.
98
100
  * @returns {string}
99
101
  * Attachment id.
100
102
  */
101
- getAttachmentIdForAnnotation(ref: Ref): string;
103
+ getAttachmentIdForAnnotation(ref: Ref, isSound?: boolean): string;
102
104
  get version(): any;
103
105
  get lang(): any;
104
106
  /**
@@ -132,14 +134,12 @@ export class Catalog {
132
134
  get openAction(): any;
133
135
  /**
134
136
  * Get attachments.
135
- *
136
137
  * @returns {Map<string, CatalogAttachment> | null}
137
138
  * Attachments.
138
139
  */
139
140
  get attachments(): Map<string, CatalogAttachment> | null;
140
141
  /**
141
142
  * Get content for an attachment.
142
- *
143
143
  * @param {string} id
144
144
  * Unique attachment identifier (required).
145
145
  * @returns {CatalogAttachmentContent}
@@ -160,7 +160,7 @@ export class Catalog {
160
160
  get baseUrl(): any;
161
161
  #private;
162
162
  }
163
- import { RefSetCache } from "./primitives.js";
163
+ import { RefMap } from "./primitives.js";
164
164
  import { GlobalColorSpaceCache } from "./image_utils.js";
165
165
  import { GlobalImageCache } from "./image_utils.js";
166
166
  import { RefSet } from "./primitives.js";
@@ -11,7 +11,6 @@ export class AlternateCS extends ColorSpace {
11
11
  base: any;
12
12
  tintFn: any;
13
13
  tmpBuf: Float32Array<any>;
14
- getOutputLength(inputLength: any, alpha01: any): any;
15
14
  }
16
15
  /**
17
16
  * CalGrayCS: Based on "PDF Reference, Sixth Ed", p.245
@@ -24,7 +23,6 @@ export class CalGrayCS extends ColorSpace {
24
23
  XB: any;
25
24
  YB: any;
26
25
  ZB: any;
27
- getOutputLength(inputLength: any, alpha01: any): number;
28
26
  #private;
29
27
  }
30
28
  /**
@@ -47,7 +45,6 @@ export class CalRGBCS extends ColorSpace {
47
45
  GR: any;
48
46
  GG: any;
49
47
  GB: any;
50
- getOutputLength(inputLength: any, alpha01: any): number;
51
48
  #private;
52
49
  }
53
50
  export class ColorSpace {
@@ -88,11 +85,12 @@ export class ColorSpace {
88
85
  */
89
86
  getRgbBuffer(src: any, srcOffset: any, count: any, dest: any, destOffset: any, bits: any, alpha01: any): void;
90
87
  /**
91
- * Determines the number of bytes required to store the result of the
92
- * conversion done by the getRgbBuffer method. As in getRgbBuffer,
93
- * |alpha01| is either 0 (RGB output) or 1 (RGBA output).
88
+ * Converts `count` unscaled colors to RGB, starting at `destOffset`.
89
+ * Components use the native color-space ranges expected by `getRgbItem`,
90
+ * and each output has a `3 + alpha01` byte stride.
91
+ * Subclasses may override this to batch expensive conversions.
94
92
  */
95
- getOutputLength(inputLength: any, alpha01: any): void;
93
+ getRgbItems(src: any, count: any, dest: any, destOffset: any, alpha01: any): void;
96
94
  /**
97
95
  * Returns true if source data will be equal the result/output data.
98
96
  */
@@ -119,7 +117,6 @@ export class ColorSpace {
119
117
  */
120
118
  export class DeviceCmykCS extends ColorSpace {
121
119
  constructor();
122
- getOutputLength(inputLength: any, alpha01: any): number;
123
120
  #private;
124
121
  }
125
122
  /**
@@ -127,31 +124,26 @@ export class DeviceCmykCS extends ColorSpace {
127
124
  */
128
125
  export class DeviceGrayCS extends ColorSpace {
129
126
  constructor();
130
- getOutputLength(inputLength: any, alpha01: any): number;
131
127
  }
132
128
  /**
133
129
  * The default color is `new Float32Array([0, 0, 0, 1])`.
134
130
  */
135
131
  export class DeviceRgbaCS extends ColorSpace {
136
132
  constructor();
137
- getOutputLength(inputLength: any, _alpha01: any): number;
138
133
  }
139
134
  /**
140
135
  * The default color is `new Float32Array([0, 0, 0])`.
141
136
  */
142
137
  export class DeviceRgbCS extends ColorSpace {
143
138
  constructor();
144
- getOutputLength(inputLength: any, alpha01: any): number;
145
139
  }
146
140
  /**
147
141
  * The default color is `new Uint8Array([0])`.
148
142
  */
149
143
  export class IndexedCS extends ColorSpace {
150
144
  constructor(base: any, highVal: any, lookup: any);
151
- base: any;
152
145
  highVal: any;
153
- lookup: Uint8Array<ArrayBuffer>;
154
- getOutputLength(inputLength: any, alpha01: any): any;
146
+ #private;
155
147
  }
156
148
  /**
157
149
  * LabCS: Based on "PDF Reference, Sixth Ed", p.250
@@ -167,7 +159,6 @@ export class LabCS extends ColorSpace {
167
159
  amax: any;
168
160
  bmin: any;
169
161
  bmax: any;
170
- getOutputLength(inputLength: any, alpha01: any): number;
171
162
  #private;
172
163
  }
173
164
  export class PatternCS extends ColorSpace {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export function arrayBuffersToBytes(arr: Array<ArrayBuffer>): Uint8Array;
7
7
  export function codePointIter(str: any): Generator<any, void, unknown>;
8
- export function collectActions(xref: any, dict: any, eventType: any): any;
8
+ export function collectActions(xref: any, dict: any, eventType: any): Map<any, any> | null;
9
9
  export function deepCompare(a: any, b: any): boolean;
10
10
  export function encodeToXmlString(str: any): any;
11
11
  export function escapePDFName(str: any): any;
@@ -21,23 +21,27 @@ export function fetchBinaryData(url: any): Promise<Uint8Array<ArrayBuffer>>;
21
21
  * If the key is not found in the tree, `undefined` is returned. Otherwise,
22
22
  * the value for the key is returned or, if `stopWhenFound` is `false`, a list
23
23
  * of values is returned.
24
- *
25
- * @param {Dict} dict - Dictionary from where to start the traversal.
26
- * @param {string} key - The key of the property to find the value for.
27
- * @param {boolean} getArray - Whether or not the value should be fetched as an
28
- * array. The default value is `false`.
29
- * @param {boolean} stopWhenFound - Whether or not to stop the traversal when
30
- * the key is found. If set to `false`, we always walk up the entire parent
31
- * chain, for example to be able to find `\Resources` placed on multiple
32
- * levels of the tree. The default value is `true`.
24
+ * @param {object} params
25
+ * @param {Dict} params.dict - Dictionary from where to start the traversal.
26
+ * @param {string} params.key - The key of the property to find the value for.
27
+ * @param {boolean} params.getArray - Whether or not the value should be fetched
28
+ * as an array. The default value is `false`.
29
+ * @param {boolean} params.stopWhenFound - Whether or not to stop the traversal
30
+ * when the key is found. If set to `false`, we always walk up the entire
31
+ * parent chain, for example to be able to find `\Resources` placed on
32
+ * multiple levels of the tree. The default value is `true`.
33
33
  */
34
- export function getInheritableProperty({ dict, key, getArray, stopWhenFound, }: Dict): any;
35
- export function getLookupTableFactory(initializer: any): () => any;
34
+ export function getInheritableProperty({ dict, key, getArray, stopWhenFound, }: {
35
+ dict: Dict;
36
+ key: string;
37
+ getArray: boolean;
38
+ stopWhenFound: boolean;
39
+ }): any;
40
+ export function getLookupTableFactory(initializer: any, useArray?: boolean): () => any;
36
41
  export function getModificationDate(date?: Date): string;
37
42
  export function getNewAnnotationsMap(annotationStorage: any): Map<any, any> | null;
38
43
  /**
39
44
  * Get the parent dictionary to update when a property is set.
40
- *
41
45
  * @param {Dict} dict - Dictionary from where to start the traversal.
42
46
  * @param {Ref} ref - The reference to the dictionary.
43
47
  * @param {XRef} xref - The `XRef` instance.
@@ -84,6 +88,7 @@ export class MissingDataException extends MissingDataException_base {
84
88
  begin: any;
85
89
  end: any;
86
90
  }
91
+ export function normalizeCSSFontFamily(fontFamily: any): any;
87
92
  export function numberToString(value: any): any;
88
93
  declare const ParserEOFException_base: any;
89
94
  export class ParserEOFException extends ParserEOFException_base {
@@ -94,7 +99,6 @@ export class ParserEOFException extends ParserEOFException_base {
94
99
  * AcroForm field names use an array like notation to refer to
95
100
  * repeated XFA elements e.g. foo.bar[nnn].
96
101
  * see: XFA Spec Chapter 3 - Repeated Elements
97
- *
98
102
  * @param {string} path - XFA path name.
99
103
  * @returns {Array} - Array of Objects with the name and pos of
100
104
  * each part of the path.
@@ -79,7 +79,6 @@ export class CipherTransformFactory {
79
79
  encryptionKey: any;
80
80
  /**
81
81
  * Set password.
82
- *
83
82
  * @param {string} password
84
83
  * New password.
85
84
  * @returns {undefined}
@@ -14,7 +14,6 @@ export class FileSpec {
14
14
  *
15
15
  * Search order follows the PDF platform keys: `UF`, `F`, `Unix`, `Mac`,
16
16
  * `DOS`.
17
- *
18
17
  * @param {Dict | null | undefined} dict
19
18
  * Dictionary.
20
19
  * @param {boolean} [raw]
@@ -25,14 +24,12 @@ export class FileSpec {
25
24
  static pickPlatformItem(dict: Dict | null | undefined, raw?: boolean): unknown;
26
25
  /**
27
26
  * Whether a file specification carries an embedded file we can read.
28
- *
29
27
  * @param {Dict} fileSpecDict
30
28
  * @returns {boolean}
31
29
  */
32
30
  static hasEmbeddedFile(fileSpecDict: Dict): boolean;
33
31
  /**
34
32
  * Read attachment bytes from a file-spec dictionary.
35
- *
36
33
  * @param {Dict | null | undefined} dict
37
34
  * File-spec dictionary containing an `EF` entry.
38
35
  * @returns {CatalogAttachmentContent}
@@ -43,7 +40,6 @@ export class FileSpec {
43
40
  static readContent(dict: Dict | null | undefined): CatalogAttachmentContent;
44
41
  /**
45
42
  * Read the bytes of an embedded-file stream.
46
- *
47
43
  * @param {BaseStream} stream
48
44
  * Embedded-file stream.
49
45
  * @returns {CatalogAttachmentContent}
@@ -58,13 +54,12 @@ export class FileSpec {
58
54
  */
59
55
  constructor(root: Dict | null | undefined);
60
56
  root: Dict | undefined;
61
- fs: any;
62
- get filename(): string;
63
- get description(): string;
57
+ get filename(): any;
58
+ get description(): any;
64
59
  get serializable(): {
65
- rawFilename: string;
60
+ rawFilename: any;
66
61
  filename: any;
67
- description: string;
62
+ description: any;
68
63
  };
69
64
  }
70
65
  import { Dict } from "./primitives.js";
@@ -16,7 +16,6 @@ export class IccColorSpace extends ColorSpace {
16
16
  }): void;
17
17
  static get isUsable(): any;
18
18
  constructor(iccProfile: any, name: any, numComps: any);
19
- getOutputLength(inputLength: any, alpha01: any): number;
20
19
  #private;
21
20
  }
22
21
  import { ColorSpace } from "./colorspace.js";
@@ -0,0 +1,24 @@
1
+ export class ImageResizer {
2
+ static #goodSquareLength: number;
3
+ static #isImageDecoderSupported: any;
4
+ static get canUseImageDecoder(): any;
5
+ static needsToBeResized(width: any, height: any): boolean;
6
+ static set MAX_AREA(area: any);
7
+ static get MAX_AREA(): any;
8
+ static getReducePower(width: any, height: any, maxArea?: number): number;
9
+ static getReducePowerForJPX(width: any, height: any, componentsCount: any): number;
10
+ static get MAX_DIM(): any;
11
+ static setOptions({ canvasMaxAreaInBytes, isImageDecoderSupported, }: {
12
+ canvasMaxAreaInBytes?: number | undefined;
13
+ isImageDecoderSupported?: boolean | undefined;
14
+ }): void;
15
+ static _areGoodDims(width: any, height: any): boolean;
16
+ static _guessMax(start: any, end: any, tolerance: any, defaultHeight: any): any;
17
+ static createImage(imgData: any, isMask?: boolean): Promise<any>;
18
+ constructor(imgData: any, isMask: any);
19
+ _imgData: any;
20
+ _isMask: any;
21
+ _createImage(): Promise<any>;
22
+ _encodeBMP(): Uint8Array<any>;
23
+ #private;
24
+ }
@@ -6,8 +6,8 @@ export class GlobalImageCache {
6
6
  static NUM_PAGES_THRESHOLD: number;
7
7
  static MIN_IMAGES_TO_CACHE: number;
8
8
  static MAX_BYTE_SIZE: number;
9
- _refCache: RefSetCache;
10
- _imageCache: RefSetCache;
9
+ _refCache: RefMap;
10
+ _imageCache: RefMap;
11
11
  shouldCache(ref: any, pageIndex: any): boolean;
12
12
  addDecodeFailed(ref: any): void;
13
13
  hasDecodeFailed(ref: any): boolean;
@@ -43,10 +43,10 @@ declare class BaseLocalCache {
43
43
  _onlyRefs: boolean;
44
44
  _nameRefMap: Map<any, any> | undefined;
45
45
  _imageMap: Map<any, any> | undefined;
46
- _imageCache: RefSetCache;
46
+ _imageCache: RefMap;
47
47
  getByName(name: any): any;
48
48
  getByRef(ref: any): any;
49
49
  set(name: any, ref: any, data: any): void;
50
50
  }
51
- import { RefSetCache } from "./primitives.js";
51
+ import { RefMap } from "./primitives.js";
52
52
  export {};
@@ -18,7 +18,7 @@ export class JpegStream extends DecodeStream {
18
18
  get jpegOptions(): any;
19
19
  decodeImage(bytes: any): Uint8Array<ArrayBuffer>;
20
20
  get canAsyncDecodeImageFromBuffer(): any;
21
- getTransferableImage(): Promise<VideoFrame | null>;
21
+ getTransferableImage(width: any, height: any): Promise<VideoFrame | null>;
22
22
  #private;
23
23
  }
24
24
  import { DecodeStream } from "./decode_stream.js";
@@ -5,18 +5,15 @@ export class JpegError extends JpegError_base {
5
5
  }
6
6
  export class JpegImage {
7
7
  static canUseImageDecoder(data: any, colorTransform?: number): {
8
- exifStart: any;
9
- exifEnd: any;
10
- } | {
11
- exifStart?: undefined;
12
- exifEnd?: undefined;
8
+ width: number;
9
+ height: number;
10
+ exifStart: number;
11
+ exifEnd: number;
13
12
  } | null;
14
- constructor({ decodeTransform, colorTransform }?: {
15
- decodeTransform?: null | undefined;
16
- colorTransform?: number | undefined;
17
- });
13
+ constructor(options: any);
14
+ _colorTransform: any;
18
15
  _decodeTransform: any;
19
- _colorTransform: number;
16
+ _isSourcePDF: boolean | undefined;
20
17
  parse(data: any, { dnlScanLines }?: {
21
18
  dnlScanLines?: null | undefined;
22
19
  }): any;
@@ -50,13 +47,12 @@ export class JpegImage {
50
47
  _convertYcckToCmyk(data: any): any;
51
48
  _convertCmykToRgb(data: any): any;
52
49
  _convertCmykToRgba(data: any): any;
53
- getData({ width, height, forceRGBA, forceRGB, isSourcePDF, }: {
50
+ getData({ width, height, forceRGBA, forceRGB }: {
54
51
  width: any;
55
52
  height: any;
56
53
  forceRGBA?: boolean | undefined;
57
54
  forceRGB?: boolean | undefined;
58
- isSourcePDF?: boolean | undefined;
59
- }): any;
55
+ }, ...args: any[]): any;
60
56
  #private;
61
57
  }
62
58
  export {};
@@ -42,8 +42,6 @@ export class Parser {
42
42
  xref: any;
43
43
  allowStreams: boolean;
44
44
  recoveryMode: boolean;
45
- imageCache: any;
46
- _imageId: number;
47
45
  refill(): void;
48
46
  buf1: any;
49
47
  buf2: any;
@@ -28,8 +28,6 @@ declare class RadialAxialShading extends BaseShading {
28
28
  shadingType: any;
29
29
  coordsArr: any;
30
30
  bbox: any;
31
- extendStart: boolean;
32
- extendEnd: boolean;
33
31
  colorStops: any[];
34
32
  getIR(): any[];
35
33
  }
@@ -1,6 +1,10 @@
1
1
  export const CIRCULAR_REF: unique symbol;
2
2
  export function clearPrimitiveCaches(): void;
3
3
  export class Cmd {
4
+ /**
5
+ * NOTE: This method is invoked a lot, hence `getOrInsertComputed` is
6
+ * purposely *not* used to avoid creating unneeded callback functions.
7
+ */
4
8
  static get(cmd: any): any;
5
9
  constructor(cmd: any);
6
10
  cmd: any;
@@ -19,9 +23,9 @@ export class Dict {
19
23
  xref: any;
20
24
  assignXref(newXref: any): void;
21
25
  get size(): number;
22
- get(key1: any, key2: any, key3: any): any;
23
- getAsync(key1: any, key2: any, key3: any): Promise<any>;
24
- getArray(key1: any, key2: any, key3: any): any;
26
+ get(key1: any, key2: any): any;
27
+ getAsync(key1: any, key2: any): Promise<any>;
28
+ getArray(key1: any, key2: any): any;
25
29
  getRaw(key: any): any;
26
30
  getKeys(): MapIterator<any>;
27
31
  getRawValues(): MapIterator<any>;
@@ -45,37 +49,47 @@ export function isDict(v: any, type: any): boolean;
45
49
  export function isName(v: any, name: any): boolean;
46
50
  export function isRefsEqual(v1: any, v2: any): boolean;
47
51
  export class Name {
52
+ /**
53
+ * NOTE: This method is invoked a lot, hence `getOrInsertComputed` is
54
+ * purposely *not* used to avoid creating unneeded callback functions.
55
+ */
48
56
  static get(name: any): any;
49
57
  constructor(name: any);
50
58
  name: any;
51
59
  }
52
60
  export class Ref {
53
61
  static fromString(str: any): any;
62
+ /**
63
+ * NOTE: This method is invoked a lot, hence `getOrInsertComputed` is
64
+ * purposely *not* used to avoid creating unneeded callback functions.
65
+ */
54
66
  static get(num: any, gen: any): any;
55
- constructor(num: any, gen: any);
67
+ constructor(str: any, num: any, gen: any);
56
68
  num: any;
57
69
  gen: any;
58
- toString(): string;
59
- }
60
- export class RefSet {
61
- constructor(parent?: null);
62
- _set: Set<any>;
63
- has(ref: any): boolean;
64
- put(ref: any): void;
65
- remove(ref: any): void;
66
- clear(): void;
67
- [Symbol.iterator](): SetIterator<any>;
70
+ toString(): any;
71
+ #private;
68
72
  }
69
- export class RefSetCache {
70
- _map: Map<any, any>;
73
+ export class RefMap {
71
74
  get size(): number;
72
75
  get(ref: any): any;
73
76
  has(ref: any): boolean;
74
77
  put(ref: any, obj: any): void;
75
78
  putAlias(ref: any, aliasRef: any): void;
79
+ getOrPutComputed(ref: any, callback: any): any;
76
80
  clear(): void;
77
81
  values(): Generator<any, void, unknown>;
78
82
  items(): Generator<any[], void, unknown>;
79
83
  keys(): Generator<any, void, unknown>;
80
84
  [Symbol.iterator](): MapIterator<any>;
85
+ #private;
86
+ }
87
+ export class RefSet {
88
+ constructor(parent?: null);
89
+ has(ref: any): boolean;
90
+ put(ref: any): void;
91
+ remove(ref: any): void;
92
+ clear(): void;
93
+ [Symbol.iterator](): SetIterator<any>;
94
+ #private;
81
95
  }
@@ -0,0 +1 @@
1
+ export function saslPrep(str: any): string;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Helpers for PDF sound objects (ISO 32000-1, 12.5.6.16).
3
+ *
4
+ * Sound streams contain samples described by /R, /C, /B, /E, and optional /CO.
5
+ * We wrap supported uncompressed PCM (Raw/Signed, 8/16-bit, mono/stereo) in WAV
6
+ * for playback.
7
+ * @import { BaseStream } from "./base_stream.js";
8
+ * @import { Dict } from "./primitives.js";
9
+ */
10
+ /**
11
+ * Return a supported uncompressed sample format.
12
+ * @param {Dict} [dict] The sound object's stream dictionary.
13
+ * @returns {{
14
+ * channels: number,
15
+ * sampleRate: number,
16
+ * bitsPerSample: number,
17
+ * encoding: string,
18
+ * } | null}
19
+ */
20
+ export function getSoundFormat(dict?: Dict): {
21
+ channels: number;
22
+ sampleRate: number;
23
+ bitsPerSample: number;
24
+ encoding: string;
25
+ } | null;
26
+ /**
27
+ * Build a WAV file from supported PDF sound samples.
28
+ *
29
+ * PDF 16-bit samples are big-endian; WAV uses little-endian, unsigned 8-bit
30
+ * samples, and signed 16-bit samples. The data chunk is trimmed to a whole
31
+ * number of frames (a multiple of the block alignment); a stream with no
32
+ * complete frame produces no WAV.
33
+ * @param {BaseStream} stream The sound object stream.
34
+ * @param {Uint8Array} samples Raw sample bytes from the stream.
35
+ * @returns {Uint8Array | null}
36
+ */
37
+ export function soundStreamToWav(stream: BaseStream, samples: Uint8Array): Uint8Array | null;
38
+ import type { Dict } from "./primitives.js";
39
+ import type { BaseStream } from "./base_stream.js";
@@ -1,5 +1,5 @@
1
1
  export function isAscii(str: any): boolean;
2
2
  export function stringToAsciiOrUTF16BE(str: any): any;
3
- export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string;
3
+ export function stringToPDFString(str: any, keepEscapeSequence?: boolean): any;
4
4
  export function stringToUTF16HexString(str: any): string;
5
5
  export function stringToUTF16String(str: any, bigEndian?: boolean): string;