UNPKG

@syncfusion/ej2-pdfviewer

Version:
232 lines (231 loc) 7.67 kB
import { InkAnnotationSettings } from './../pdfviewer'; import { AllowedInteraction, IAnnotation, IPoint, PdfViewer } from '../index'; import { PdfViewerBase } from '../index'; import { AnnotationSelectorSettingsModel } from '../pdfviewer-model'; import { PointModel } from './../ej2-drawings/index'; /** * @hidden */ export interface IInkAnnotation extends IAnnotation { id: string; bounds: any; pageIndex: number; data: string; customData: object; thickness: number; notes: string; isPrint: boolean; allowedInteractions: AllowedInteraction[]; isLocked?: boolean; initialZoom?: number; } export declare class InkAnnotation { private pdfViewer; private pdfViewerBase; newObject: any; /** * @private */ outputString: string; /** * @private */ mouseX: number; /** * @private */ mouseY: number; /** * @private */ inkAnnotationindex: any; /** * @private */ isAddAnnotationProgramatically: boolean; /** * @private */ currentPageNumber: string; /** * @private */ inkAnnotationInitialZoom: number; /** * @private */ inkPathDataCollection: IInkPathDataCollection[]; /** * @private */ eraserPath: PointModel[]; /** * @private */ eraserPreviewPageIndex: number; constructor(pdfViewer: PdfViewer, pdfViewerBase: PdfViewerBase); /** * @private * @returns {void} */ drawInk(): void; drawInkAnnotation(pageNumber?: number): void; /** * @private * @returns {any} - any */ updateInkDataWithZoom(): string; private updatePathDataWithZoom; /** * @private * @returns {void} */ storePathData(): void; /** * @param {any} position - It describes about the position of the annotation * @param {number} pageIndex - It describes about the page index value * @private * @returns {void} */ drawInkInCanvas(position: any, pageIndex: number): void; /** * @param {any} position - It describes about the position of the annotation * @private * @returns {void} */ addEraserPath(position: any): void; /** * Draws a temporary preview stroke during eraser movement. * Shows a black semi-transparent line that follows the cursor. * @param {number} pageIndex - The page on which the preview should be drawn * @param {number} eraserSize - The diameter of the eraser * @private * @returns {void} */ drawEraserPreview(pageIndex: number, eraserSize: number): void; private convertToPath; private linePath; private movePath; /** * @param {number} pageNumber - It describes about the page number * @private * @returns {any} - any */ addInk(pageNumber?: number): any; /** * @private * @returns {void} */ setAnnotationMode(): void; saveInkSignature(): string; /** * @param {number} pageNumber - It describes about the page number value * @param {any} annotationBase - It describes about the annotation base * @private * @returns {void} */ addInCollection(pageNumber: number, annotationBase: any): void; /** * @private * @param {string} data - data * @returns {any} - points */ calculateInkSize(data: string): any; /** * @param {any} annotationCollection - It describes about the annotation collection * @param {number} pageIndex - page index value * @param {boolean} isImport - It ensures whether the isImport is true or not * @param {boolean} isAnnotOrderAction - It ensures whether the isAnnotOrderAction is true or not * @param {boolean} isLastAnnot - It ensures whether the isLastAnnot is true or not * @private * @returns {void} */ renderExistingInkSignature(annotationCollection: any, pageIndex: number, isImport: boolean, isAnnotOrderAction?: boolean, isLastAnnot?: boolean): void; /** * @param {any} annotation - This is annotation * @param {number} pageNumber - This is page number * @private * @returns {void} */ saveImportedInkAnnotation(annotation: any, pageNumber: number): void; private getSettings; /** * @param {number} pageNumber - It describes about the page number value * @param {any} annotations - It describes about the annotations * @private * @returns {void} */ storeInkSignatureData(pageNumber: number, annotations: any): void; getSelector(type: string, subject: string): AnnotationSelectorSettingsModel; private getAnnotations; /** * @param {string} property - It describes about the property * @param {number} pageNumber - It describes about the page number * @param {any} annotationBase - It is about the annotation base * @private * @returns {any} - any */ modifySignatureInkCollection(property: string, pageNumber: number, annotationBase: any): any; private manageInkAnnotations; /** * Processes ink erasing using geometry-based midpoint detection (reference sample logic). * Converts SVG path to point arrays, fragments based on eraser geometry, converts back to SVG. * @param {any} inkAnnotation - The ink annotation to erase from * @param {PointModel[]} eraserPath - Array of eraser positions during drag * @param {number} eraserSize - Diameter of eraser * @returns {string} - Fragmented path data string with M commands separating fragments * @private */ private processInkErase; /** * Applies erasing by updating the original annotation with fragmented path. * The annotation remains a single annotation with the modified path containing erased gaps. * @param {any} originalAnnotation - The annotation being erased * @param {string} pathData - Erased path data (output from processInkErase) * @param {number} pageIndex - Page containing the annotation * @private * @returns {void} */ private applyInkErase; /** * Restores ink annotation pathData from a snapshot (for undo/redo). * Updates both the annotation collection and the SVG wrapper element. * @param {any} annotationSnapshot - Snapshot with id, data, bounds * @param {number} pageIndex - Page containing the annotation * @private * @returns {void} */ restoreInkPathData(annotationSnapshot: any, pageIndex: number): void; /** * @private * @returns {void} */ destroy(): void; /** * @param {any} currentAnnotation - It describes about the current annotation * @param {number} pageIndex - It describes about the page index value * @param {boolean} isImport - It ensures whether the isImport is true or not * @private * @returns {any} - any */ updateInkCollections(currentAnnotation: any, pageIndex: number, isImport?: boolean): any; /** * This method used to add annotations with using program. * * @param {InkAnnotationSettings} annotationObject - It describes type of annotation object * @param {IPoint} offset - It describes about the annotation bounds or location * @param {number} pageNumber - It describes about the annotation page number * @returns {object} - onject * @private */ updateAddAnnotationDetails(annotationObject: InkAnnotationSettings, offset: IPoint, pageNumber: number): Object; } /** * Defines the FormFields Bound properties * * @hidden */ export interface IInkPathDataCollection { pathData: any; zoomFactor: number; }