Is it possible to get the middle point of the current viewer coordinates for a PDF Pages.
For example, when the user clicks something in a custom sidebar, I would like to add an annotation to the middle of their viewport.
Right now I can get the current page they are on but I am adding the annotation to 0,0 and letting them drag it to the proper location.
Thank you for the response.
When I try and call that method it seems to return a value only sometimes, where most of the times it returns null. I am on the latest version of PDFExpress, and if I call console.log(instance.docViewer) I can see its initialized as I can get the current page.
The top is logging the docViewer itself, the middle is the current page number called by docViewer.getCurrentPage() and the buttom is logging the docViewer.getExactViewportRegionRect()
I can see this is something that was just added in the new version. Let me know if there is anything I can do to test / get this working.
Yeah that is the expected behaviour for that API actually - it only returns something if there is a viewport - AKA the full page isn’t rendered (I didn’t realize this when I wrote that snippet)
I’m working on a better code snippet for you - hold tight. This is a bit harder problem to solve than I thought.