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
@@ -18,9 +18,9 @@ export class StructTreePage {
18
18
  /**
19
19
  * Convert the tree structure into a simplified object literal that can
20
20
  * be sent to the main thread.
21
- * @returns {Object}
21
+ * @returns {object}
22
22
  */
23
- get serializable(): Object;
23
+ get serializable(): object;
24
24
  }
25
25
  export class StructTreeRoot {
26
26
  static canCreateStructureTree({ catalogRef, pdfManager, newAnnotationsByPage, }: {
@@ -78,7 +78,7 @@ export class StructTreeRoot {
78
78
  dict: any;
79
79
  ref: Ref | null;
80
80
  getKidPosition(kidRef: any): any;
81
- addAnnotationIdToPage(pageRef: any, id: any): void;
81
+ addAnnotationIdToPage(pageRef: any, id: any, ref: any): void;
82
82
  canUpdateStructTree({ pdfManager, newAnnotationsByPage }: {
83
83
  pdfManager: any;
84
84
  newAnnotationsByPage: any;
@@ -11,7 +11,6 @@ export class SimpleDOMNode {
11
11
  * Search a node in the tree with the given path
12
12
  * foo.bar[nnn], i.e. find the nnn-th node named
13
13
  * bar under a node named foo.
14
- *
15
14
  * @param {Array} paths - an array of objects as
16
15
  * returned by {parseXFAPath}.
17
16
  * @param {number} pos - the current position in
@@ -67,7 +66,7 @@ export class XMLParserBase {
67
66
  export namespace XMLParserErrorCode {
68
67
  let NoError: number;
69
68
  let EndOfDocument: number;
70
- let UnterminatedCdat: number;
69
+ let UnterminatedCdata: number;
71
70
  let UnterminatedXmlDeclaration: number;
72
71
  let UnterminatedDoctypeDeclaration: number;
73
72
  let UnterminatedComment: number;
@@ -2,13 +2,6 @@ export class XRef {
2
2
  constructor(stream: any, pdfManager: any);
3
3
  stream: any;
4
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
5
  getNewPersistentRef(obj: any): any;
13
6
  getNewTemporaryRef(): any;
14
7
  resetNewTemporaryRef(): void;
@@ -19,12 +12,6 @@ export class XRef {
19
12
  encrypt: CipherTransformFactory | undefined;
20
13
  root: Dict | undefined;
21
14
  processXRefTable(parser: any): Dict;
22
- tableState: {
23
- entryNum: number;
24
- streamPos: any;
25
- parserBuf1: any;
26
- parserBuf2: any;
27
- } | undefined;
28
15
  readXRefTable(parser: any): any;
29
16
  processXRefStream(stream: any): any;
30
17
  streamState: {
@@ -37,7 +24,7 @@ export class XRef {
37
24
  indexObjects(): any;
38
25
  _generationFallback: boolean | undefined;
39
26
  readXRef(recoveryMode?: boolean): any;
40
- topDict: any;
27
+ countUpdatesAfter(offset: any): number | null;
41
28
  getEntry(i: any): any;
42
29
  fetchIfRef(obj: any, suppressEncryption?: boolean): any;
43
30
  fetch(ref: any, suppressEncryption?: boolean): any;
@@ -46,7 +33,7 @@ export class XRef {
46
33
  fetchIfRefAsync(obj: any, suppressEncryption: any): Promise<any>;
47
34
  fetchAsync(ref: any, suppressEncryption: any): any;
48
35
  getCatalogObj(): Dict | undefined;
36
+ #private;
49
37
  }
50
- import { RefSet } from "./primitives.js";
51
38
  import { CipherTransformFactory } from "./crypto.js";
52
39
  import { Dict } from "./primitives.js";
@@ -8,7 +8,7 @@ export type CommentManager = import("../../web/comment_manager.js").CommentManag
8
8
  export type PDFLinkService = import("../../web/pdf_link_service.js").PDFLinkService;
9
9
  export type BaseDownloadManager = import("../../web/base_download_manager.js").BaseDownloadManager;
10
10
  export type AnnotationElementParameters = {
11
- data: Object;
11
+ data: object;
12
12
  layer: HTMLDivElement;
13
13
  linkService: PDFLinkService;
14
14
  downloadManager?: import("../../web/base_download_manager.js").BaseDownloadManager | undefined;
@@ -19,10 +19,10 @@ export type AnnotationElementParameters = {
19
19
  */
20
20
  imageResourcesPath?: string | undefined;
21
21
  renderForms: boolean;
22
- svgFactory: Object;
22
+ svgFactory: object;
23
23
  enableScripting?: boolean | undefined;
24
24
  hasJSActions?: boolean | undefined;
25
- fieldObjects?: Object | undefined;
25
+ fieldObjects?: Map<any, any> | undefined;
26
26
  };
27
27
  export type AnnotationLayerParameters = {
28
28
  viewport: PageViewport;
@@ -47,9 +47,7 @@ export type AnnotationLayerParameters = {
47
47
  * The default value is `false`.
48
48
  */
49
49
  hasJSActions?: boolean | undefined;
50
- fieldObjects?: {
51
- [x: string]: Object[];
52
- } | null | undefined;
50
+ fieldObjects?: Map<string, object[]> | null | undefined;
53
51
  annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
54
52
  accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
55
53
  annotationEditorUIManager?: AnnotationEditorUIManager;
@@ -57,7 +55,7 @@ export type AnnotationLayerParameters = {
57
55
  optionalContentConfig?: OptionalContentConfig;
58
56
  };
59
57
  /**
60
- * @typedef {Object} AnnotationLayerParameters
58
+ * @typedef {object} AnnotationLayerParameters
61
59
  * @property {PageViewport} viewport
62
60
  * @property {HTMLDivElement} div
63
61
  * @property {Array} annotations
@@ -71,7 +69,7 @@ export type AnnotationLayerParameters = {
71
69
  * @property {boolean} [enableScripting] - Enable embedded script execution.
72
70
  * @property {boolean} [hasJSActions] - Some fields have JS actions.
73
71
  * The default value is `false`.
74
- * @property {Object<string, Array<Object>> | null} [fieldObjects]
72
+ * @property {Map<string, Array<object>> | null} [fieldObjects]
75
73
  * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
76
74
  * @property {TextAccessibilityManager} [accessibilityManager]
77
75
  * @property {AnnotationEditorUIManager} [annotationEditorUIManager]
@@ -108,20 +106,17 @@ export class AnnotationLayer {
108
106
  hasEditableAnnotations(): boolean;
109
107
  /**
110
108
  * Render a new annotation layer with all annotation elements.
111
- *
112
109
  * @param {AnnotationLayerParameters} params
113
110
  * @memberof AnnotationLayer
114
111
  */
115
112
  render(params: AnnotationLayerParameters): Promise<void>;
116
113
  /**
117
114
  * Add link annotations to the annotation layer.
118
- *
119
- * @param {Array<Object>} annotations
115
+ * @param {Array<object>} annotations
120
116
  */
121
- addLinkAnnotations(annotations: Array<Object>): Promise<void>;
117
+ addLinkAnnotations(annotations: Array<object>): Promise<void>;
122
118
  /**
123
119
  * Update the annotation elements on existing annotation layer.
124
- *
125
120
  * @param {AnnotationLayerParameters} viewport
126
121
  * @memberof AnnotationLayer
127
122
  */
@@ -211,7 +206,6 @@ declare class AnnotationElement {
211
206
  resetEdited(): void;
212
207
  /**
213
208
  * Create an empty container for the annotation's HTML element.
214
- *
215
209
  * @private
216
210
  * @param {boolean} ignoreBorder
217
211
  * @memberof AnnotationElement
@@ -224,7 +218,6 @@ declare class AnnotationElement {
224
218
  _setDefaultPropertiesFromJS(element: any): void;
225
219
  /**
226
220
  * Create quadrilaterals from the annotation's quadpoints.
227
- *
228
221
  * @private
229
222
  * @memberof AnnotationElement
230
223
  */
@@ -233,9 +226,7 @@ declare class AnnotationElement {
233
226
  * Create a popup for the annotation's HTML element. This is used for
234
227
  * annotations that do not have a Popup entry in the dictionary, but
235
228
  * are of a type that works with popups (such as Highlight annotations).
236
- *
237
- * @param {Object} [popupData] - The data for the popup, if any.
238
- *
229
+ * @param {object} [popupData] - The data for the popup, if any.
239
230
  * @private
240
231
  * @memberof AnnotationElement
241
232
  */
@@ -244,7 +235,6 @@ declare class AnnotationElement {
244
235
  get extraPopupElement(): null;
245
236
  /**
246
237
  * Render the annotation's HTML element(s).
247
- *
248
238
  * @public
249
239
  * @memberof AnnotationElement
250
240
  */
@@ -258,7 +248,6 @@ declare class AnnotationElement {
258
248
  hide(): void;
259
249
  /**
260
250
  * Get the HTML element(s) which can trigger a popup when clicked or hovered.
261
- *
262
251
  * @public
263
252
  * @memberof AnnotationElement
264
253
  * @returns {Array<HTMLElement>|HTMLElement} An array of elements or an
@@ -8,16 +8,16 @@ export class AnnotationStorage {
8
8
  /**
9
9
  * Get the value for a given key if it exists, or return the default value.
10
10
  * @param {string} key
11
- * @param {Object} defaultValue
12
- * @returns {Object}
11
+ * @param {object} defaultValue
12
+ * @returns {object}
13
13
  */
14
- getValue(key: string, defaultValue: Object): Object;
14
+ getValue(key: string, defaultValue: object): object;
15
15
  /**
16
16
  * Get the value for a given key.
17
17
  * @param {string} key
18
- * @returns {Object}
18
+ * @returns {object}
19
19
  */
20
- getRawValue(key: string): Object;
20
+ getRawValue(key: string): object;
21
21
  /**
22
22
  * Remove a value from the storage.
23
23
  * @param {string} key
@@ -26,9 +26,9 @@ export class AnnotationStorage {
26
26
  /**
27
27
  * Set the value for a given key
28
28
  * @param {string} key
29
- * @param {Object} value
29
+ * @param {object} value
30
30
  */
31
- setValue(key: string, value: Object): void;
31
+ setValue(key: string, value: object): void;
32
32
  /**
33
33
  * Check if the storage contains the given key.
34
34
  * @param {string} key