Add annotations, shapes, text to mouse position in image preview

I am currently working on adding annotations (text, shapes,lines,arrow, images etc) to pdf.
How to position the location of the annotations in relation to the position of the mouse (by user).
More over, if the reference image is zoomed, how to relate the zoom factor?

Hi Jason,

I presume that you’re displaying your PDF as an image, is that correct?
In that case, how are you retrieving the mouse position?

Regards,
Mario

Hi Mario,

Yes, the PDF is displayed as PDF. I am currently working on the retrieval of mouse position.

Let me know when you managed that part.

Depending on what coordinates you retrieve, mapping them to PDF coordinates could be challenging. You see, in PDF, the coordinates are in points, and the origin (0, 0) is at the bottom left corner of the PDF page: