Catch annotation click even and select annotation programatically

Which product are you using?
PDF.js Express Viewer or PDF.js Express Plus

PDF.js Express Version
8.7.4

Detailed description of issue
I am trying to select already drawn annotations programmatically with ID, I can pass the ID of annotation and based on it, that annotation need to be selected

Also when I select an annotation by clicking on it, I need to get the ID of it in my console

Expected behaviour
I need to be able to store the annotation ID, and pass it to select annoation. On click of annotation I need to catch the id and print on console

Does your issue happen with every document, or just one?
{Answer here}

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

Hello vren369

You can accomplish this by doing:

instance.Core.annotationManager.addEventListener('annotationsSelected', (annotations)=> {
 console.log(annotations[0].Id)
})

Let me know if this works for you.

Best regards,
Tyler