Search results

Select a specific annotation in Vue PDF Viewer component

02 Feb 2023 / 1 minute to read

The PDF Viewer library allows you to select an annotation from a PDF document. Selecting an annotation can be done using the selectAnnotation() method. This method is used to select an annotation using its id.

The following steps are used to select an annotation from a PDF Document.

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

Step 2: The following code sample represents how to select an annotation in a button click.

Copied to clipboard
<button id="selectAnnotation">SelectAnnotation</button>

<script>
    //Event triggers when you click the SelectAnnotation button.
    document.getElementById('selectAnnotation').addEventListener('click', () => {
        //API to select the annotation
        viewer.annotationModule.selectAnnotation(viewer.annotationCollection[0].annotationId);
    });
</script>

View sample in GitHub