Category / Section
How to add fitpage and fitwidth functionalities while using Custom Toolbar?
1 min read
Essential® PdfViewer Custom Toolbar sample does not contain fitpage and fitwidth functionality, by default. You can add the fitpage and fitwidth functions programmatically in Custom Toolbar sample by setting the ZoomMode property for PdfViewer control.
The following code example helps you add fitpage and fitwidth functionality in Custom Toolbar sample.
C#
/// <summary> /// Handles FitPage Functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fitPage_Click(object sender, RoutedEventArgs e) { if (pdfViewerControl.ZoomMode != ZoomMode.FitPage) pdfViewerControl.ZoomMode = ZoomMode.FitPage; } /// <summary> /// Handles FitWidth Functionality. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fitWidth_Click(object sender, RoutedEventArgs e) { if (pdfViewerControl.ZoomMode != ZoomMode.FitWidth) pdfViewerControl.ZoomMode = ZoomMode.FitWidth; }
Sample: