Select annotation in Vue Pdfviewer component
16 Mar 20231 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.
<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>