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,21 @@
1
+ export class NameTree extends NameOrNumberTree {
2
+ constructor(root: any, xref: any);
3
+ }
4
+ export class NumberTree extends NameOrNumberTree {
5
+ constructor(root: any, xref: any);
6
+ }
7
+ /**
8
+ * A NameTree/NumberTree is like a Dict but has some advantageous properties,
9
+ * see the specification (7.9.6 and 7.9.7) for additional details.
10
+ * TODO: implement all the Dict functions and make this more efficient.
11
+ */
12
+ declare class NameOrNumberTree {
13
+ constructor(root: any, xref: any, type: any);
14
+ root: any;
15
+ xref: any;
16
+ _type: any;
17
+ getAll(isRaw?: boolean): Map<any, any>;
18
+ getRaw(key: any): any;
19
+ get(key: any): any;
20
+ }
21
+ export {};
@@ -0,0 +1,121 @@
1
+ export type Streams = Ascii85Stream | AsciiHexStream | BaseStream | BrotliStream | CCITTFaxStream | FlateStream | Jbig2Stream | JpegStream | JpxStream | LZWStream | NullStream | PredictorStream | RunLengthStream;
2
+ export class Lexer {
3
+ constructor(stream: any, knownCommands?: null);
4
+ stream: any;
5
+ strBuf: any[];
6
+ knownCommands: any;
7
+ _hexStringNumWarn: number;
8
+ beginInlineImagePos: number;
9
+ nextChar(): any;
10
+ currentChar: any;
11
+ peekChar(): any;
12
+ getNumber(): number;
13
+ getString(): string;
14
+ getName(): any;
15
+ /**
16
+ * @private
17
+ */
18
+ private _hexStringWarn;
19
+ getHexString(): string;
20
+ getObj(): any;
21
+ skipToNextLine(): void;
22
+ }
23
+ export class Linearization {
24
+ static create(stream: any): {
25
+ length: any;
26
+ hints: any[];
27
+ objectNumberFirst: any;
28
+ endFirst: any;
29
+ numPages: any;
30
+ mainXRefEntriesOffset: any;
31
+ pageFirst: any;
32
+ } | null;
33
+ }
34
+ export class Parser {
35
+ constructor({ lexer, xref, allowStreams, recoveryMode }: {
36
+ lexer: any;
37
+ xref: any;
38
+ allowStreams?: boolean | undefined;
39
+ recoveryMode?: boolean | undefined;
40
+ });
41
+ lexer: any;
42
+ xref: any;
43
+ allowStreams: boolean;
44
+ recoveryMode: boolean;
45
+ imageCache: any;
46
+ _imageId: number;
47
+ refill(): void;
48
+ buf1: any;
49
+ buf2: any;
50
+ shift(): void;
51
+ tryShift(): boolean;
52
+ /**
53
+ * @param {CipherTransform | null} cipherTransform
54
+ * Cipher transform for decryption.
55
+ * @returns {unknown}
56
+ */
57
+ getObj(cipherTransform?: CipherTransform | null): unknown;
58
+ /**
59
+ * Find the end of the stream by searching for the /EI\s/.
60
+ * @returns {number} The inline stream length.
61
+ */
62
+ findDefaultInlineStreamEnd(stream: any): number;
63
+ /**
64
+ * Find the EOI (end-of-image) marker 0xFFD9 of the stream.
65
+ * @returns {number} The inline stream length.
66
+ */
67
+ findDCTDecodeInlineStreamEnd(stream: any): number;
68
+ /**
69
+ * Find the EOD (end-of-data) marker '~>' (i.e. TILDE + GT) of the stream.
70
+ * @returns {number} The inline stream length.
71
+ */
72
+ findASCII85DecodeInlineStreamEnd(stream: any): number;
73
+ /**
74
+ * Find the EOD (end-of-data) marker '>' (i.e. GT) of the stream.
75
+ * @returns {number} The inline stream length.
76
+ */
77
+ findASCIIHexDecodeInlineStreamEnd(stream: any): number;
78
+ /**
79
+ * Skip over the /EI/ for streams where we search for an EOD marker.
80
+ */
81
+ inlineStreamSkipEI(stream: any): void;
82
+ /**
83
+ * @param {CipherTransform | null} cipherTransform
84
+ * @returns {Streams}
85
+ */
86
+ makeInlineImage(cipherTransform: CipherTransform | null): Streams;
87
+ makeStream(dict: any, cipherTransform: any): any;
88
+ /**
89
+ * @param {Streams} stream
90
+ * @param {Dict} dict
91
+ * @param {number | null} length
92
+ * @param {CipherTransform | null} cipherTransform
93
+ * @returns {Streams}
94
+ */
95
+ filter(stream: Streams, dict: Dict, length: number | null, cipherTransform?: CipherTransform | null): Streams;
96
+ /**
97
+ * @param {Streams} stream
98
+ * @param {string} name
99
+ * @param {number | null} maybeLength
100
+ * @param {Dict | null} params
101
+ * @param {CipherTransform | null | undefined} [cipherTransform]
102
+ * @returns {Streams}
103
+ */
104
+ makeFilter(stream: Streams, name: string, maybeLength: number | null, params: Dict | null, cipherTransform?: CipherTransform | null | undefined): Streams;
105
+ #private;
106
+ }
107
+ import { Ascii85Stream } from "./ascii_85_stream.js";
108
+ import { AsciiHexStream } from "./ascii_hex_stream.js";
109
+ import type { BaseStream } from "./base_stream.js";
110
+ import { BrotliStream } from "./brotli_stream.js";
111
+ import { CCITTFaxStream } from "./ccitt_stream.js";
112
+ import { FlateStream } from "./flate_stream.js";
113
+ import { Jbig2Stream } from "./jbig2_stream.js";
114
+ import { JpegStream } from "./jpeg_stream.js";
115
+ import { JpxStream } from "./jpx_stream.js";
116
+ import { LZWStream } from "./lzw_stream.js";
117
+ import { NullStream } from "./stream.js";
118
+ import { PredictorStream } from "./predictor_stream.js";
119
+ import { RunLengthStream } from "./run_length_stream.js";
120
+ import type { CipherTransform } from "./crypto.js";
121
+ import { Dict } from "./primitives.js";
@@ -0,0 +1,63 @@
1
+ export function clearPatternCaches(): void;
2
+ export function getTilingPatternIR(operatorList: any, dict: any, color: any, needsIsolation?: boolean): any[];
3
+ export class Pattern {
4
+ static #hasGPU: boolean;
5
+ static setOptions({ hasGPU }: {
6
+ hasGPU: any;
7
+ }): void;
8
+ static parseShading(shading: any, xref: any, res: any, pdfFunctionFactory: any, globalColorSpaceCache: any, localColorSpaceCache: any): FunctionBasedShading | RadialAxialShading | MeshShading | DummyShading;
9
+ }
10
+ declare class FunctionBasedShading extends BaseShading {
11
+ static MAX_STEP_COUNT: number;
12
+ constructor(dict: any, xref: any, resources: any, pdfFunctionFactory: any, globalColorSpaceCache: any, localColorSpaceCache: any);
13
+ bbox: any;
14
+ background: any;
15
+ bounds: number[];
16
+ coords: Float32Array<ArrayBuffer>;
17
+ colors: Uint8ClampedArray<ArrayBuffer>;
18
+ figures: {
19
+ type: number;
20
+ coords: Uint32Array<ArrayBuffer>;
21
+ colors: Uint32Array<ArrayBuffer>;
22
+ verticesPerRow: number;
23
+ }[];
24
+ getIR(): any[];
25
+ }
26
+ declare class RadialAxialShading extends BaseShading {
27
+ constructor(dict: any, xref: any, resources: any, pdfFunctionFactory: any, globalColorSpaceCache: any, localColorSpaceCache: any);
28
+ shadingType: any;
29
+ coordsArr: any;
30
+ bbox: any;
31
+ extendStart: boolean;
32
+ extendEnd: boolean;
33
+ colorStops: any[];
34
+ getIR(): any[];
35
+ }
36
+ declare class MeshShading extends BaseShading {
37
+ static MIN_SPLIT_PATCH_CHUNKS_AMOUNT: number;
38
+ static MAX_SPLIT_PATCH_CHUNKS_AMOUNT: number;
39
+ static TRIANGLE_DENSITY: number;
40
+ constructor(stream: any, xref: any, resources: any, pdfFunctionFactory: any, globalColorSpaceCache: any, localColorSpaceCache: any);
41
+ shadingType: any;
42
+ bbox: any;
43
+ background: any;
44
+ coords: any[];
45
+ colors: any[];
46
+ figures: any[];
47
+ _decodeType4Shading(reader: any): void;
48
+ _decodeType5Shading(reader: any, verticesPerRow: any): void;
49
+ _decodeType6Shading(reader: any): void;
50
+ _decodeType7Shading(reader: any): void;
51
+ _buildFigureFromPatch(index: any): void;
52
+ _updateBounds(): void;
53
+ _packData(): void;
54
+ getIR(): any[];
55
+ }
56
+ declare class DummyShading extends BaseShading {
57
+ getIR(): string[];
58
+ }
59
+ declare class BaseShading {
60
+ static SMALL_NUMBER: number;
61
+ getIR(): void;
62
+ }
63
+ export {};
@@ -0,0 +1,14 @@
1
+ export class PredictorStream extends DecodeStream {
2
+ constructor(str: any, maybeLength: any, params: any);
3
+ predictor: any;
4
+ stream: any;
5
+ dict: any;
6
+ colors: any;
7
+ bits: any;
8
+ columns: any;
9
+ pixBytes: number | undefined;
10
+ rowBytes: number | undefined;
11
+ readBlockTiff(): void;
12
+ readBlockPng(): void;
13
+ }
14
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,81 @@
1
+ export const CIRCULAR_REF: unique symbol;
2
+ export function clearPrimitiveCaches(): void;
3
+ export class Cmd {
4
+ static get(cmd: any): any;
5
+ constructor(cmd: any);
6
+ cmd: any;
7
+ }
8
+ export class Dict {
9
+ static get empty(): any;
10
+ static merge({ xref, dictArray, mergeSubDicts }: {
11
+ xref: any;
12
+ dictArray: any;
13
+ mergeSubDicts?: boolean | undefined;
14
+ }): any;
15
+ constructor(xref?: null);
16
+ __nonSerializable__: () => /*elided*/ any;
17
+ objId: null;
18
+ suppressEncryption: boolean;
19
+ xref: any;
20
+ assignXref(newXref: any): void;
21
+ 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;
25
+ getRaw(key: any): any;
26
+ getKeys(): MapIterator<any>;
27
+ getRawValues(): MapIterator<any>;
28
+ getRawEntries(): MapIterator<[any, any]>;
29
+ set(key: any, value: any): void;
30
+ setIfNotExists(key: any, value: any): void;
31
+ setIfNumber(key: any, value: any): void;
32
+ setIfArray(key: any, value: any): void;
33
+ setIfDefined(key: any, value: any): void;
34
+ setIfName(key: any, value: any): void;
35
+ setIfDict(key: any, value: any): void;
36
+ has(key: any): boolean;
37
+ clone(): Dict;
38
+ delete(key: any): void;
39
+ [Symbol.iterator](): Generator<any[], void, unknown>;
40
+ #private;
41
+ }
42
+ export const EOF: unique symbol;
43
+ export function isCmd(v: any, cmd: any): boolean;
44
+ export function isDict(v: any, type: any): boolean;
45
+ export function isName(v: any, name: any): boolean;
46
+ export function isRefsEqual(v1: any, v2: any): boolean;
47
+ export class Name {
48
+ static get(name: any): any;
49
+ constructor(name: any);
50
+ name: any;
51
+ }
52
+ export class Ref {
53
+ static fromString(str: any): any;
54
+ static get(num: any, gen: any): any;
55
+ constructor(num: any, gen: any);
56
+ num: any;
57
+ 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>;
68
+ }
69
+ export class RefSetCache {
70
+ _map: Map<any, any>;
71
+ get size(): number;
72
+ get(ref: any): any;
73
+ has(ref: any): boolean;
74
+ put(ref: any, obj: any): void;
75
+ putAlias(ref: any, aliasRef: any): void;
76
+ clear(): void;
77
+ values(): Generator<any, void, unknown>;
78
+ items(): Generator<any[], void, unknown>;
79
+ keys(): Generator<any, void, unknown>;
80
+ [Symbol.iterator](): MapIterator<any>;
81
+ }
@@ -0,0 +1,6 @@
1
+ export class RunLengthStream extends DecodeStream {
2
+ constructor(str: any, maybeLength: any);
3
+ stream: any;
4
+ dict: any;
5
+ }
6
+ import { DecodeStream } from "./decode_stream.js";
@@ -0,0 +1,20 @@
1
+ export class NullStream extends Stream {
2
+ constructor();
3
+ }
4
+ export class Stream extends BaseStream {
5
+ constructor(arrayBuffer: any, start: any, length: any, dict: any);
6
+ bytes: Uint8Array<any>;
7
+ start: any;
8
+ pos: any;
9
+ end: any;
10
+ dict: any;
11
+ getByte(): number;
12
+ getBytes(length: any): Uint8Array<any>;
13
+ getByteRange(begin: any, end: any): Uint8Array<any>;
14
+ makeSubStream(start: any, length: any, dict?: null): Stream;
15
+ clone(): Stream;
16
+ }
17
+ export class StringStream extends Stream {
18
+ constructor(str: any, dict?: null);
19
+ }
20
+ import { BaseStream } from "./base_stream.js";
@@ -0,0 +1,5 @@
1
+ export function isAscii(str: any): boolean;
2
+ export function stringToAsciiOrUTF16BE(str: any): any;
3
+ export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string;
4
+ export function stringToUTF16HexString(str: any): string;
5
+ export function stringToUTF16String(str: any, bigEndian?: boolean): string;
@@ -0,0 +1,93 @@
1
+ export class StructTreePage {
2
+ constructor(structTreeRoot: any, pageDict: any);
3
+ root: any;
4
+ xref: any;
5
+ rootDict: any;
6
+ pageDict: any;
7
+ nodes: any[];
8
+ /**
9
+ * Collect all the objects (i.e. tag) that are part of the page and return a
10
+ * map of the structure element id to the object reference.
11
+ * @param {Ref} pageRef
12
+ * @returns {Map<number, Ref>}
13
+ */
14
+ collectObjects(pageRef: Ref): Map<number, Ref>;
15
+ parse(pageRef: any): void;
16
+ addNode(dict: any, map: any, level?: number): any;
17
+ addTopLevelNode(dict: any, element: any): boolean;
18
+ /**
19
+ * Convert the tree structure into a simplified object literal that can
20
+ * be sent to the main thread.
21
+ * @returns {Object}
22
+ */
23
+ get serializable(): Object;
24
+ }
25
+ export class StructTreeRoot {
26
+ static canCreateStructureTree({ catalogRef, pdfManager, newAnnotationsByPage, }: {
27
+ catalogRef: any;
28
+ pdfManager: any;
29
+ newAnnotationsByPage: any;
30
+ }): Promise<boolean>;
31
+ static createStructureTree({ newAnnotationsByPage, xref, catalogRef, pdfManager, changes, }: {
32
+ newAnnotationsByPage: any;
33
+ xref: any;
34
+ catalogRef: any;
35
+ pdfManager: any;
36
+ changes: any;
37
+ }): Promise<void>;
38
+ static #writeKids({ newAnnotationsByPage, structTreeRootRef, structTreeRoot, kids, nums, xref, pdfManager, changes, cache, }: {
39
+ newAnnotationsByPage: any;
40
+ structTreeRootRef: any;
41
+ structTreeRoot: any;
42
+ kids: any;
43
+ nums: any;
44
+ xref: any;
45
+ pdfManager: any;
46
+ changes: any;
47
+ cache: any;
48
+ }): Promise<number>;
49
+ static #writeProperties(tagDict: any, { type, title, lang, alt, expanded, actualText }: {
50
+ type: any;
51
+ title: any;
52
+ lang: any;
53
+ alt: any;
54
+ expanded: any;
55
+ actualText: any;
56
+ }): void;
57
+ static #collectParents({ elements, xref, pageDict, numberTree }: {
58
+ elements: any;
59
+ xref: any;
60
+ pageDict: any;
61
+ numberTree: any;
62
+ }): void;
63
+ static #updateParentTag({ structTreeParent, tagDict, newTagRef, structTreeRootRef, fallbackKids, xref, cache, }: {
64
+ structTreeParent: any;
65
+ tagDict: any;
66
+ newTagRef: any;
67
+ structTreeRootRef: any;
68
+ fallbackKids: any;
69
+ xref: any;
70
+ cache: any;
71
+ }): Promise<void>;
72
+ constructor(xref: any, rootDict: any, rootRef: any);
73
+ kidRefToPosition: undefined;
74
+ parentTree: null;
75
+ roleMap: Map<any, any>;
76
+ structParentIds: null;
77
+ xref: any;
78
+ dict: any;
79
+ ref: Ref | null;
80
+ getKidPosition(kidRef: any): any;
81
+ addAnnotationIdToPage(pageRef: any, id: any): void;
82
+ canUpdateStructTree({ pdfManager, newAnnotationsByPage }: {
83
+ pdfManager: any;
84
+ newAnnotationsByPage: any;
85
+ }): Promise<boolean>;
86
+ updateStructureTree({ newAnnotationsByPage, pdfManager, changes }: {
87
+ newAnnotationsByPage: any;
88
+ pdfManager: any;
89
+ changes: any;
90
+ }): Promise<void>;
91
+ #private;
92
+ }
93
+ import { Ref } from "./primitives.js";
@@ -0,0 +1,5 @@
1
+ export function clearUnicodeCaches(): void;
2
+ export function getCharUnicodeCategory(char: any): any;
3
+ export function getUnicodeForGlyph(name: any, glyphsUnicodeMap: any): any;
4
+ export function getUnicodeRangeFor(value: any, lastPosition?: number): number;
5
+ export function mapSpecialUnicodeValues(code: any): any;
@@ -0,0 +1,21 @@
1
+ export class WasmImage {
2
+ static #handler: null;
3
+ static #instances: Set<any>;
4
+ static #useWasm: boolean;
5
+ static #useWorkerFetch: boolean;
6
+ static #wasmUrl: null;
7
+ static setOptions({ handler, useWasm, useWorkerFetch, wasmUrl }: {
8
+ handler: any;
9
+ useWasm: any;
10
+ useWorkerFetch: any;
11
+ wasmUrl: any;
12
+ }): void;
13
+ static get instance(): void;
14
+ static cleanup(): void;
15
+ constructor(trackInstance?: boolean);
16
+ _filename: null;
17
+ _noWasmFilename: null;
18
+ _getModule(ImageDecoder: any): null;
19
+ decode(bytes: any, _params: any): Promise<void>;
20
+ #private;
21
+ }
@@ -0,0 +1,79 @@
1
+ export class SimpleDOMNode {
2
+ constructor(nodeName: any, nodeValue: any);
3
+ nodeName: any;
4
+ nodeValue: any;
5
+ get firstChild(): any;
6
+ get nextSibling(): any;
7
+ get textContent(): any;
8
+ get children(): any;
9
+ hasChildNodes(): boolean;
10
+ /**
11
+ * Search a node in the tree with the given path
12
+ * foo.bar[nnn], i.e. find the nnn-th node named
13
+ * bar under a node named foo.
14
+ *
15
+ * @param {Array} paths - an array of objects as
16
+ * returned by {parseXFAPath}.
17
+ * @param {number} pos - the current position in
18
+ * the paths array.
19
+ * @returns {SimpleDOMNode} The node corresponding
20
+ * to the path or null if not found.
21
+ */
22
+ searchNode(paths: any[], pos: number): SimpleDOMNode;
23
+ dump(buffer: any): void;
24
+ }
25
+ export class SimpleXMLParser extends XMLParserBase {
26
+ constructor({ hasAttributes, lowerCaseName }: {
27
+ hasAttributes?: boolean | undefined;
28
+ lowerCaseName?: boolean | undefined;
29
+ });
30
+ _currentFragment: any;
31
+ _stack: any[] | null;
32
+ _errorCode: number;
33
+ _hasAttributes: boolean;
34
+ _lowerCaseName: boolean;
35
+ parseFromString(data: any): {
36
+ documentElement: any;
37
+ } | undefined;
38
+ onEndElement(name: any): any;
39
+ }
40
+ export class XMLParserBase {
41
+ static get _entityRegex(): any;
42
+ _resolveEntities(s: any): any;
43
+ _parseContent(s: any, start: any): {
44
+ name: any;
45
+ attributes: {
46
+ name: string;
47
+ value: any;
48
+ }[];
49
+ parsed: number;
50
+ } | null;
51
+ _parseProcessingInstruction(s: any, start: any): {
52
+ name: any;
53
+ value: any;
54
+ parsed: number;
55
+ };
56
+ parseXml(s: any): void;
57
+ onResolveEntity(name: any): string;
58
+ onPi(name: any, value: any): void;
59
+ onComment(text: any): void;
60
+ onCdata(text: any): void;
61
+ onDoctype(doctypeContent: any): void;
62
+ onText(text: any): void;
63
+ onBeginElement(name: any, attributes: any, isEmpty: any): void;
64
+ onEndElement(name: any): void;
65
+ onError(code: any): void;
66
+ }
67
+ export namespace XMLParserErrorCode {
68
+ let NoError: number;
69
+ let EndOfDocument: number;
70
+ let UnterminatedCdat: number;
71
+ let UnterminatedXmlDeclaration: number;
72
+ let UnterminatedDoctypeDeclaration: number;
73
+ let UnterminatedComment: number;
74
+ let MalformedElement: number;
75
+ let OutOfMemory: number;
76
+ let UnterminatedAttributeValue: number;
77
+ let UnterminatedElement: number;
78
+ let ElementNeverBegun: number;
79
+ }
@@ -0,0 +1,52 @@
1
+ export class XRef {
2
+ constructor(stream: any, pdfManager: any);
3
+ stream: any;
4
+ pdfManager: any;
5
+ entries: any[];
6
+ _xrefStms: Set<any>;
7
+ _cacheMap: Map<any, any>;
8
+ _pendingRefs: RefSet;
9
+ _newPersistentRefNum: number | null;
10
+ _newTemporaryRefNum: number | null;
11
+ _persistentRefsCache: Map<any, any> | null;
12
+ getNewPersistentRef(obj: any): any;
13
+ getNewTemporaryRef(): any;
14
+ resetNewTemporaryRef(): void;
15
+ setStartXRef(startXRef: any): void;
16
+ startXRefQueue: any[] | undefined;
17
+ parse(recoveryMode?: boolean): void;
18
+ trailer: any;
19
+ encrypt: CipherTransformFactory | undefined;
20
+ root: Dict | undefined;
21
+ processXRefTable(parser: any): Dict;
22
+ tableState: {
23
+ entryNum: number;
24
+ streamPos: any;
25
+ parserBuf1: any;
26
+ parserBuf2: any;
27
+ } | undefined;
28
+ readXRefTable(parser: any): any;
29
+ processXRefStream(stream: any): any;
30
+ streamState: {
31
+ entryRanges: any;
32
+ byteWidths: any;
33
+ entryNum: number;
34
+ streamPos: any;
35
+ } | undefined;
36
+ readXRefStream(stream: any): void;
37
+ indexObjects(): any;
38
+ _generationFallback: boolean | undefined;
39
+ readXRef(recoveryMode?: boolean): any;
40
+ topDict: any;
41
+ getEntry(i: any): any;
42
+ fetchIfRef(obj: any, suppressEncryption?: boolean): any;
43
+ fetch(ref: any, suppressEncryption?: boolean): any;
44
+ fetchUncompressed(ref: any, xrefEntry: any, suppressEncryption?: boolean): any;
45
+ fetchCompressed(ref: any, xrefEntry: any, suppressEncryption?: boolean): any;
46
+ fetchIfRefAsync(obj: any, suppressEncryption: any): Promise<any>;
47
+ fetchAsync(ref: any, suppressEncryption: any): any;
48
+ getCatalogObj(): Dict | undefined;
49
+ }
50
+ import { RefSet } from "./primitives.js";
51
+ import { CipherTransformFactory } from "./crypto.js";
52
+ import { Dict } from "./primitives.js";
@@ -1,5 +1,6 @@
1
- export type PDFPageProxy = import("./api").PDFPageProxy;
2
- export type PageViewport = import("./display_utils").PageViewport;
1
+ export type PDFPageProxy = import("./api.js").PDFPageProxy;
2
+ export type PageViewport = import("./page_viewport.js").PageViewport;
3
+ export type OptionalContentConfig = any;
3
4
  export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
