Search results

Highlight, Underline and Strikeout text programmatically

08 Dec 2021 / 1 minute to read

The PDF Viewer library allows you to highlight, underline and strikeout text in the loaded PDF document programmatically using the setAnnotationMode() method.

Step 1: Follow the steps provided in the link to create simple PDF Viewer sample.

Step 2: Add the following code snippet to highlight, underline, and strikeout text in the loaded document with button click events.

Copied to clipboard
    document.getElementById('setHighlight').addEventListener('click', ()=> {
    document.getElementById('setUnderline').addEventListener('click', ()=> {
    document.getElementById('setStrikeout').addEventListener('click', ()=> {
    document.getElementById('setNone').addEventListener('click', ()=> {

Find the Sample how to highlight, underline and strikeout text programmatically