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,132 @@
1
+ /**
2
+ * Combines multiple ArrayBuffers into a single Uint8Array.
3
+ * @param {Array<ArrayBuffer>} arr - An array of ArrayBuffers.
4
+ * @returns {Uint8Array}
5
+ */
6
+ export function arrayBuffersToBytes(arr: Array<ArrayBuffer>): Uint8Array;
7
+ export function codePointIter(str: any): Generator<any, void, unknown>;
8
+ export function collectActions(xref: any, dict: any, eventType: any): any;
9
+ export function deepCompare(a: any, b: any): boolean;
10
+ export function encodeToXmlString(str: any): any;
11
+ export function escapePDFName(str: any): any;
12
+ export function escapeString(str: any): any;
13
+ export function fetchBinaryData(url: any): Promise<Uint8Array<ArrayBuffer>>;
14
+ /**
15
+ * Get the value of an inheritable property.
16
+ *
17
+ * If the PDF specification explicitly lists a property in a dictionary as
18
+ * inheritable, then the value of the property may be present in the dictionary
19
+ * itself or in one or more parents of the dictionary.
20
+ *
21
+ * If the key is not found in the tree, `undefined` is returned. Otherwise,
22
+ * the value for the key is returned or, if `stopWhenFound` is `false`, a list
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`.
33
+ */
34
+ export function getInheritableProperty({ dict, key, getArray, stopWhenFound, }: Dict): any;
35
+ export function getLookupTableFactory(initializer: any): () => any;
36
+ export function getModificationDate(date?: Date): string;
37
+ export function getNewAnnotationsMap(annotationStorage: any): Map<any, any> | null;
38
+ /**
39
+ * Get the parent dictionary to update when a property is set.
40
+ *
41
+ * @param {Dict} dict - Dictionary from where to start the traversal.
42
+ * @param {Ref} ref - The reference to the dictionary.
43
+ * @param {XRef} xref - The `XRef` instance.
44
+ */
45
+ export function getParentToUpdate(dict: Dict, ref: Ref, xref: XRef): {
46
+ dict: null;
47
+ ref: null;
48
+ };
49
+ export function getRotationMatrix(rotation: any, width: any, height: any): any[];
50
+ /**
51
+ * Get the number of bytes to use to represent the given positive integer.
52
+ * If n is zero, the function returns 0 which means that we don't need to waste
53
+ * a byte to represent it.
54
+ * @param {number} x - a positive integer.
55
+ * @returns {number}
56
+ */
57
+ export function getSizeInBytes(x: number): number;
58
+ export const IDENTITY_MATRIX: number[];
59
+ /**
60
+ * Checks if something is an Array containing only boolean values,
61
+ * and (optionally) checks its length.
62
+ * @param {any} arr
63
+ * @param {number | null} len
64
+ * @returns {boolean}
65
+ */
66
+ export function isBooleanArray(arr: any, len: number | null): boolean;
67
+ /**
68
+ * Checks if something is an Array containing only numbers,
69
+ * and (optionally) checks its length.
70
+ * @param {any} arr
71
+ * @param {number | null} len
72
+ * @returns {boolean}
73
+ */
74
+ export function isNumberArray(arr: any, len: number | null): boolean;
75
+ export function isWhiteSpace(ch: any): boolean;
76
+ export function lookupMatrix(arr: any, fallback: any): any;
77
+ export function lookupNormalRect(arr: any, fallback: any): any;
78
+ export function lookupRect(arr: any, fallback: any): any;
79
+ export const MAX_INT_32: number;
80
+ declare const MissingDataException_base: any;
81
+ export class MissingDataException extends MissingDataException_base {
82
+ [x: string]: any;
83
+ constructor(begin: any, end: any);
84
+ begin: any;
85
+ end: any;
86
+ }
87
+ export function numberToString(value: any): any;
88
+ declare const ParserEOFException_base: any;
89
+ export class ParserEOFException extends ParserEOFException_base {
90
+ [x: string]: any;
91
+ constructor(msg: any);
92
+ }
93
+ /**
94
+ * AcroForm field names use an array like notation to refer to
95
+ * repeated XFA elements e.g. foo.bar[nnn].
96
+ * see: XFA Spec Chapter 3 - Repeated Elements
97
+ *
98
+ * @param {string} path - XFA path name.
99
+ * @returns {Array} - Array of Objects with the name and pos of
100
+ * each part of the path.
101
+ */
102
+ export function parseXFAPath(path: string): any[];
103
+ export const PDF_VERSION_REGEXP: RegExp;
104
+ export function recoverJsURL(str: any): {
105
+ url: string;
106
+ newWindow: boolean;
107
+ } | null;
108
+ export const RESOURCES_KEYS_OPERATOR_LIST: string[];
109
+ export const RESOURCES_KEYS_TEXT_CONTENT: string[];
110
+ /**
111
+ * Converts positive integers to (upper case) Roman numerals.
112
+ * @param {number} number - The number that should be converted.
113
+ * @param {boolean} lowerCase - Indicates if the result should be converted
114
+ * to lower case letters. The default value is `false`.
115
+ * @returns {string} The resulting Roman number.
116
+ */
117
+ export function toRomanNumerals(number: number, lowerCase?: boolean): string;
118
+ export function validateCSSFont(cssFontInfo: any): boolean;
119
+ export function validateFontName(fontFamily: any, mustWarn?: boolean): boolean;
120
+ declare const XRefEntryException_base: any;
121
+ export class XRefEntryException extends XRefEntryException_base {
122
+ [x: string]: any;
123
+ constructor(msg: any);
124
+ }
125
+ declare const XRefParseException_base: any;
126
+ export class XRefParseException extends XRefParseException_base {
127
+ [x: string]: any;
128
+ constructor(msg: any);
129
+ }
130
+ import { Dict } from "./primitives.js";
131
+ import { Ref } from "./primitives.js";
132
+ export {};
@@ -0,0 +1,136 @@
1
+ export type CipherConstructors = typeof AES128Cipher | typeof AES256Cipher | typeof ARCFourCipher | typeof NullCipher;
2
+ /**
3
+ * Find the appropriate cipher class based on the filter name.
4
+ */
5
+ export type ResolveCipher = (filterName?: Name | null | undefined) => CipherConstructors;
6
+ export class AES128Cipher extends AESBaseCipher {
7
+ constructor(key: any);
8
+ _rcon: Uint8Array<ArrayBuffer>;
9
+ _cyclesOfRepetition: number;
10
+ _keySize: number;
11
+ _key: Uint8Array<ArrayBuffer>;
12
+ _expandKey(cipherKey: any): Uint8Array<ArrayBuffer>;
13
+ }
14
+ export class AES256Cipher extends AESBaseCipher {
15
+ constructor(key: any);
16
+ _cyclesOfRepetition: number;
17
+ _keySize: number;
18
+ _key: Uint8Array<ArrayBuffer>;
19
+ _expandKey(cipherKey: any): Uint8Array<ArrayBuffer>;
20
+ }
21
+ /**
22
+ * @typedef {typeof AES128Cipher | typeof AES256Cipher | typeof ARCFourCipher
23
+ * | typeof NullCipher} CipherConstructors
24
+ */
25
+ /**
26
+ * @callback ResolveCipher
27
+ * Find the appropriate cipher class based on the filter name.
28
+ * @param {Name | null} [filterName]
29
+ * Name.
30
+ * @returns {CipherConstructors}
31
+ * Cipher constructor.
32
+ */
33
+ export class ARCFourCipher {
34
+ constructor(key: any);
35
+ a: number;
36
+ b: number;
37
+ s: Uint8Array<ArrayBuffer>;
38
+ encryptBlock(data: any): Uint8Array<any>;
39
+ decryptBlock(data: any): Uint8Array<any>;
40
+ encrypt(data: any): Uint8Array<any>;
41
+ }
42
+ export class CipherTransform {
43
+ /**
44
+ * @param {ResolveCipher} resolveCipher
45
+ * Resolve a cipher constructor from a crypt filter name.
46
+ * @param {Name | null} [stringFilterName]
47
+ * Default crypt filter for strings.
48
+ * @param {Name | null} [streamFilterName]
49
+ * Default crypt filter for streams.
50
+ */
51
+ constructor(resolveCipher: ResolveCipher, stringFilterName?: Name | null, streamFilterName?: Name | null);
52
+ /** @type {Name | null} */
53
+ embeddedFilterName: Name | null;
54
+ resolveCipher: ResolveCipher;
55
+ streamFilterName: Name | null;
56
+ stringFilterName: Name | null;
57
+ /**
58
+ * @param {BaseStream} stream
59
+ * @param {number | null} length
60
+ * @param {Name | null} [cryptFilterName]
61
+ * @returns {DecryptStream}
62
+ */
63
+ createStream(stream: BaseStream, length: number | null, cryptFilterName?: Name | null): DecryptStream;
64
+ decryptString(s: any): string;
65
+ encryptString(s: any): string;
66
+ #private;
67
+ }
68
+ export class CipherTransformFactory {
69
+ static get _defaultPasswordBytes(): any;
70
+ constructor(dict: any, fileId: any, password: any);
71
+ filterName: any;
72
+ dict: any;
73
+ algorithm: any;
74
+ cf: any;
75
+ stmf: any;
76
+ strf: any;
77
+ eff: any;
78
+ encryptMetadata: boolean;
79
+ encryptionKey: any;
80
+ /**
81
+ * Set password.
82
+ *
83
+ * @param {string} password
84
+ * New password.
85
+ * @returns {undefined}
86
+ * Nothing.
87
+ */
88
+ setPassword(password: string): undefined;
89
+ /**
90
+ * @param {number} num
91
+ * Object number.
92
+ * @param {number} gen
93
+ * Generation number.
94
+ * @returns {CipherTransform}
95
+ * Cipher transform.
96
+ */
97
+ createCipherTransform(num: number, gen: number): CipherTransform;
98
+ #private;
99
+ }
100
+ export class PDF17 extends PDFBase {
101
+ _hash(password: any, input: any, userBytes: any): Uint8Array<ArrayBuffer>;
102
+ }
103
+ export class PDF20 extends PDFBase {
104
+ _hash(password: any, input: any, userBytes: any): Uint8Array<ArrayBuffer>;
105
+ }
106
+ declare class NullCipher {
107
+ decryptBlock(data: any): any;
108
+ encrypt(data: any): any;
109
+ }
110
+ import { Name } from "./primitives.js";
111
+ declare class AESBaseCipher {
112
+ _s: Uint8Array<ArrayBuffer>;
113
+ _inv_s: Uint8Array<ArrayBuffer>;
114
+ _mix: Uint32Array<ArrayBuffer>;
115
+ _mixCol: Uint8Array<ArrayBuffer>;
116
+ buffer: Uint8Array<ArrayBuffer>;
117
+ bufferPosition: number;
118
+ _expandKey(cipherKey: any): void;
119
+ _decrypt(input: any, key: any): Uint8Array<ArrayBuffer>;
120
+ _encrypt(input: any, key: any): Uint8Array<ArrayBuffer>;
121
+ _decryptBlock2(data: any, finalize: any): Uint8Array<ArrayBuffer>;
122
+ bufferLength: number | undefined;
123
+ iv: any;
124
+ decryptBlock(data: any, finalize: any, iv?: null): any;
125
+ encrypt(data: any, iv: any): Uint8Array<ArrayBuffer>;
126
+ }
127
+ import type { BaseStream } from "./base_stream.js";
128
+ import { DecryptStream } from "./decrypt_stream.js";
129
+ declare class PDFBase {
130
+ _hash(password: any, input: any, userBytes: any): void;
131
+ checkOwnerPassword(password: any, ownerValidationSalt: any, userBytes: any, ownerPassword: any): boolean;
132
+ checkUserPassword(password: any, userValidationSalt: any, userPassword: any): boolean;
133
+ getOwnerKey(password: any, ownerKeySalt: any, userBytes: any, ownerEncryption: any): any;
134
+ getUserKey(password: any, userKeySalt: any, userEncryption: any): any;
135
+ }
136
+ export {};
@@ -0,0 +1,32 @@
1
+ export class DecodeStream extends BaseStream {
2
+ constructor(maybeMinBufferLength: any);
3
+ buffer: Uint8Array<ArrayBuffer>;
4
+ bufferLength: number;
5
+ eof: boolean;
6
+ minBufferLength: number;
7
+ pos: number;
8
+ _rawMinBufferLength: any;
9
+ readBlock(): void;
10
+ ensureBuffer(requested: any): Uint8Array<ArrayBuffer>;
11
+ getByte(): number;
12
+ getBytes(length: any, decoderOptions?: null): Uint8Array<ArrayBuffer>;
13
+ getImageData(length: any, decoderOptions: any): Promise<any>;
14
+ asyncGetBytesFromDecompressionStream(name: any): Promise<{
15
+ decompressed: Uint8Array<ArrayBuffer>;
16
+ compressed: any;
17
+ } | {
18
+ decompressed: null;
19
+ compressed: any;
20
+ }>;
21
+ makeSubStream(start: any, length: any, dict?: null): Stream;
22
+ clone(): Stream;
23
+ getBaseStreams(): any;
24
+ }
25
+ export class StreamsSequenceStream extends DecodeStream {
26
+ constructor(streams: any, onError?: null);
27
+ streams: any;
28
+ _onError: any;
29
+ getBaseStreams(): any[] | null;
30
+ }
31
+ import { BaseStream } from "./base_stream.js";
32
+ import { Stream } from "./stream.js";
@@ -0,0 +1,9 @@
1
+ export class DecryptStream extends DecodeStream {
2
+ constructor(str: any, maybeLength: any, decrypt: any);
3
+ stream: any;
4
+ dict: any;
5
+ decrypt: any;
6
+ getOriginalStream(): this;
7
+ #private;
8
+ }
9
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @import { CatalogAttachmentContent } from "./catalog.js";
3
+ */
4
+ /**
5
+ * "A PDF file can refer to the contents of another file by using a File
6
+ * Specification (PDF 1.1)", see the spec (7.11) for more details.
7
+ * NOTE: Only embedded files are supported (as part of the attachments support)
8
+ * TODO: support the 'URL' file system (with caching if !/V), portable
9
+ * collections attributes and related files (/RF)
10
+ */
11
+ export class FileSpec {
12
+ /**
13
+ * Get a platform-specific item from a file-spec dictionary.
14
+ *
15
+ * Search order follows the PDF platform keys: `UF`, `F`, `Unix`, `Mac`,
16
+ * `DOS`.
17
+ *
18
+ * @param {Dict | null | undefined} dict
19
+ * Dictionary.
20
+ * @param {boolean} [raw]
21
+ * Return the raw (possibly indirect) value rather than the resolved one.
22
+ * @returns {unknown}
23
+ * Matching dictionary value or `null` when no key is found.
24
+ */
25
+ static pickPlatformItem(dict: Dict | null | undefined, raw?: boolean): unknown;
26
+ /**
27
+ * Whether a file specification carries an embedded file we can read.
28
+ *
29
+ * @param {Dict} fileSpecDict
30
+ * @returns {boolean}
31
+ */
32
+ static hasEmbeddedFile(fileSpecDict: Dict): boolean;
33
+ /**
34
+ * Read attachment bytes from a file-spec dictionary.
35
+ *
36
+ * @param {Dict | null | undefined} dict
37
+ * File-spec dictionary containing an `EF` entry.
38
+ * @returns {CatalogAttachmentContent}
39
+ * Attachment bytes when available; otherwise `null`.
40
+ * @throws {PasswordException}
41
+ * When attachment bytes are encrypted and no key is available.
42
+ */
43
+ static readContent(dict: Dict | null | undefined): CatalogAttachmentContent;
44
+ /**
45
+ * Read the bytes of an embedded-file stream.
46
+ *
47
+ * @param {BaseStream} stream
48
+ * Embedded-file stream.
49
+ * @returns {CatalogAttachmentContent}
50
+ * Attachment bytes.
51
+ * @throws {PasswordException}
52
+ * When the bytes are encrypted and no key is available.
53
+ */
54
+ static readStreamContent(stream: BaseStream): CatalogAttachmentContent;
55
+ /**
56
+ * @param {Dict | null | undefined} root
57
+ * File specification dictionary.
58
+ */
59
+ constructor(root: Dict | null | undefined);
60
+ root: Dict | undefined;
61
+ fs: any;
62
+ get filename(): string;
63
+ get description(): string;
64
+ get serializable(): {
65
+ rawFilename: string;
66
+ filename: any;
67
+ description: string;
68
+ };
69
+ }
70
+ import { Dict } from "./primitives.js";
71
+ import type { CatalogAttachmentContent } from "./catalog.js";
72
+ import { BaseStream } from "./base_stream.js";
@@ -0,0 +1,14 @@
1
+ export class FlateStream extends DecodeStream {
2
+ constructor(str: any, maybeLength: any);
3
+ stream: any;
4
+ dict: any;
5
+ codeSize: number;
6
+ codeBuf: number;
7
+ getImageData(length: any, _decoderOptions: any): Promise<Uint8Array<ArrayBuffer>>;
8
+ asyncGetBytes(): Promise<Uint8Array<ArrayBuffer> | null>;
9
+ getBits(bits: any): number;
10
+ getCode(table: any): number;
11
+ generateHuffmanTable(lengths: any): (number | Int32Array<ArrayBuffer>)[];
12
+ #private;
13
+ }
14
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,22 @@
1
+ export class CmykICCBasedCS extends IccColorSpace {
2
+ static #iccUrl: any;
3
+ static setOptions({ iccUrl }: {
4
+ iccUrl: any;
5
+ }): void;
6
+ constructor();
7
+ }
8
+ export class IccColorSpace extends ColorSpace {
9
+ static #useWasm: boolean;
10
+ static #wasmUrl: null;
11
+ static #finalizer: null;
12
+ static setOptions({ useWasm, useWorkerFetch, wasmUrl }: {
13
+ useWasm: any;
14
+ useWorkerFetch: any;
15
+ wasmUrl: any;
16
+ }): void;
17
+ static get isUsable(): any;
18
+ constructor(iccProfile: any, name: any, numComps: any);
19
+ getOutputLength(inputLength: any, alpha01: any): number;
20
+ #private;
21
+ }
22
+ import { ColorSpace } from "./colorspace.js";
@@ -0,0 +1,52 @@
1
+ export class GlobalColorSpaceCache extends BaseLocalCache {
2
+ set(name: null | undefined, ref: any, data: any): void;
3
+ clear(): void;
4
+ }
5
+ export class GlobalImageCache {
6
+ static NUM_PAGES_THRESHOLD: number;
7
+ static MIN_IMAGES_TO_CACHE: number;
8
+ static MAX_BYTE_SIZE: number;
9
+ _refCache: RefSetCache;
10
+ _imageCache: RefSetCache;
11
+ shouldCache(ref: any, pageIndex: any): boolean;
12
+ addDecodeFailed(ref: any): void;
13
+ hasDecodeFailed(ref: any): boolean;
14
+ /**
15
+ * PLEASE NOTE: Must be called *after* the `setData` method.
16
+ */
17
+ addByteSize(ref: any, byteSize: any): void;
18
+ getData(ref: any, pageIndex: any): any;
19
+ setData(ref: any, data: any): void;
20
+ clear(onlyData?: boolean): void;
21
+ #private;
22
+ }
23
+ export class LocalColorSpaceCache extends BaseLocalCache {
24
+ set(name: null | undefined, ref: null | undefined, data: any): void;
25
+ }
26
+ export class LocalFunctionCache extends BaseLocalCache {
27
+ set(name: null | undefined, ref: any, data: any): void;
28
+ }
29
+ export class LocalGStateCache extends BaseLocalCache {
30
+ set(name: any, ref: null | undefined, data: any): void;
31
+ }
32
+ export class LocalImageCache extends BaseLocalCache {
33
+ set(name: any, ref: null | undefined, data: any): void;
34
+ }
35
+ export class LocalTilingPatternCache extends BaseLocalCache {
36
+ set(name: null | undefined, ref: any, data: any): void;
37
+ }
38
+ export class RegionalImageCache extends BaseLocalCache {
39
+ set(name: null | undefined, ref: any, data: any): void;
40
+ }
41
+ declare class BaseLocalCache {
42
+ constructor(options: any);
43
+ _onlyRefs: boolean;
44
+ _nameRefMap: Map<any, any> | undefined;
45
+ _imageMap: Map<any, any> | undefined;
46
+ _imageCache: RefSetCache;
47
+ getByName(name: any): any;
48
+ getByRef(ref: any): any;
49
+ set(name: any, ref: any, data: any): void;
50
+ }
51
+ import { RefSetCache } from "./primitives.js";
52
+ export {};
@@ -0,0 +1,13 @@
1
+ export class JBig2CCITTFaxImage extends WasmImage {
2
+ static get instance(): any;
3
+ _filename: string;
4
+ _noWasmFilename: string;
5
+ decode(bytes: any, width: any, height: any, globals: any, CCITTOptions: any): Promise<never>;
6
+ }
7
+ declare const Jbig2Error_base: any;
8
+ export class Jbig2Error extends Jbig2Error_base {
9
+ [x: string]: any;
10
+ constructor(msg: any);
11
+ }
12
+ import { WasmImage } from "./wasm_image.js";
13
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * For JBIG2's we use a library to decode these images and
3
+ * the stream behaves like all the other DecodeStreams.
4
+ */
5
+ export class Jbig2Stream extends DecodeStream {
6
+ static stripFileHeader(bytes: any): any;
7
+ constructor(stream: any, maybeLength: any, params: any);
8
+ stream: any;
9
+ dict: any;
10
+ maybeLength: any;
11
+ params: any;
12
+ get bytes(): any;
13
+ ensureBuffer(requested: any): void;
14
+ decodeImage(bytes: any, length: any, _decoderOptions: any): Promise<Uint8Array<ArrayBuffer>>;
15
+ get canAsyncDecodeImageFromBuffer(): any;
16
+ }
17
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * For JPEG's we use a library to decode these images and the stream behaves
3
+ * like all the other DecodeStreams.
4
+ */
5
+ export class JpegStream extends DecodeStream {
6
+ static #isImageDecoderSupported: any;
7
+ static get canUseImageDecoder(): any;
8
+ static setOptions({ isImageDecoderSupported }: {
9
+ isImageDecoderSupported?: boolean | undefined;
10
+ }): void;
11
+ constructor(stream: any, maybeLength: any, params: any);
12
+ stream: any;
13
+ dict: any;
14
+ maybeLength: any;
15
+ params: any;
16
+ get bytes(): any;
17
+ ensureBuffer(requested: any): void;
18
+ get jpegOptions(): any;
19
+ decodeImage(bytes: any): Uint8Array<ArrayBuffer>;
20
+ get canAsyncDecodeImageFromBuffer(): any;
21
+ getTransferableImage(): Promise<VideoFrame | null>;
22
+ #private;
23
+ }
24
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,62 @@
1
+ declare const JpegError_base: any;
2
+ export class JpegError extends JpegError_base {
3
+ [x: string]: any;
4
+ constructor(msg: any);
5
+ }
6
+ export class JpegImage {
7
+ static canUseImageDecoder(data: any, colorTransform?: number): {
8
+ exifStart: any;
9
+ exifEnd: any;
10
+ } | {
11
+ exifStart?: undefined;
12
+ exifEnd?: undefined;
13
+ } | null;
14
+ constructor({ decodeTransform, colorTransform }?: {
15
+ decodeTransform?: null | undefined;
16
+ colorTransform?: number | undefined;
17
+ });
18
+ _decodeTransform: any;
19
+ _colorTransform: number;
20
+ parse(data: any, { dnlScanLines }?: {
21
+ dnlScanLines?: null | undefined;
22
+ }): any;
23
+ width: any;
24
+ height: any;
25
+ jfif: {
26
+ version: {
27
+ major: any;
28
+ minor: any;
29
+ };
30
+ densityUnits: any;
31
+ xDensity: number;
32
+ yDensity: number;
33
+ thumbWidth: any;
34
+ thumbHeight: any;
35
+ thumbData: any;
36
+ } | null | undefined;
37
+ adobe: {
38
+ version: number;
39
+ flags0: number;
40
+ flags1: number;
41
+ transformCode: any;
42
+ } | null | undefined;
43
+ components: any[] | undefined;
44
+ numComponents: number | undefined;
45
+ get _isColorConversionNeeded(): boolean;
46
+ _convertYccToRgb(data: any): any;
47
+ _convertYccToRgba(data: any, out: any): any;
48
+ _convertYcckToRgb(data: any): any;
49
+ _convertYcckToRgba(data: any): any;
50
+ _convertYcckToCmyk(data: any): any;
51
+ _convertCmykToRgb(data: any): any;
52
+ _convertCmykToRgba(data: any): any;
53
+ getData({ width, height, forceRGBA, forceRGB, isSourcePDF, }: {
54
+ width: any;
55
+ height: any;
56
+ forceRGBA?: boolean | undefined;
57
+ forceRGB?: boolean | undefined;
58
+ isSourcePDF?: boolean | undefined;
59
+ }): any;
60
+ #private;
61
+ }
62
+ export {};
@@ -0,0 +1,24 @@
1
+ declare const JpxError_base: any;
2
+ export class JpxError extends JpxError_base {
3
+ [x: string]: any;
4
+ constructor(msg: any);
5
+ }
6
+ export class JpxImage extends WasmImage {
7
+ static get instance(): any;
8
+ static parseImageProperties(stream: any): {
9
+ width: number;
10
+ height: number;
11
+ bitsPerComponent: number;
12
+ componentsCount: any;
13
+ };
14
+ _filename: string;
15
+ _noWasmFilename: string;
16
+ decode(bytes: any, { numComponents, isIndexedColormap, smaskInData, reducePower, }?: {
17
+ numComponents?: number | undefined;
18
+ isIndexedColormap?: boolean | undefined;
19
+ smaskInData?: boolean | undefined;
20
+ reducePower?: number | undefined;
21
+ }): Promise<never>;
22
+ }
23
+ import { WasmImage } from "./wasm_image.js";
24
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * For JPEG 2000's we use a library to decode these images and
3
+ * the stream behaves like all the other DecodeStreams.
4
+ */
5
+ export class JpxStream extends DecodeStream {
6
+ constructor(stream: any, maybeLength: any);
7
+ stream: any;
8
+ dict: any;
9
+ maybeLength: any;
10
+ get bytes(): any;
11
+ ensureBuffer(requested: any): void;
12
+ decodeImage(bytes: any, _length: any, decoderOptions: any): Promise<Uint8Array<ArrayBuffer>>;
13
+ get canAsyncDecodeImageFromBuffer(): any;
14
+ }
15
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,19 @@
1
+ export class LZWStream extends DecodeStream {
2
+ constructor(str: any, maybeLength: any, earlyChange: any);
3
+ stream: any;
4
+ dict: any;
5
+ cachedData: number;
6
+ bitsCached: number;
7
+ lzwState: {
8
+ earlyChange: any;
9
+ codeLength: number;
10
+ nextCode: number;
11
+ dictionaryValues: Uint8Array<ArrayBuffer>;
12
+ dictionaryLengths: Uint16Array<ArrayBuffer>;
13
+ dictionaryPrevCodes: Uint16Array<ArrayBuffer>;
14
+ currentSequence: Uint8Array<ArrayBuffer>;
15
+ currentSequenceLength: number;
16
+ };
17
+ readBits(n: any): number | null;
18
+ }
19
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,13 @@
1
+ export class MetadataParser {
2
+ constructor(data: any);
3
+ _metadataMap: Map<any, any>;
4
+ _data: any;
5
+ _repair(data: any): any;
6
+ _getSequence(entry: any): any;
7
+ _parseArray(entry: any): void;
8
+ _parse(xmlDocument: any): void;
9
+ get serializable(): {
10
+ parsedData: Map<any, any>;
11
+ rawData: any;
12
+ };
13
+ }