4
5
  export type AnnotationEditorUIManager = any;
5
6
  export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
@@ -53,10 +54,7 @@ export type AnnotationLayerParameters = {
53
54
  accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
54
55
  annotationEditorUIManager?: AnnotationEditorUIManager;
55
56
  structTreeLayer?: import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined;
56
- /**
57
- * - The comment manager instance.
58
- */
59
- commentManager?: import("../../web/comment_manager.js").CommentManager | undefined;
57
+ optionalContentConfig?: OptionalContentConfig;
60
58
  };
61
59
  /**
62
60
  * @typedef {Object} AnnotationLayerParameters
@@ -78,7 +76,7 @@ export type AnnotationLayerParameters = {
78
76
  * @property {TextAccessibilityManager} [accessibilityManager]
79
77
  * @property {AnnotationEditorUIManager} [annotationEditorUIManager]
80
78
  * @property {StructTreeLayerBuilder} [structTreeLayer]
81
- * @property {CommentManager} [commentManager] - The comment manager instance.
79
+ * @property {OptionalContentConfig} [optionalContentConfig]
82
80
  */
83
81
  /**
84
82
  * Manage the layer containing all the annotations.
@@ -100,10 +98,10 @@ export class AnnotationLayer {
100
98
  linkService: any;
101
99
  annotationStorage: any;
102
100
  });
101
+ zIndex: number;
103
102
  div: any;
104
103
  page: any;
105
104
  viewport: any;
106
- zIndex: number;
107
105
  _annotationEditorUIManager: any;
108
106
  _commentManager: any;
109
107
  popupShow: any[] | undefined;
@@ -127,7 +125,9 @@ export class AnnotationLayer {
127
125
  * @param {AnnotationLayerParameters} viewport
128
126
  * @memberof AnnotationLayer
129
127
  */
130
- update({ viewport }: AnnotationLayerParameters): void;
128
+ update({ viewport, optionalContentConfig }: AnnotationLayerParameters): void;
129
+ destroy(): void;
130
+ refreshCanvases(): void;
131
131
  getEditableAnnotations(): MapIterator<any>;
132
132
  getEditableAnnotation(id: any): any;
133
133
  addFakeAnnotation(editor: any): EditorAnnotationElement;
@@ -267,8 +267,10 @@ declare class AnnotationElement {
267
267
  public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
268
268
  addHighlightArea(): void;
269
269
  _editOnDoubleClick(): void;
270
+ updateOC(optionalContentConfig: any): void;
270
271
  get width(): number;
271
272
  get height(): number;
273
+ _setBackgroundColor(element: any): void;
272
274
  #private;
273
275
  }
274
276
  export {};