@chialab/pdfjs-lib 1.0.0-alpha.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 (104) hide show
  1. package/README.md +29 -0
  2. package/dist/browser/FoxitDingbats-SB6TO3S5.js +9 -0
  3. package/dist/browser/FoxitFixed-UIGSMBQB.js +9 -0
  4. package/dist/browser/FoxitFixedBold-2PAEIZAT.js +9 -0
  5. package/dist/browser/FoxitFixedBoldItalic-OSQUQDEE.js +9 -0
  6. package/dist/browser/FoxitFixedItalic-W73RDK22.js +9 -0
  7. package/dist/browser/FoxitSerif-3HH3SOZF.js +9 -0
  8. package/dist/browser/FoxitSerifBold-HXP2QOO7.js +9 -0
  9. package/dist/browser/FoxitSerifBoldItalic-FZXLNWD7.js +9 -0
  10. package/dist/browser/FoxitSerifItalic-WQFHUBI2.js +9 -0
  11. package/dist/browser/FoxitSymbol-OVWU7LKS.js +9 -0
  12. package/dist/browser/LiberationMono-Regular-UUOCTXY2.js +9 -0
  13. package/dist/browser/LiberationSans-Bold-GSJN42N5.js +9 -0
  14. package/dist/browser/LiberationSans-BoldItalic-UCPQJ3L2.js +9 -0
  15. package/dist/browser/LiberationSans-Italic-6CIHEALY.js +9 -0
  16. package/dist/browser/LiberationSans-Regular-KIF3IRJY.js +9 -0
  17. package/dist/browser/LiberationSerif-Regular-ASQ2LI3D.js +9 -0
  18. package/dist/browser/chunk-DYHYQ33L.js +1775 -0
  19. package/dist/browser/chunk-O4UKW7AD.js +44 -0
  20. package/dist/browser/index.js +26324 -0
  21. package/dist/browser/worker.js +84242 -0
  22. package/dist/index.d.ts +10 -0
  23. package/dist/lib/AnnotationData.d.ts +204 -0
  24. package/dist/lib/Canvas.d.ts +17 -0
  25. package/dist/lib/PDFPageProxy.d.ts +1 -0
  26. package/dist/lib/Path2D.d.ts +72 -0
  27. package/dist/lib/StandardFontDataFactory.d.ts +14 -0
  28. package/dist/lib/SvgCanvasContext.d.ts +156 -0
  29. package/dist/lib/TextLayer.d.ts +51 -0
  30. package/dist/lib/polyfills.d.ts +0 -0
  31. package/dist/lib/utils.d.ts +13 -0
  32. package/dist/node/FoxitDingbats-65AZ2Z2V.js +9 -0
  33. package/dist/node/FoxitFixed-OZGLVVOQ.js +9 -0
  34. package/dist/node/FoxitFixedBold-37OOYMV7.js +9 -0
  35. package/dist/node/FoxitFixedBoldItalic-XYFHEG2V.js +9 -0
  36. package/dist/node/FoxitFixedItalic-MM7OSGS6.js +9 -0
  37. package/dist/node/FoxitSerif-MLMJQPRP.js +9 -0
  38. package/dist/node/FoxitSerifBold-AC7RJQWJ.js +9 -0
  39. package/dist/node/FoxitSerifBoldItalic-YCQ4CLKE.js +9 -0
  40. package/dist/node/FoxitSerifItalic-CXVTCST4.js +9 -0
  41. package/dist/node/FoxitSymbol-VUGMZN5C.js +9 -0
  42. package/dist/node/LiberationMono-Regular-KMFXXO3B.js +9 -0
  43. package/dist/node/LiberationSans-Bold-XSHQQBWB.js +9 -0
  44. package/dist/node/LiberationSans-BoldItalic-CTAZRFRL.js +9 -0
  45. package/dist/node/LiberationSans-Italic-WIOTUKLC.js +9 -0
  46. package/dist/node/LiberationSans-Regular-CDMMZL5S.js +9 -0
  47. package/dist/node/LiberationSerif-Regular-WAOWR76G.js +9 -0
  48. package/dist/node/chunk-7MW5RQZ5.js +30 -0
  49. package/dist/node/chunk-KTTVPO2G.js +1775 -0
  50. package/dist/node/index.js +26621 -0
  51. package/dist/node/worker.js +84242 -0
  52. package/dist/pdf.js/src/display/annotation_layer.d.ts +241 -0
  53. package/dist/pdf.js/src/display/annotation_storage.d.ts +99 -0
  54. package/dist/pdf.js/src/display/api.d.ts +1586 -0
  55. package/dist/pdf.js/src/display/canvas.d.ts +213 -0
  56. package/dist/pdf.js/src/display/canvas_factory.d.ts +27 -0
  57. package/dist/pdf.js/src/display/cmap_reader_factory.d.ts +25 -0
  58. package/dist/pdf.js/src/display/display_utils.d.ts +247 -0
  59. package/dist/pdf.js/src/display/draw_layer.d.ts +26 -0
  60. package/dist/pdf.js/src/display/editor/alt_text.d.ts +34 -0
  61. package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +230 -0
  62. package/dist/pdf.js/src/display/editor/color_picker.d.ts +20 -0
  63. package/dist/pdf.js/src/display/editor/draw.d.ts +121 -0
  64. package/dist/pdf.js/src/display/editor/drawers/contour.d.ts +3 -0
  65. package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +31 -0
  66. package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +36 -0
  67. package/dist/pdf.js/src/display/editor/drawers/inkdraw.d.ts +129 -0
  68. package/dist/pdf.js/src/display/editor/drawers/outline.d.ts +19 -0
  69. package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +79 -0
  70. package/dist/pdf.js/src/display/editor/editor.d.ts +474 -0
  71. package/dist/pdf.js/src/display/editor/freetext.d.ts +59 -0
  72. package/dist/pdf.js/src/display/editor/highlight.d.ts +70 -0
  73. package/dist/pdf.js/src/display/editor/ink.d.ts +36 -0
  74. package/dist/pdf.js/src/display/editor/signature.d.ts +79 -0
  75. package/dist/pdf.js/src/display/editor/stamp.d.ts +48 -0
  76. package/dist/pdf.js/src/display/editor/toolbar.d.ts +21 -0
  77. package/dist/pdf.js/src/display/editor/tools.d.ts +424 -0
  78. package/dist/pdf.js/src/display/filter_factory.d.ts +29 -0
  79. package/dist/pdf.js/src/display/font_loader.d.ts +39 -0
  80. package/dist/pdf.js/src/display/metadata.d.ts +11 -0
  81. package/dist/pdf.js/src/display/node_utils.d.ts +32 -0
  82. package/dist/pdf.js/src/display/optional_content_config.d.ts +18 -0
  83. package/dist/pdf.js/src/display/pattern_helper.d.ts +73 -0
  84. package/dist/pdf.js/src/display/standard_fontdata_factory.d.ts +20 -0
  85. package/dist/pdf.js/src/display/svg_factory.d.ts +14 -0
  86. package/dist/pdf.js/src/display/text_layer.d.ts +85 -0
  87. package/dist/pdf.js/src/display/touch_manager.d.ts +14 -0
  88. package/dist/pdf.js/src/display/transport_stream.d.ts +67 -0
  89. package/dist/pdf.js/src/display/wasm_factory.d.ts +20 -0
  90. package/dist/pdf.js/src/display/worker_options.d.ts +25 -0
  91. package/dist/pdf.js/src/display/xfa_layer.d.ts +47 -0
  92. package/dist/pdf.js/src/display/xfa_text.d.ts +21 -0
  93. package/dist/pdf.js/src/interfaces.d.ts +122 -0
  94. package/dist/pdf.js/src/pdf.d.ts +55 -0
  95. package/dist/pdf.js/src/shared/image_utils.d.ts +17 -0
  96. package/dist/pdf.js/src/shared/message_handler.d.ts +48 -0
  97. package/dist/pdf.js/src/shared/murmurhash3.d.ts +7 -0
  98. package/dist/pdf.js/src/shared/scripting_utils.d.ts +16 -0
  99. package/dist/pdf.js/src/shared/util.d.ts +388 -0
  100. package/dist/pdf.js/web/interfaces.d.ts +167 -0
  101. package/dist/pdf.js/web/struct_tree_layer_builder.d.ts +25 -0
  102. package/dist/pdf.js/web/text_accessibility.d.ts +44 -0
  103. package/dist/pdf.js/web/ui_utils.d.ts +273 -0
  104. package/package.json +43 -0
