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.
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
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.
Thanks Vasugi that helps. The methods you mentioned work fine.
Regards,
Dennis
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.
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.
Regards,
Vasugi.
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
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:
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