How to Start Convert PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

VB.NET PDF Printing Library
How to print a PDF file to network printer using VB.NET without Adobe Reader

VB.NET PDF Document SDK for PDF Printing in Visual Basic .NET Program

In this tutorial, you will learn how to print a PDF document using VB.NET code in Windows Forms, WPF applications.

  • Print a PDF to a default, or selected network printer
  • Support print resulution and PDF page ranges settings
  • No need to install Adobe Reader
  • Easy to enable printing function in Windows Forms, WPF applications, ASP.NET using VB.NET

How to print PDF file using Visual Basic .NET

  1. Download XDoc.PDF VB.NET library
  2. Install vb library to print PDF files
  3. Step by Step Tutorial

  • Standalone VB.NET PDF document printer SDK that is programmed in 100% managed VB.NET code
  • View C# tutorial details at how to print PDF file using c#
  • Robust VB.NET document printing solution that can be used in .NET 8, 7, 6, 5, .NET Core 3.1, 2.1 and Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.8
  • Quickly print all target PDF document pages or one specified PDF page by VB.NET code

open word document file in browser in, pdf preview, pdf viewer user control, multipage tiff viewer, pdf writer, mvc display pdf from byte array, display image from memorystream.

Print a PDF file using the selected printer using VB.NET

The steps and source code below show how to print a PDF document using a selected printer.

  1. Create a PDFPrinterOption object with the target printer name
  2. Print a PDF file by calling Print method of the class PDFPrinter

Dim inputFilePath As String = "C:\demo_1.pdf"
Dim op As PDFPrinterOption = New PDFPrinterOption()
' Set printer name for printing
op.PrinterName = "Microsoft Print to PDF"
PDFPrinter.Print(inputFilePath, New PDFPrintSetting(), op)

Apply PDF Print Options in VB.NET Code

About PDF printing options

You can apply the following options in class PDFPrintSetting.

  • StartPageIndex: Index of the first page to print. Default: 0
  • StopPageIndex: Index of the last page to print. -1 means to print all remained pages from the first one. Default: -1
  • PageResolution: Conversion resolution for the page (in pixel per inch). Default: 300 (dpi)

How to choose printing PDF page range using Visual Basic .NET

The following Visual Basic source code shows how to choose PDF page ranges for printing.

Dim inputFilePath As String = "C:\1.pdf"
' print a range of pages from page index 1 to 2
Dim setting As PDFPrintSetting = New PDFPrintSetting()
setting.StartPageIndex = 1
setting.StopPageIndex = 2
PDFPrinter.Print(inputFilePath, setting, New PDFPrinterOption())

How to change the resolution of the PDF printing output in Visual Basic .NET

The source code below explains how to set the printing PDF pages resolution.

Dim inputFilePath As String = "C:\1.pdf"
' set print resolution to 600 dpi
Dim setting As PDFPrintSetting = New PDFPrintSetting()
setting.StartPageIndex = 1
setting.StopPageIndex = 1
setting.PageResolution = 600
PDFPrinter.Print(inputFilePath, setting, New PDFPrinterOption())