|
| 1 | +declare type AnnotationElementParameters = { |
| 2 | + data: Object; |
| 3 | + layer: HTMLDivElement; |
| 4 | + linkService: IPDFLinkService; |
| 5 | + downloadManager?: IDownloadManager | undefined; |
| 6 | + annotationStorage?: AnnotationStorage | undefined; |
| 7 | + /** |
| 8 | + * - Path for image resources, mainly |
| 9 | + * for annotation icons. Include trailing slash. |
| 10 | + */ |
| 11 | + imageResourcesPath?: string | undefined; |
| 12 | + renderForms: boolean; |
| 13 | + svgFactory: Object; |
| 14 | + enableScripting?: boolean | undefined; |
| 15 | + hasJSActions?: boolean | undefined; |
| 16 | + fieldObjects?: Object | undefined; |
| 17 | +}; |
| 18 | +declare type AnnotationLayerParameters = { |
| 19 | + viewport: PageViewport; |
| 20 | + div: HTMLDivElement; |
| 21 | + annotations: any[]; |
| 22 | + page: PDFPageProxy; |
| 23 | + linkService: IPDFLinkService; |
| 24 | + downloadManager?: IDownloadManager | undefined; |
| 25 | + annotationStorage?: AnnotationStorage | undefined; |
| 26 | + /** |
| 27 | + * - Path for image resources, mainly |
| 28 | + * for annotation icons. Include trailing slash. |
| 29 | + */ |
| 30 | + imageResourcesPath?: string | undefined; |
| 31 | + renderForms: boolean; |
| 32 | + /** |
| 33 | + * - Enable embedded script execution. |
| 34 | + */ |
| 35 | + enableScripting?: boolean | undefined; |
| 36 | + /** |
| 37 | + * - Some fields have JS actions. |
| 38 | + * The default value is `false`. |
| 39 | + */ |
| 40 | + hasJSActions?: boolean | undefined; |
| 41 | + fieldObjects?: { |
| 42 | + [x: string]: Object[]; |
| 43 | + } | null | undefined; |
| 44 | + annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined; |
| 45 | + accessibilityManager?: TextAccessibilityManager | undefined; |
| 46 | + annotationEditorUIManager?: AnnotationEditorUIManager; |
| 47 | + structTreeLayer?: StructTreeLayerBuilder | undefined; |
| 48 | +}; |
| 49 | +/** |
| 50 | + * @typedef {Object} AnnotationLayerParameters |
| 51 | + * @property {PageViewport} viewport |
| 52 | + * @property {HTMLDivElement} div |
| 53 | + * @property {Array} annotations |
| 54 | + * @property {PDFPageProxy} page |
| 55 | + * @property {IPDFLinkService} linkService |
| 56 | + * @property {IDownloadManager} [downloadManager] |
| 57 | + * @property {AnnotationStorage} [annotationStorage] |
| 58 | + * @property {string} [imageResourcesPath] - Path for image resources, mainly |
| 59 | + * for annotation icons. Include trailing slash. |
| 60 | + * @property {boolean} renderForms |
| 61 | + * @property {boolean} [enableScripting] - Enable embedded script execution. |
| 62 | + * @property {boolean} [hasJSActions] - Some fields have JS actions. |
| 63 | + * The default value is `false`. |
| 64 | + * @property {Object<string, Array<Object>> | null} [fieldObjects] |
| 65 | + * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] |
| 66 | + * @property {TextAccessibilityManager} [accessibilityManager] |
| 67 | + * @property {AnnotationEditorUIManager} [annotationEditorUIManager] |
| 68 | + * @property {StructTreeLayerBuilder} [structTreeLayer] |
| 69 | + */ |
| 70 | +/** |
| 71 | + * Manage the layer containing all the annotations. |
| 72 | + */ |
| 73 | +declare class AnnotationLayer { |
| 74 | + constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: { |
| 75 | + div: any; |
| 76 | + accessibilityManager: any; |
| 77 | + annotationCanvasMap: any; |
| 78 | + annotationEditorUIManager: any; |
| 79 | + page: any; |
| 80 | + viewport: any; |
| 81 | + structTreeLayer: any; |
| 82 | + }); |
| 83 | + div: any; |
| 84 | + page: any; |
| 85 | + viewport: any; |
| 86 | + zIndex: number; |
| 87 | + _annotationEditorUIManager: any; |
| 88 | + popupShow: any[] | undefined; |
| 89 | + hasEditableAnnotations(): boolean; |
| 90 | + /** |
| 91 | + * Render a new annotation layer with all annotation elements. |
| 92 | + * |
| 93 | + * @param {AnnotationLayerParameters} params |
| 94 | + * @memberof AnnotationLayer |
| 95 | + */ |
| 96 | + render(params: AnnotationLayerParameters): Promise<void>; |
| 97 | + /** |
| 98 | + * Update the annotation elements on existing annotation layer. |
| 99 | + * |
| 100 | + * @param {AnnotationLayerParameters} viewport |
| 101 | + * @memberof AnnotationLayer |
| 102 | + */ |
| 103 | + update({ viewport }: AnnotationLayerParameters): void; |
| 104 | + getEditableAnnotations(): any[]; |
| 105 | + getEditableAnnotation(id: any): any; |
| 106 | +} |
| 107 | +declare class FreeTextAnnotationElement extends AnnotationElement { |
| 108 | + constructor(parameters: any); |
| 109 | + textContent: any; |
| 110 | + textPosition: any; |
| 111 | + annotationEditorType: number; |
| 112 | + render(): HTMLElement | undefined; |
| 113 | +} |
| 114 | +declare class HighlightAnnotationElement extends AnnotationElement { |
| 115 | + constructor(parameters: any); |
| 116 | + annotationEditorType: number; |
| 117 | + render(): HTMLElement | undefined; |
| 118 | +} |
| 119 | +declare class InkAnnotationElement extends AnnotationElement { |
| 120 | + constructor(parameters: any); |
| 121 | + containerClassName: string; |
| 122 | + svgElementName: string; |
| 123 | + annotationEditorType: number; |
| 124 | + render(): HTMLElement | undefined; |
| 125 | + getElementsToTriggerPopup(): any[]; |
| 126 | +} |
| 127 | +declare class StampAnnotationElement extends AnnotationElement { |
| 128 | + constructor(parameters: any); |
| 129 | + annotationEditorType: number; |
| 130 | + render(): HTMLElement | undefined; |
| 131 | +} |
| 132 | +import { AnnotationStorage } from "./annotation_storage.js"; |
| 133 | +declare class AnnotationElement { |
| 134 | + static _hasPopupData({ titleObj, contentsObj, richText }: { |
| 135 | + titleObj: any; |
| 136 | + contentsObj: any; |
| 137 | + richText: any; |
| 138 | + }): boolean; |
| 139 | + constructor(parameters: any, { isRenderable, ignoreBorder, createQuadrilaterals, }?: { |
| 140 | + isRenderable?: boolean | undefined; |
| 141 | + ignoreBorder?: boolean | undefined; |
| 142 | + createQuadrilaterals?: boolean | undefined; |
| 143 | + }); |
| 144 | + isRenderable: boolean; |
| 145 | + data: any; |
| 146 | + layer: any; |
| 147 | + linkService: any; |
| 148 | + downloadManager: any; |
| 149 | + imageResourcesPath: any; |
| 150 | + renderForms: any; |
| 151 | + svgFactory: any; |
| 152 | + annotationStorage: any; |
| 153 | + enableScripting: any; |
| 154 | + hasJSActions: any; |
| 155 | + _fieldObjects: any; |
| 156 | + parent: any; |
| 157 | + container: HTMLElement | undefined; |
| 158 | + get _isEditable(): any; |
| 159 | + get hasPopupData(): boolean; |
| 160 | + updateEdited(params: any): void; |
| 161 | + resetEdited(): void; |
| 162 | + /** |
| 163 | + * Create an empty container for the annotation's HTML element. |
| 164 | + * |
| 165 | + * @private |
| 166 | + * @param {boolean} ignoreBorder |
| 167 | + * @memberof AnnotationElement |
| 168 | + * @returns {HTMLElement} A section element. |
| 169 | + */ |
| 170 | + private _createContainer; |
| 171 | + setRotation(angle: any, container?: HTMLElement | undefined): void; |
| 172 | + get _commonActions(): any; |
| 173 | + _dispatchEventFromSandbox(actions: any, jsEvent: any): void; |
| 174 | + _setDefaultPropertiesFromJS(element: any): void; |
| 175 | + /** |
| 176 | + * Create quadrilaterals from the annotation's quadpoints. |
| 177 | + * |
| 178 | + * @private |
| 179 | + * @memberof AnnotationElement |
| 180 | + */ |
| 181 | + private _createQuadrilaterals; |
| 182 | + /** |
| 183 | + * Create a popup for the annotation's HTML element. This is used for |
| 184 | + * annotations that do not have a Popup entry in the dictionary, but |
| 185 | + * are of a type that works with popups (such as Highlight annotations). |
| 186 | + * |
| 187 | + * @private |
| 188 | + * @memberof AnnotationElement |
| 189 | + */ |
| 190 | + private _createPopup; |
| 191 | + /** |
| 192 | + * Render the annotation's HTML element(s). |
| 193 | + * |
| 194 | + * @public |
| 195 | + * @memberof AnnotationElement |
| 196 | + */ |
| 197 | + public render(): void; |
| 198 | + /** |
| 199 | + * @private |
| 200 | + * @returns {Array} |
| 201 | + */ |
| 202 | + private _getElementsByName; |
| 203 | + show(): void; |
| 204 | + hide(): void; |
| 205 | + /** |
| 206 | + * Get the HTML element(s) which can trigger a popup when clicked or hovered. |
| 207 | + * |
| 208 | + * @public |
| 209 | + * @memberof AnnotationElement |
| 210 | + * @returns {Array<HTMLElement>|HTMLElement} An array of elements or an |
| 211 | + * element. |
| 212 | + */ |
| 213 | + public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement; |
| 214 | + addHighlightArea(): void; |
| 215 | + _editOnDoubleClick(): void; |
| 216 | +} |
0 commit comments