UWP: how to get the document point user is looking at (center of view)

Hello there,

I'm currently evaluating PDFTron library for our UWP application. We are showing an additional layer above PDFViewCtrl and this layer needs to know what's the exact position (x,y) on the document that the user is viewing. Is there a way to get it from PDFViewCtrl? Maybe there's a method to get the Rect which is currently showed to the user?

I tried using HScroll and VScroll for it. thought that I can get the x value like this: (pseudocode):

var x = (HScroll / zoom) + ((DocumentWidth / 2) / zoom)

, but it fails to get correct results.

If anyone has any idea, I'd be grateful for your help.

Regards,
Michał

You can use PDFViewCtrl.GetAnnotationCanvas to get a Canvas that you can put objects onto.

There are also some associated methods for getting the scroll positions of this canvas, in particular PDFViewCtrl.GetAnnotationCanvasHorizontalOffset

Instead of using your own layer, most likely you can reuse the annotation canvas for your task.

If not, please elaborate on what you are trying to accomplish (screen shots help a lot)