Setting Page layout mode to Page by page looses fit to page setting
Using the Getting Started sample, It worked on the first page setting the display as effective.
x:Name="PdfViewer" ZoomFactor ="2" ZoomMode="FitToPage" PageLayoutMode="Single"
But when navigating past that with next page button the zoom setting goes to 100 percent instead of keeping the settings above.
Note this does not happen when in PageLayout continuous Mode is Selected. Setting are retained when scrolling.
How to write event handler on a page navigation with PageLayoutMode="Single" ZoomFactor ="2" ZoomMode="FitToPage" page by page using
NextPageButton_Clicked ?
PdfViewer.GoToNextPage();
Hi Russ,
To detect a page change, you can raise the PropertyChanged event and check if the PageNumber property has changed. Additionally, setting the ZoomMode to FitToPage is necessary to maintain this setting as the page changes.
This can be implemented using the following code snippet:
|
PdfViewer.PropertyChanged += PdfViewer_PropertyChanged; bool isFitToPageSingleLayout { get; set; } = false; private void PdfViewer_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if(e.PropertyName=="PageNumber") { if(PdfViewer.ZoomMode == Syncfusion.Maui.PdfViewer.ZoomMode.FitToPage && PdfViewer.PageLayoutMode == Syncfusion.Maui.PdfViewer.PageLayoutMode.Single) { isFitToPageSingleLayout = true; } } else if(e.PropertyName=="ZoomMode") { if (PdfViewer.PageLayoutMode == Syncfusion.Maui.PdfViewer.PageLayoutMode.Single && isFitToPageSingleLayout) { PdfViewer.ZoomMode = Syncfusion.Maui.PdfViewer.ZoomMode.FitToPage; } else if (PdfViewer.PageLayoutMode == Syncfusion.Maui.PdfViewer.PageLayoutMode.Continuous && isFitToPageSingleLayout) { isFitToPageSingleLayout = false; } } } |
We have attached the sample in the following link for reference,
https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewerExample1840648907
Regards,
Manoj Kumar
Thanks! That worked!
Thank you for your reply. I'm glad to hear that the issue you were experiencing has been resolved. We're marking this ticket as solved.
If you have any other questions or concerns, please don't hesitate to contact us.
- 3 Replies
- 2 Participants
-
RF Russ Fustino
- Aug 17, 2024 08:00 PM UTC
- Aug 20, 2024 06:37 AM UTC