ZoomPercentage

Good day,
I am using sfpdfviewer in aXamarin Forms MVVM Prism environment and trying to set the zoompercentage using a property in the viewmodel.

xaml:
ZoomPercentage="{Binding PdfZoom}"

viewmodel:
double _PdFZoom = 300.0;
public double PdFZoom
{
get { return _PdFZoom; }
set { SetProperty(ref _PdFZoom, value); }
}

The zoom is kept at 100%.

The idea is to control the zoom property using two button controls eg zoom in  and zoom out.

Do you have a suggestion?

Warm regards

Ian

ps if I may add another question?
How to pan left/right etc using either code behind or mvvm pattern?

7 Replies

JP Jhansi Priya Ramesh Syncfusion Team March 6, 2020 07:33 PM UTC

Hi Ian, 
 
Greetings from syncfusion support. 
 
Please find the details for your queries from below 
 
S.No 
Query 
Details 
1 
The idea is to control the zoom property using two button controls eg zoom in  and zoom out. 
 
Do you have a suggestion? 
 
 We have created a simple sample to update ZoomPercentage values using button controls. Please find the sample from the below link, 
 
 
Kindly try the above solution and please let us know if any further assistance required. 
 
 
2 
How to pan left/right etc using either code behind or mvvm pattern? 
Could you please explain the use case for your requirement to pan the pages through code behind? It will be helpful for us to understand your requirement clearly and provide you a better solution.  
 
  
  
Regards, 
Jhansi Priya Ramesh 



IA Ian March 7, 2020 06:35 AM UTC

Pan function on pdf document:

When zoomed into a pdf document, I wish to enable the user to pan up/down/left/right in the zoomed document.
This must be achieved in a hands-free environment where pan commands are provided programmatically.

In this case a mvvm solution is first price with code behind second.

Warm regards

Ian


JP Jhansi Priya Ramesh Syncfusion Team March 9, 2020 12:05 PM UTC

Hi Ian, 

Thank you for the details. The panning of pages while zooming the document could be achieved by changing the “HorizontalOffset” and “VerticalOffset” values of PdfViewer. Kindly refer the below documentation for further details 


We have created a sample to update the offset values using button controls. Please find the sample from the below link 


Kindly try the above solution and please let us know if any further assistance required. 

Regards, 
Jhansi Priya Ramesh 



IA Ian March 10, 2020 01:36 PM UTC

Good day,

Thank you for the sample and link.

I am using the Prism navigation service which requires a INavigationService parameter in the constructor.
The sample provided requires a parameter-less constructor which is in conflict with the above.

In the sample mainpage.xml the binding ZoomPercentage="{Binding PdFZoom}" is used.
In the PdfViewerViewModel,  PdFZoom is declared as a property but not used further - Is this intended?

From the sample it seems that ZoomPercentage is not bindable to a ViewModel in the same way as InputFileStream is bindable.
The same goes for:
               HorizontalOffset="{Binding HOffset}"
               VerticalOffset="{Binding VOffset}"



Warm regards

Ian



JP Jhansi Priya Ramesh Syncfusion Team March 11, 2020 11:15 AM UTC

Hi Ian, 
 
Please find the details for your queries from below   
S.No   
Query   
Details   
1   
I am using the Prism navigation service which requires an INavigationService parameter in the constructor.   
The sample provided requires a parameterless constructor which conflicts with the above.   
   
In the sample mainpage.xml the binding ZoomPercentage="{Binding PdFZoom}" is used.   
In the PdfViewerViewModel,  PdFZoom is declared as property but not used further - Is this intended?   
   
Based on the details provided by you on 6th March, we assumed that you are using the binding of “ZoomPercentage” while launching the PdfViewer to control the Zoom value. We added the code for the same purpose in the sample.    
   
Note: The Zoom percentage value will be reflected properly while launching the PdfViewer.   
2   
From the sample, it seems that ZoomPercentage is not bindable to a ViewModel in the same way as InputFileStream is bindable.   
The same goes for:   
               HorizontalOffset="{Binding HOffset}"
               VerticalOffset="{Binding VOffset}"
   
   
We were able to reproduce the issue “Zoom Percentage and offset values are not changing dynamically while binding using MVVM” in our side and suspect this to be a defect. We are currently validating the issue and we will update further details on 13th March 2020.   
  
 
Regards, 
Jhansi Priya Ramesh 



JP Jhansi Priya Ramesh Syncfusion Team March 13, 2020 03:26 PM UTC

Hi Ian, 
 
We confirm that the issue “ZoomPercentage and offset values are not changing dynamically while binding using MVVM” is a bug in our side and we will provide patch for this issue on 3rd April 2020. 
 
Regards, 
Jhansi Priya Ramesh 



GR Gayathri Ramalingam Syncfusion Team April 3, 2020 04:51 PM UTC

Hi Ian 
  
The issue with “ZoomPercentage and offset values are not changing dynamically while binding using MVVM” has been fixed and the custom NuGet for the same can be downloaded from the following link.  
  
We have modified the sample and please find it from below, 
 
      
Custom NuGet:   
 
 
Disclaimer:   
Please note that we have created this NuGet for version 18.1.0.42 specifically to resolve the following issue(s) reported in this/the Forum 152202.   
 
      
Note: Kindly follow the steps to clear the NuGet cache and then install patched NuGet to get the issue resolved.    
     
        
This fix will be included in our 2020 Vol 1 Service Pack Release which will be available in May 2020.     
  
  
Regards, 
Gayathri R 



Loader.
Up arrow icon