Setting the MinZoom property appeared to have no effect on iOS. When setting MinZoom="1.0" and FitPolicy="Width", documents were properly full-width on Android and could not be zoomed out any further than full-width, as intended. On iOS however, while the document loads correctly as full-width, I am able to zoom out infinitely. I solved the issue via the platform-specific workaround below using OnRendered(), but did I miss an easier cross-platform setting? Should the iOS handler in MauiNativePdfView wire MinZoom through to PDFKit's native PDFView.MinScaleFactor once it computes and sets the FitPolicy? As a side note, this package is amazing and we have completely eliminated our reliance on PDF.js in a WebView for open-source cross-platform PDF rendering in MAUI; bravo.
XAML
<pdf:PdfView x:Name="pdfView"
EnableZoom="True"
MinZoom="1.0"
EnableSwipe="True"
EnableLinkNavigation="True"
EnableAnnotationRendering="True"
DisplayMode="SinglePageContinuous"
ScrollOrientation="Vertical"
FitPolicy="Width"
PageSpacing="10"
DocumentLoaded="OnDocumentLoaded"
Rendered="OnRendered"
PageChanged="OnPageChanged"
Error="OnError" />
Code-behind workaround
private void OnRendered(object sender, EventArgs e)
{
#if IOS
// Rendered fires after FitPolicy.Width has been applied and layout is
// complete, so ScaleFactor here reliably reflects the fit-to-width scale.
if (pdfView.Handler?.PlatformView is PdfKit.PdfView nativePdfView)
{
nativePdfView.MinScaleFactor = nativePdfView.ScaleFactor;
}
#endif
}
Setting the
MinZoomproperty appeared to have no effect on iOS. When settingMinZoom="1.0"andFitPolicy="Width", documents were properly full-width on Android and could not be zoomed out any further than full-width, as intended. On iOS however, while the document loads correctly as full-width, I am able to zoom out infinitely. I solved the issue via the platform-specific workaround below usingOnRendered(), but did I miss an easier cross-platform setting? Should the iOS handler in MauiNativePdfView wireMinZoomthrough to PDFKit's nativePDFView.MinScaleFactoronce it computes and sets theFitPolicy? As a side note, this package is amazing and we have completely eliminated our reliance on PDF.js in a WebView for open-source cross-platform PDF rendering in MAUI; bravo.XAML
Code-behind workaround