ConvScreenPtToPagePt not always accurate

Product: PDFTron.UWP

Product Version: 9.1.0.78544

Please give a brief summary of your issue:
PDFViewCtrl.ConvScreenPtToPagePt sometimes shifts the input point a few pixels depending on the view’s zoom level and scroll

Please describe your issue and provide steps to reproduce it:
I’m using PDFTron to create an inking app, but it seems that when I convert the pen’s ink points in screen space to page space with PDFViewCtrl.ConvScreenPtToPagePt, the points are sometimes shifted by a couple pixels. The direction they are shifted in and how far depends on the zoom level and current scroll amount. In the photo below, the red is an ink stroke as it appears rendered by Windows and the blue is the corresponding Ink annotation created by converting points to page space. This was when scrolled to the top left corner at 300% zoom. The scaling is right, but the position is offset.

image

Please provide a link to a minimal sample where the issue is reproducible:
MinimalInk/MainPage.xaml.cs at master · jlynch630/MinimalInk (github.com)

Is there any way to increase the accuracy of the coordinate transformation process?
Thanks!

Hello,

The main reason for the offset is that we have some internal scaling adjustments performed to match zoom levels and screen resolution, and also an internal ScrollViewer that needs to be considered.
Right now we have an internal native Canvas control which we use to draw using Ink annotation.

Canvas annotCanvas = PDFViewCtrl.GetAnnotationCanvas(); // Get internal Canvas to draw on it

PDFViewCtrl.ConvAnnotationCanvasPtToScreenPt(xPos, yPos); // Convert Canvas pt to Screen pts
PDFViewCtrl.ConvScreenPtToPagePt(xPos, yPos, pageNumber); // convert Screen pts to Page pts

We have InkCanvas on our roadmap and are currently working on it to be integrated in our PDFViewCtrl in a future release, so it can be used the same way as Canvas.

Would Canvas work for your implementation for now?

Thank you