UNPKG

pdf-annotator-react

Version:
99 lines (98 loc) 2.62 kB
export type Point = { x: number; y: number; }; export type AnnotationRect = { x: number; y: number; width: number; height: number; pageIndex: number; }; export declare enum AnnotationType { HIGHLIGHT = "highlight", UNDERLINE = "underline", STRIKEOUT = "strikeout", RECTANGLE = "rectangle", DRAWING = "drawing", HIGHLIGHTING = "highlighting", TEXT = "text", COMMENT = "comment", PIN = "pin" } export interface Annotation { id: string; type: AnnotationType; rect: AnnotationRect; pageIndex: number; color: string; content: string; points?: Point[]; tags?: TagInterface[]; createdAt: Date; updatedAt?: Date; category?: CategoryItem; thickness?: number; } export type AnnotationEventCallbacks = { onAnnotationCreate?: (annotation: Annotation) => void; onAnnotationUpdate?: (annotation: Annotation) => void; onAnnotationDelete?: (annotationId: string) => void; onAnnotationSelect?: (annotation: Annotation | null) => void; }; export declare enum AnnotationMode { NONE = "none", HIGHLIGHT = "highlight", UNDERLINE = "underline", STRIKEOUT = "strikeout", RECTANGLE = "rectangle", DRAWING = "drawing", HIGHLIGHTING = "highlighting", TEXT = "text", COMMENT = "comment", PIN = "pin" } export type PDFAnnotatorProps = { url: string; annotations?: Annotation[]; scale?: number; pageNumber?: number; onDocumentLoadSuccess?: (numPages: number) => void; onPageChange?: (pageNumber: number) => void; annotationMode?: AnnotationMode; onAnnotationModeChange?: (mode: AnnotationMode) => void; currentCategory?: CategoryItem; onCategoryChange?: (category: CategoryItem | undefined) => void; onAnnotationsChange?: (annotations: Annotation[]) => void; customCategories?: CustomCategory[]; highlightColor?: string; underlineColor?: string; strikeoutColor?: string; rectangleColor?: string; drawingColor?: string; textColor?: string; commentColor?: string; pinColor?: string; highlightingColor?: string; pdfWorkerSrc?: string; fitToWidth?: boolean; defaultThickness?: number; viewOnly?: boolean; } & AnnotationEventCallbacks; export interface CustomCategory { competencia: CategoryItem; tagsCompetencia: TagInterface[]; } export interface TagInterface { _id?: string; tag: string; tipo: string; } export interface CategoryItem { _id?: string; category: number; displayName: string; color: string; createdAt?: Date; updatedAt?: Date; }