I'm writing to ask if there is a function in the API to allow me to get the current X and Y position within the PDF.
More specifically, I'm integrating the PDF Embed API into my project, and I would like to add programmatic scrolling. That is, I would like to have a custom keybind in my application that, when pressed, will scroll the PDF up or down by a certain amount.
I've seen that scrolling is possible using the gotoLocation() method exposed by the API, which takes not only a page number, but also an X and Y coordinate.
This is great, but unfortunately, there's no easy way to increment the Y coordinate, because I can't find a way to get the current Y coordinate of the PDF/page.
One would think using the “SCROLLED” event would be possible, but there are two problems. Firstly, this event returns the scrollTop value, which is in viewport pixels, and hence does not give me the value I need to pass to gotoLocation(). Secondly, using an event would not be reliable in the first place, since I cannot be sure the event is called every single time the position is changed in some way — perhaps the position can change in other situations than a normal scroll.
I would appreciate any help in solving this problem!