|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Magnifying PDF documents in WinForms Pdf Viewer control | Syncfusion<sup>®</sup>; |
| 4 | +description: Learn about Magnifying PDF documents support in Syncfusion<sup>®</sup>;WinForms Pdf Viewer control, its elements and more. |
| 5 | +platform: WinForms |
| 6 | +control: PDF Viewer |
| 7 | +documentation: ug |
| 8 | +--- |
| 9 | + |
| 10 | +# Adjust the magnification of PDF documents using the WinForms PDF Viewer |
| 11 | + |
| 12 | +The WinForms PDF Viewer has predefined set of zoom tools in the built-in toolbar, that allows you to change magnifications of the PDF document that is being displayed. |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +1. **Combo box**: It allows you to select a zoom percentage from the pre-defined set of values listed in the dropdown. Since it is editable, you can also provide your zoom values by double editing the text area. |
| 17 | +2. **Zoom out button**: It allows you to reduce the zoom value by 25% from the current zoom percentage. |
| 18 | +3. **Zoom in button**: It allows you to increase the zoom value by 25% from the current zoom percentage. |
| 19 | +4. **Fit to width button**: It allows you to fit the document to the width of the control. |
| 20 | +5. **Fit to page button**: It allows you to fit a whole page in the window and to view only one page at a time. |
| 21 | + |
| 22 | +### Magnify the document to a given zoom percentage |
| 23 | + |
| 24 | +You can magnify the document to a given zoom percentage by using the [ZoomTo](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_Forms_PdfViewer_PdfViewerControl_ZoomTo_System_Int32_) function of the PDF Viewer. Refer to the following code sample to apply the specific zoom percentage based on the page contents. |
| 25 | + |
| 26 | +{% tabs %} |
| 27 | +{% highlight c# %} |
| 28 | +//Zoom to 235 percentage. |
| 29 | +pdfViewer.ZoomTo(235); |
| 30 | +{% endhighlight %} |
| 31 | +{% endtabs %} |
| 32 | + |
| 33 | +The [ZoomPercentage](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_Forms_PdfViewer_PdfViewerControl_ZoomPercentage) property can be used to get the control's current zoom percentage. |
| 34 | + |
| 35 | +{% tabs %} |
| 36 | +{% highlight c# %} |
| 37 | +//Get the current zoom percentage. |
| 38 | +int currentZoomPercentage = pdfViewer.ZoomPercentage; |
| 39 | +{% endhighlight %} |
| 40 | +{% endtabs %} |
| 41 | + |
| 42 | +## Zoom modes |
| 43 | + |
| 44 | +As stated above, the PDF Viewer supports the fit to page and fit to width zoom modes. You can change the zoom mode, using the [ZoomMode](https://help.syncfusion.com/cr/windowsforms/Syncfusion.Windows.Forms.PdfViewer.PdfViewerControl.html#Syncfusion_Windows_Forms_PdfViewer_PdfViewerControl_ZoomMode) property of the PDF Viewer. Refer to the following code sample to change the zoom mode. |
| 45 | + |
| 46 | +{% tabs %} |
| 47 | +{% highlight c# %} |
| 48 | +//To apply fit-to-page zoom mode. |
| 49 | +pdfViewer.ZoomMode = ZoomMode.FitPage; |
| 50 | +// To apply fit-to-width zoom mode. |
| 51 | +pdfViewer.ZoomMode = ZoomMode.FitWidth; |
| 52 | +{% endhighlight %} |
| 53 | +{% endtabs %} |
| 54 | + |
| 55 | +## Mouse and keyboard shortcuts |
| 56 | + |
| 57 | +**Ctrl (key) + Scroll the mouse wheel up** - To perform zoom in. |
| 58 | +**Ctrl (key) + Scroll the mouse wheel down** - To perform zoom out. |
0 commit comments