PDF Viewer zoom troubles

I am trying to zoom using code.

In the following cases GetZoomPercentageAsync returns 0 every time but should return a non 0 value.

How does one fit to width or fit to page?

In the following examples

PdfViewer.ZoomMode = ZoomMode.FitToWidth;

and

PdfViewer.ZoomMode = ZoomMode.FitToPage;

do nothing but ZoomAzync does work.

Snippet
public async void ZoomPercent(int value)
{
    int zoomFeedback = await PdfViewer.GetZoomPercentageAsync();
    PdfViewer.ZoomMode = ZoomMode.Default;
    await PdfViewer.ZoomAsync(value);
    zoomFeedback = await PdfViewer.GetZoomPercentageAsync();
}
 
public async void ZoomFitWidth()
{
    int zoomFeedback = await PdfViewer.GetZoomPercentageAsync();
    PdfViewer.ZoomMode = ZoomMode.FitToWidth;
    zoomFeedback = await PdfViewer.GetZoomPercentageAsync();
}
 
public async void ZoomFitPage()
{
    int zoomFeedback = await PdfViewer.GetZoomPercentageAsync();
    PdfViewer.ZoomMode = ZoomMode.FitToPage;
    zoomFeedback = await PdfViewer.GetZoomPercentageAsync();
}

Syncfusion.Blazor.PdfViewerServer.Windows

20.1.0.51


6 Replies 1 reply marked as answer

VS Vasugi Sivajothi Syncfusion Team May 2, 2022 11:04 AM UTC

Hi Dennis,


We were able to reproduce the reported issue “GetZoomPercentageAsync returns 0 with the provided details. We will analyze further on this and update you with more details on May 5, 2022. However, you can get the zoom value using the ZoomValue property. And you can zoom into the fiToWidth and fitToPage mode programmatically using the FitToWidthAsync() and FitToPageAsync() method. Please refer to the below code snippet and sample.


Code Snippet:

 

 

int zoomValue = PdfViewer.ZoomValue;

 

await PdfViewer.FitToWidthAsync();

await PdfViewer.FitToPageAsync();

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorServer-195769424


Kindly try this and let us know if this helps you.


Regards,

Vasugi.



Marked as answer

DM Dennis M May 3, 2022 11:32 PM UTC

Thanks Vasugi that helps. The methods you mentioned work fine.


Regards,

Dennis



VS Vasugi Sivajothi Syncfusion Team May 4, 2022 06:07 AM UTC

Hi Dennis,


Thank you for the update. As we mentioned earlier, we were able to reproduce the reported issue “GetZoomPercentageAsync returns 0 with the provided details. We will analyze further on this and update you with more details on May 5, 2022. 


Regards,

Vasugi.



VS Vasugi Sivajothi Syncfusion Team May 5, 2022 04:44 PM UTC

Hi Dennis,


We have confirmed that the reported issue is a defect and logged the defect report for the same. The fix for this issue will be included in our upcoming weekly NuGet release on May 25, 2022. You can track the status using the below feedback link.


https://www.syncfusion.com/feedback/34662/unable-to-get-the-proper-zoom-value-using-the-getzoompercentage-method


Regards,

Vasugi.




SK Shamini Kiruba Sobers Syncfusion Team May 25, 2022 02:57 PM UTC

Hi Dennis,


Sorry for the inconvenience. The fix was not included in our latest weekly NuGet release. However, we will include the fix in our upcoming weekly NuGet release without further delay on June 1, 2022.


Regards,

Shamini



SK Shamini Kiruba Sobers Syncfusion Team June 1, 2022 02:27 PM UTC

Hi Dennis,


We have fixed the reported issue and the fix for the reported issue was included in our latest weekly release v20.1.0.58. Kindly upgrade to that version to get the issue resolved.

   

Packages:   

   

Service side package

ASP.NET Core :      

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows/ 
https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux/       

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.OSX/      

       

ASP.NET MVC:      

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Mvc5/      

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Mvc4/


CDN: http://cdn.syncfusion.com/ej2/20.1.58/dist/ej2.min.js
   

https://cdn.syncfusion.com/ej2/20.1.58/material.css


Regards,

Shamini


Loader.
Up arrow icon