Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click pdfViewer.PrintWithDialog() End Sub
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try ' Initialize the control (if added via code) or use the one from Toolbox ' AxAcroPDF1 is the name of the control on your form ' 1. Load the PDF file Dim filePath As String = "C:\Documents\Sample.pdf" AxAcroPDF1.LoadFile(filePath) ' 2. Configure the UI AxAcroPDF1.setShowToolbar(False) ' Hides the Adobe toolbar AxAcroPDF1.setPageMode("none") ' Hides bookmarks/thumbnails AxAcroPDF1.setLayoutMode("SinglePage") ' 3. Navigate to a specific page (Page indices are 1-based in version 7.0) AxAcroPDF1.setCurrentPage(1) Catch ex As Exception MessageBox.Show("Error loading PDF: " & ex.Message) End Try End Sub ' Example: Printing the document Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click AxAcroPDF1.PrintAll() End Sub End Class Use code with caution. Copied to clipboard 5. Common Methods Description LoadFile(string) Loads the specified PDF document. setShowToolbar(bool) Toggles the visibility of the Acrobat toolbar. setZoom(float) Sets the zoom percentage (e.g., 100.0). setCurrentPage(int) Navigates to the specified page number. printWithDialog() Opens the native print dialog for the PDF. Important Note on Compatibility
Here is a richer VB.NET form that hosts the control alongside custom buttons:
The is a historical artifact in the VB.NET ecosystem. While it once enabled seamless PDF embedding, it is now dangerous, unreliable, and incompatible with modern development practices. If you are maintaining an old application that uses it, plan a migration to WebView2 or PdfiumViewer. If you are starting a new project, do not use it —treat it like a relic from the Internet Explorer 6 era.