Today you are going to learn how to PDF viewer control hosted in WPF in VB.NET. ByteScout PDF Viewer SDK was made to help with PDF viewer control hosted in WPF in VB.NET. ByteScout PDF Viewer SDK is the WinForms control for quick implementation of your own pdf reader application. Includes support for multiple area selections using mouse, keyboard shortcuts and zooming in and out. You may also read coordinates, add custom painting code and more.
You will save a lot of time on writing and testing code as you may just take the code below and use it in your application. In order to implement this functionality, you should copy and paste code below into your app using code editor. Then compile and run your application. Test VB.NET sample code examples whether they respond your needs and requirements for the project.
ByteScout PDF Viewer SDK is available as free trial. You may get it from our website along with all other source code samples for VB.NET applications.
Class Application ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException ' can be handled in this file. End Class
Class MainWindow Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs) ' Load a sample document on startup pdfViewerControl1.InputFile = "sample.pdf" End Sub Private Sub menuItemOpen_Click(sender As Object, e As RoutedEventArgs) Dim dlg = New Microsoft.Win32.OpenFileDialog() dlg.Filter = "PDF Files (*.pdf)|*.pdf|All Files (*.*)|*.*" Dim result As Boolean? = dlg.ShowDialog() If result = True Then pdfViewerControl1.InputFile = dlg.FileName End If End Sub End Class