Page Navigation in WPF Pdf Viewer
9 Jul 20262 minutes to read
PDF Viewer allows you to navigate through the pages of the PDF document using the GotoPage method. The page number is 1-based. The following code example illustrates the navigation to page 2 of the PDF document.
//Load the PDF.
pdfViewer.Load("Sample.pdf");
//Navigate to page 2
pdfViewer.GotoPage(2);'Load the PDF.
pdfViewer.Load("Sample.pdf")
'Navigate to page 2
pdfViewer.GotoPage(2)Scroll to a horizontal and vertical offset
You can scroll to a specified horizontal and vertical offset of the PDF document programmatically using the ScrollTo method of PdfViewerControl. Refer to the following code to scroll the PDF document to the horizontal and vertical offset of 160 and 400 respectively.
//Load the PDF.
pdfViewer.Load("Sample.pdf");
//Navigate to the horizontal and vertical offset of 160 and 400 respectively
pdfViewer.ScrollTo (160, 400);'Load the PDF.
pdfViewer.Load("Sample.pdf")
'Navigate to the horizontal and vertical offset of 160 and 400 respectively
pdfViewer.ScrollTo (160, 400)NOTE
Internally, the offset values passed to this method are multiplied by the current zoom factor. Therefore, the offset values must be specified in terms of the default zoom factor of 1 (100% zoom).
// If the current zoom percentage is not 100, the parameter values must be divided by the zoom factor.
pdfViewer.ScrollTo (160d / ((double)pdfViewer.ZoomPercentage / 100d), 400d / ((double)pdfViewer.ZoomPercentage / 100d));NOTE
You can refer to our WPF PDF Viewer feature tour page for its groundbreaking feature representations. You can also explore our WPF PDF Viewer example to know how to render and configure the pdfviewer.