Please give a brief summary of your issue:
I want to add freetext annotations programatically at the coordinates of the mouse point.
Please describe your issue and provide steps to reproduce it:
I have a special use case where the user can click a button to customise the freetext annotation before adding it to the pdf.
I want the annotation to appear where ever the mouse point is regardless the scroll distance of the document.
Or is there any way to add the annotations to the middle of the viewport (not the middle of the document)?
I wanted to change the cursor based on a state variable, and not while a tool is active.
I do not have any custom tools registered in the UI.
Also, I could not print the “data” object inside the event object of “mouseLeftDown” event. I can see the “data” object pinted in the console with multiple values in it, but when I try to access the properties of the “data” object, undefined is retuned.
mouseLeftdown event comes with the native event that you can access directly without going into the data object. This data object doesn’t exist in the context of the MouseEvent:
What I am trying to achieve is when I click the mouse left button a custom annotation should be added at the mouse coordinate.
I need the coordinates of the PDF page where the mouse button is clicked.
The other data in the event object are useless to me as they are not related any how to the page coordinates (used by the annotation’s X and Y properties)
got the mouse locations using the above function on documentViewer and the x, y coordinates are perfect for the X and Y properties of the annotation I wanted to add