react-pdf-highlighter-plus

The props type for DrawingHighlight.

interface DrawingHighlightProps {
    bounds?: string | Element;
    deleteIcon?: ReactNode;
    dragIcon?: ReactNode;
    highlight: ViewportHighlight;
    isScrolledTo?: boolean;
    style?: CSSProperties;
    onChange?(rect): void;
    onContextMenu?(event): void;
    onDelete?(): void;
    onEditEnd?(): void;
    onEditStart?(): void;
    onStyleChange?(newImage, newStrokes): void;
}

Properties

bounds?: string | Element

react-rnd bounds on the highlight area.

deleteIcon?: ReactNode

Custom delete icon. Replaces the default trash icon.

dragIcon?: ReactNode

Custom drag icon. Replaces the default 6-dot grid icon.

The highlight to be rendered as a DrawingHighlight. The highlight.content.image should contain the drawing as a PNG data URL.

isScrolledTo?: boolean

Has the highlight been auto-scrolled into view?

style?: CSSProperties

Custom styling for the container.

Methods

  • A callback triggered whenever the highlight position or size changes.

    Parameters

    • rect: LTWHP

      The updated highlight area.

    Returns void

  • A callback triggered on context menu.

    Parameters

    • event: MouseEvent<HTMLDivElement, MouseEvent>

    Returns void

  • Callback when drawing style changes (color or stroke width). The newImage is the re-rendered PNG data URL with updated styles. The newStrokes contain the updated stroke data.

    Parameters

    Returns void