How to change selection highlight color from "view" tool

Product: PDF WebViewer

Product Version: v11.1.0

In the docs, I easily found how to modify the annotation color.

const { documentViewer, Annotations } = instance.Core;

const highlightCreateTool = documentViewer.getTool('AnnotationCreateTextHighlight');
highlightCreateTool.defaults.StrokeColor = new Annotations.Color(236, 0, 0, .5);

But I didn’t find any reference about the default blue highlight when selecting text.

1 Like

Hello Paul,

You can use the setTextHighlightColor API to achieve this.
https://sdk.apryse.com/api/web/Core.DocumentViewer.html#setTextHighlightColor__anchor

This example changes the highlight to gray.

instance.Core.documentViewer.setTextHighlightColor('rgba(100, 100, 100, 0.3)');

Best Regards,
Darian

2 Likes