Magnification .NET MAUI PDF Viewer (SfPdfViewer)
19 Aug 20253 minutes to read
The SfPdfViewer control supports intuitive magnification features, allowing users to zoom in and out of PDF content using gestures or programmatic controls.
Adjusting the Zoom Factor
You can control the zoom level using the ZoomFactor property. Refer to the following code example.
<syncfusion:SfPdfViewer x:Name="PdfViewer" DocumentSource="{Binding PdfDocumentStream}" ZoomFactor ="3" />
PdfViewer.ZoomFactor = 3;
You can also retrieve the current zoom level using the same property.
Setting Minimum and Maximum Zoom Limits
By default, the zoom range varies by platform:
- Mobile (Android/iOS): 1.0 to 4.0
- Desktop (Windows/macOS): 0.25 to 4.0
To restrict zoom levels, use the MinZoomFactor and MaxZoomFactor properties.
The following code example explains restricting the zoom factor between 0.5 and 2.
<syncfusion:SfPdfViewer x:Name="PdfViewer" DocumentSource="{Binding PdfDocumentStream}" MinZoomFactor = “0.5” MaxZoomFactor ="2" />
PdfViewer.MinZoomFactor = 0.5;
PdfViewer.MaxZoomFactor = 2;
NOTE
If the ZoomFactor is set outside the defined MinZoomFactor and MaxZoomFactor range, it will be ignored.
You can download a sample project demonstrating magnification features here.
Zoom Modes
The PDF Viewer supports the following zoom modes via the ZoomMode property:
- Fit to Page – Displays the entire page within the viewport.
- Fit to Width – Expands the page to fill the width of the viewer.
The default value is ZoomMode.Default
Zoom Mode via Built-In Toolbar
Desktop Toolbar
The built-in toolbar includes a magnification dropdown showing the current zoom percentage. Users can select predefined zoom levels or choose Fit to Page / Fit to Width.
Mobile Toolbar
On mobile, the magnification tool appears only after the zoom factor changes. Users can then select Fit to Page or Fit to Width. Once selected, the icon disappears until the zoom factor changes again.
Programmatically Setting Zoom Mode
Fit to Page
You can change the SfPdfViewer.ZoomMode using the ZoomMode.FitToPage enumeration. It will magnify the PDF document so that the entire PDF page is visible in the view port.
Refer to the following code example:
<Syncfusion:PdfViewer x:Name="pdfViewer" ZoomMode="FitToPage"/>
// To apply fit-to-page zoom mode.
pdfViewer.ZoomMode = ZoomMode.FitToPage;
Fit to Width
You can change the SfPdfViewer.ZoomMode using the ZoomMode.FitToWidth enumeration. It will magnify the PDF document so that the widest page of the PDF document fits the width of the view port.
Refer to the following code example:
<Syncfusion:PdfViewer x:Name="pdfViewer" ZoomMode="FitToWidth"/>
// To apply fit-to-page zoom mode.
pdfViewer.ZoomMode = ZoomMode.FitToWidth;
NOTE
When the
ZoomFactor
is manually changed, theZoomMode
resets toDefault
. You can reapply the desired zoom mode afterward.