How to disable clicks or any mouse events on annotation

WebViewer Version: 8.9.0 (javascript)

I want to create highlight areas on a pdf from the viewer, which I managed to do by tweaking the PolygonAnnotation.

This allows me to draw shapes on my pdf like this:
image

However, the area remains hoverable and when you click on it, a rectangular area is drawn around the annotation (I don’t want that):
image

Can you explain me how to totally remove the mouse events on the annotation (click and hover included) or how to disable this area?

My code is the following:

documentViewer.addEventListener('documentLoaded', () => {

    const polygonAnnot = new Annotations.PolygonAnnotation();
    polygonAnnot.addPathPoint(100, 70);
    polygonAnnot.addPathPoint(300, 40);
    polygonAnnot.addPathPoint(310, 70);
    polygonAnnot.addPathPoint(110, 100);

    polygonAnnot.PageNumber = 1;

    // Styles
    polygonAnnot.Color = new Annotations.Color(251, 70, 85, 1);
    polygonAnnot.FillColor = new Annotations.Color(251, 70, 85, 0.4);
    polygonAnnot.Locked = true;
    polygonAnnot.IsHoverable = false;
    polygonAnnot.LockedContents = true;
    polygonAnnot.ReadOnly = true;

    // Remove click and editing events
    annotationManager.removeEventListener();
    annotationManager.disableFreeTextEditing();
    annotationManager.disableRedaction();
    annotationManager.disableDraggingAcrossPages();

    polygonAnnot.Author = annotationManager.getCurrentUser();

    annotationManager.addAnnotation(polygonAnnot);
    annotationManager.redrawAnnotation(polygonAnnot);
});

Regards :vulcan_salute:

Hello m.lafarie,

You can use annot.Listable = false; This will prevent it from being selected or hovered over while still seeing the annotation.

Does this work for you?

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron