Search results

Display custom tooltip for annotations using MouseOver event in JavaScript (ES5) PDF Viewer control

02 Feb 2023 / 1 minute to read

To display a custom tooltip for annotations using the mouseover event in the Syncfusion PDF Viewer, you can use the annotationMouseOver and annotationMouseLeave events .

Here is an example that demonstrates how to display a custom tooltip for annotations using the mouseover event in the Syncfusion PDF Viewer:

Copied to clipboard
viewer.annotationSettings.author = "syncfusion";
var tooltip = new ej.popups.Tooltip({
    mouseTrail: true,
    opensOn: "Custom"
});
viewer.annotationMouseOver = function(args) {
    tooltip.appendTo("#pdfViewer_pageDiv_" + (viewer.currentPageNumber - 1));
    tooltip.content = args.annotation.author;
    tooltip.open();
    var ele = document.getElementsByClassName("e-tooltip-wrap")[0];
    ele.style.top = args.Y + 100 + "px";
    ele.style.left = args.X + "px";
};
viewer.annotationMouseLeave = function(args) {
    tooltip.close();
};

Find the Sample how to display custom tooltip for annotations using MouseOver event