|
| 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({ contentsObj, richText }: { |
| 156 | + contentsObj: any; |
| 157 | + richText: any; |
| 158 | + }): boolean; |
| 159 | + constructor(parameters: any, { isRenderable, ignoreBorder, createQuadrilaterals, }?: { |
| 160 | + isRenderable?: boolean | undefined; |
| 161 | + ignoreBorder?: boolean | undefined; |
| 162 | + createQuadrilaterals?: boolean | undefined; |
| 163 | + }); |
| 164 | + isRenderable: boolean; |
| 165 | + data: any; |
| 166 | + layer: any; |
| 167 | + linkService: any; |
| 168 | + downloadManager: any; |
| 169 | + imageResourcesPath: any; |
| 170 | + renderForms: any; |
| 171 | + svgFactory: any; |
| 172 | + annotationStorage: any; |
| 173 | + enableScripting: any; |
| 174 | + hasJSActions: any; |
| 175 | + _fieldObjects: any; |
| 176 | + parent: any; |
| 177 | + container: HTMLElement | undefined; |
| 178 | + get _isEditable(): any; |
| 179 | + get hasPopupData(): boolean; |
| 180 | + updateEdited(params: any): void; |
| 181 | + popup: any; |
| 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 | + * @param {Object} [popupData] - The data for the popup, if any. |
| 209 | + * |
| 210 | + * @private |
| 211 | + * @memberof AnnotationElement |
| 212 | + */ |
| 213 | + private _createPopup; |
| 214 | + get hasPopupElement(): boolean; |
| 215 | + /** |
| 216 | + * Render the annotation's HTML element(s). |
| 217 | + * |
| 218 | + * @public |
| 219 | + * @memberof AnnotationElement |
| 220 | + */ |
| 221 | + public render(): void; |
| 222 | + /** |
| 223 | + * @private |
| 224 | + * @returns {Array} |
| 225 | + */ |
| 226 | + private _getElementsByName; |
| 227 | + show(): void; |
| 228 | + hide(): void; |
| 229 | + /** |
| 230 | + * Get the HTML element(s) which can trigger a popup when clicked or hovered. |
| 231 | + * |
| 232 | + * @public |
| 233 | + * @memberof AnnotationElement |
| 234 | + * @returns {Array<HTMLElement>|HTMLElement} An array of elements or an |
| 235 | + * element. |
| 236 | + */ |
| 237 | + public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement; |
| 238 | + addHighlightArea(): void; |
| 239 | + _editOnDoubleClick(): void; |
| 240 | + get width(): number; |
| 241 | + get height(): number; |
| 242 | + #private; |
| 243 | +} |
| 244 | +export {}; |
0 commit comments