Page Navigation in WinForms PdfViewer

31 Jan 20221 minute to read

Navigation to a specific page, through code, is possible using GoToPageAtIndex method.

pdfViewerControl1.GoToPageAtIndex(2);
pdfViewerControl1.GoToPageAtIndex(2)

You can now scroll to a specific horizontal and vertical offset of the PDF document programmatically using the HorizontalScrollOffset and VerticalScrollOffset properties of PdfViewerControl. Refer to the following code, to scroll the PDF document to the horizontal and vertical offset of 100 and 400, respectively.

//Load the PDF
pdfViewerControl1.Load("Sample.pdf");

//Navigate to the horizontal and vertical offset of 100 and 400 respectively
pdfViewerControl1.HorizontalScrollOffset = 100;
pdfViewerControl1.VerticalScrollOffset = 400;
'Load the PDF
pdfViewerControl1.Load("Sample.pdf")

'Navigate to the horizontal and vertical offset of 100 and 400 respectively
pdfViewerControl1.HorizontalScrollOffset = 100
pdfViewerControl1.VerticalScrollOffset = 400