@@ -0,0 +1,241 @@
1
+ export type PDFPageProxy = import("./api").PDFPageProxy;
2
+ export type PageViewport = import("./display_utils").PageViewport;
3
+ export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
4
+ export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
5
+ export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
6
+ export type AnnotationEditorUIManager = any;
7
+ export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
8
+ export type AnnotationElementParameters = {
9
+ data: Object;
10
+ layer: HTMLDivElement;
11
+ linkService: IPDFLinkService;
12
+ downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
13
+ annotationStorage?: AnnotationStorage | undefined;
14
+ /**
15
+ * - Path for image resources, mainly
16
+ * for annotation icons. Include trailing slash.
17
+ */
18
+ imageResourcesPath?: string | undefined;
19
+ renderForms: boolean;
20
+ svgFactory: Object;
21
+ enableScripting?: boolean | undefined;
22
+ hasJSActions?: boolean | undefined;
23
+ fieldObjects?: Object | undefined;
24
+ };
25
+ export type AnnotationLayerParameters = {
26
+ viewport: PageViewport;
27
+ div: HTMLDivElement;
28
+ annotations: any[];
29
+ page: PDFPageProxy;
30
+ linkService: IPDFLinkService;
31
+ downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
32
+ annotationStorage?: AnnotationStorage | undefined;
33
+ /**
34
+ * - Path for image resources, mainly
35
+ * for annotation icons. Include trailing slash.
36
+ */
37
+ imageResourcesPath?: string | undefined;
38
+ renderForms: boolean;
39
+ /**
40
+ * - Enable embedded script execution.
41
+ */
42
+ enableScripting?: boolean | undefined;
43
+ /**
44
+ * - Some fields have JS actions.
45
+ * The default value is `false`.
46
+ */
47
+ hasJSActions?: boolean | undefined;
48
+ fieldObjects?: {
49
+ [x: string]: Object[];
50
+ } | null | undefined;
51
+ annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
52
+ accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
53
+ annotationEditorUIManager?: AnnotationEditorUIManager;
54
+ structTreeLayer?: import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined;
55
+ };
56
+ /**
57
+ * @typedef {Object} AnnotationLayerParameters
58
+ * @property {PageViewport} viewport
59
+ * @property {HTMLDivElement} div
60
+ * @property {Array} annotations
61
+ * @property {PDFPageProxy} page
62
+ * @property {IPDFLinkService} linkService
63
+ * @property {IDownloadManager} [downloadManager]
64
+ * @property {AnnotationStorage} [annotationStorage]
65
+ * @property {string} [imageResourcesPath] - Path for image resources, mainly
66
+ * for annotation icons. Include trailing slash.
67
+ * @property {boolean} renderForms
68
+ * @property {boolean} [enableScripting] - Enable embedded script execution.
69
+ * @property {boolean} [hasJSActions] - Some fields have JS actions.
70
+ * The default value is `false`.
71
+ * @property {Object<string, Array<Object>> | null} [fieldObjects]
72
+ * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
73
+ * @property {TextAccessibilityManager} [accessibilityManager]
74
+ * @property {AnnotationEditorUIManager} [annotationEditorUIManager]
75
+ * @property {StructTreeLayerBuilder} [structTreeLayer]
76
+ */
77
+ /**
78
+ * Manage the layer containing all the annotations.
79
+ */
80
+ export class AnnotationLayer {
81
+ /**
82
+ * @private
83
+ */
84
+ private static get _defaultBorderStyle();
85
+ constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: {
86
+ div: any;
87
+ accessibilityManager: any;
88
+ annotationCanvasMap: any;
89
+ annotationEditorUIManager: any;
90
+ page: any;
91
+ viewport: any;
92
+ structTreeLayer: any;
93
+ });
94
+ div: any;
95
+ page: any;
96
+ viewport: any;
97
+ zIndex: number;
98
+ _annotationEditorUIManager: any;
99
+ popupShow: any[] | undefined;
100
+ hasEditableAnnotations(): boolean;
101
+ /**
102
+ * Render a new annotation layer with all annotation elements.
103
+ *
104
+ * @param {AnnotationLayerParameters} params
105
+ * @memberof AnnotationLayer
106
+ */
107
+ render(params: AnnotationLayerParameters): Promise<void>;
108
+ /**
109
+ * Add link annotations to the annotation layer.
110
+ *
111
+ * @param {Array<Object>} annotations
112
+ * @param {IPDFLinkService} linkService
113
+ * @memberof AnnotationLayer
114
+ */
115
+ addLinkAnnotations(annotations: Array<Object>, linkService: IPDFLinkService): Promise<void>;
116
+ /**
117
+ * Update the annotation elements on existing annotation layer.
118
+ *
119
+ * @param {AnnotationLayerParameters} viewport
120
+ * @memberof AnnotationLayer
121
+ */
122
+ update({ viewport }: AnnotationLayerParameters): void;
123
+ getEditableAnnotations(): any[];
124
+ getEditableAnnotation(id: any): any;
125
+ #private;
126
+ }
127
+ export class FreeTextAnnotationElement extends AnnotationElement {
128
+ constructor(parameters: any);
129
+ textContent: any;
130
+ textPosition: any;
131
+ annotationEditorType: number;
132
+ render(): HTMLElement | undefined;
133
+ }
134
+ export class HighlightAnnotationElement extends AnnotationElement {
135
+ constructor(parameters: any);
136
+ annotationEditorType: number;
137
+ render(): HTMLElement | undefined;
138
+ }
139
+ export class InkAnnotationElement extends AnnotationElement {
140
+ constructor(parameters: any);
141
+ containerClassName: string;
142
+ svgElementName: string;
143
+ annotationEditorType: number;
144
+ render(): HTMLElement | undefined;
145
+ getElementsToTriggerPopup(): any[];
146
+ #private;
147
+ }
148
+ export class StampAnnotationElement extends AnnotationElement {
149
+ constructor(parameters: any);
150
+ annotationEditorType: number;
151
+ render(): HTMLElement | undefined;
152
+ }
153
+ import { AnnotationStorage } from "./annotation_storage.js";
154
+ declare class AnnotationElement {
155
+ static _hasPopupData({ titleObj, contentsObj, richText }: {
156
+ titleObj: any;
157
+ contentsObj: any;
158
+ richText: any;
159
+ }): boolean;
160
+ constructor(parameters: any, { isRenderable, ignoreBorder, createQuadrilaterals, }?: {
161
+ isRenderable?: boolean | undefined;
162
+ ignoreBorder?: boolean | undefined;
163
+ createQuadrilaterals?: boolean | undefined;
164
+ });
165
+ isRenderable: boolean;
166
+ data: any;
167
+ layer: any;
168
+ linkService: any;
169
+ downloadManager: any;
170
+ imageResourcesPath: any;
171
+ renderForms: any;
172
+ svgFactory: any;
173
+ annotationStorage: any;
174
+ enableScripting: any;
175
+ hasJSActions: any;
176
+ _fieldObjects: any;
177
+ parent: any;
178
+ container: HTMLElement | undefined;
179
+ get _isEditable(): any;
180
+ get hasPopupData(): boolean;
181
+ updateEdited(params: any): void;
182
+ resetEdited(): void;
183
+ /**
184
+ * Create an empty container for the annotation's HTML element.
185
+ *
186
+ * @private
187
+ * @param {boolean} ignoreBorder
188
+ * @memberof AnnotationElement
189
+ * @returns {HTMLElement} A section element.
190
+ */
191
+ private _createContainer;
192
+ setRotation(angle: any, container?: HTMLElement | undefined): void;
193
+ get _commonActions(): any;
194
+ _dispatchEventFromSandbox(actions: any, jsEvent: any): void;
195
+ _setDefaultPropertiesFromJS(element: any): void;
196
+ /**
197
+ * Create quadrilaterals from the annotation's quadpoints.
198
+ *
199
+ * @private
200
+ * @memberof AnnotationElement
201
+ */
202
+ private _createQuadrilaterals;
203
+ /**
204
+ * Create a popup for the annotation's HTML element. This is used for
205
+ * annotations that do not have a Popup entry in the dictionary, but
206
+ * are of a type that works with popups (such as Highlight annotations).
207
+ *
208
+ * @private
209
+ * @memberof AnnotationElement
210
+ */
211
+ private _createPopup;
212
+ /**
213
+ * Render the annotation's HTML element(s).
214
+ *
215
+ * @public
216
+ * @memberof AnnotationElement
217
+ */
218
+ public render(): void;
219
+ /**
220
+ * @private
221
+ * @returns {Array}
222
+ */
223
+ private _getElementsByName;
224
+ show(): void;
225
+ hide(): void;
226
+ /**
227
+ * Get the HTML element(s) which can trigger a popup when clicked or hovered.
228
+ *
229
+ * @public
230
+ * @memberof AnnotationElement
231
+ * @returns {Array<HTMLElement>|HTMLElement} An array of elements or an
232
+ * element.
233
+ */
234
+ public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
235
+ addHighlightArea(): void;
236
+ _editOnDoubleClick(): void;
237
+ get width(): number;
238
+ get height(): number;
239
+ #private;
240
+ }
241
+ export {};
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Key/value storage for annotation data in forms.
3
+ */
4
+ export class AnnotationStorage {
5
+ onSetModified: any;
6
+ onResetModified: any;
7
+ onAnnotationEditor: any;
8
+ /**
9
+ * Get the value for a given key if it exists, or return the default value.
10
+ * @param {string} key
11
+ * @param {Object} defaultValue
12
+ * @returns {Object}
13
+ */
14
+ getValue(key: string, defaultValue: Object): Object;
15
+ /**
16
+ * Get the value for a given key.
17
+ * @param {string} key
18
+ * @returns {Object}
19
+ */
20
+ getRawValue(key: string): Object;
21
+ /**
22
+ * Remove a value from the storage.
23
+ * @param {string} key
24
+ */
25
+ remove(key: string): void;
26
+ /**
27
+ * Set the value for a given key
28
+ * @param {string} key
29
+ * @param {Object} value
30
+ */
31
+ setValue(key: string, value: Object): void;
32
+ /**
33
+ * Check if the storage contains the given key.
34
+ * @param {string} key
35
+ * @returns {boolean}
36
+ */
37
+ has(key: string): boolean;
38
+ /**
39
+ * @returns {Object | null}
40
+ */
41
+ getAll(): Object | null;
42
+ /**
43
+ * @param {Object} obj
44
+ */
45
+ setAll(obj: Object): void;
46
+ get size(): number;
47
+ resetModified(): void;
48
+ /**
49
+ * @returns {PrintAnnotationStorage}
50
+ */
51
+ get print(): PrintAnnotationStorage;
52
+ /**
53
+ * PLEASE NOTE: Only intended for usage within the API itself.
54
+ * @ignore
55
+ */
56
+ get serializable(): Readonly<{
57
+ map: null;
58
+ hash: "";
59
+ transfer: undefined;
60
+ }> | {
61
+ map: Map<any, any>;
62
+ hash: string;
63
+ transfer: any[];
64
+ };
65
+ get editorStats(): any;
66
+ resetModifiedIds(): void;
67
+ /**
68
+ * @returns {{ids: Set<string>, hash: string}}
69
+ */
70
+ get modifiedIds(): {
71
+ ids: Set<string>;
72
+ hash: string;
73
+ };
74
+ #private;
75
+ }
76
+ /**
77
+ * A special `AnnotationStorage` for use during printing, where the serializable
78
+ * data is *frozen* upon initialization, to prevent scripting from modifying its
79
+ * contents. (Necessary since printing is triggered synchronously in browsers.)
80
+ */
81
+ export class PrintAnnotationStorage extends AnnotationStorage {
82
+ constructor(parent: any);
83
+ /**
84
+ * PLEASE NOTE: Only intended for usage within the API itself.
85
+ * @ignore
86
+ */
87
+ get serializable(): {
88
+ map: any;
89
+ hash: any;
90
+ transfer: any;
91
+ };
92
+ get modifiedIds(): any;
93
+ #private;
94
+ }
95
+ export const SerializableEmpty: Readonly<{
96
+ map: null;
97
+ hash: "";
98
+ transfer: undefined;
99
+ }>;