Hello,
I am working on a project where the goal is for a user to select items associated with a PDF from an external control, and then an area of the PDF related to the selection is highlighted. Then, the area is zoomed & scrolled to so the user can see the highlight in the SfPdfViewer.
I have been able to add the highlights correctly with Annotations, however scrolling to the rectangular area & zooming into it has proven more difficult. I can scroll correctly while not zoomed in, but doing it while zoomed has not worked right.
After zooming in, I have tried both using ScrollToOffset() and setting the horizontal & vertical offsets manually, however both often do not scroll to the correct area and with visually inconsistent results (the same coordinates will scroll differently depending on the previous scroll position).
Is there a better way to zoom & scroll to a rectangular area?
Thank you,
Caroline
Thank you for the sample & reply, I have modified it to best replicate the issue.
1) I have modified the behavior of the "scroll to offset" button: in the modified sample's MainPage.xaml.cs, this button will randomly generate a red rectangle annotation on the first page of the PDF. Then, the pdfViewerControl will change its ZoomPercentage to a value that will allow the whole annotation to be viewed close up. Finally, it scrolls to the x,y coordinates of the annotation using ScrollToOffset() - this is the part that is not working correctly for me. The goal is for the entire annotation to be visible in the viewer, however the result is that most of the time, the annotation is either not visible at all or only partially visible, and I have to scroll manually with a swipe to bring it fully into view.
2) I have attached a .zip containing both a video, and the modified sample. The video is called "AnnotationScrollingProblem.mp4"
3) To decrease file size, I changed the GIS Succinctly.pdf to the 2020 IRS 1040 fillable form, but the behavior is consistent on both. It is included as an embedded resource in the Assets folder
4) I am using the .Android project, testing on a Samsung Galaxy Note 20 Ultra running Android 11.0 & a Google Pixel 3a emulator running Android 8.1.
5) SfPdfViewer is (I believe) 19.3.0.56
6) Xamarin.Forms version is 5.0.0.2244
Best,
Caroline
Thank you for looking into this, I appreciate your work & consistent updates. I look forward to Jan 6th.
Hi Caroline,
We sincerely regret the inconvenience caused,
We are still working on the issue “Programmatical
scrolling is not working properly after zoom in” due to the complexity.
We will provide the patch for the fix on 20th January 2022
without any further delay.
Regards,
Vikram