Skip to footer content
USING IRONPRINT

How to Print PDF in VB.NET Without Adobe Using IronPrint

Printing PDF documents in VB.NET requires a library that handles rendering, printer communication, and settings management without forcing you to install Adobe Reader or other third-party dependencies. IronPrint solves this problem with a clean API that works on Windows, macOS, Linux, and mobile platforms. This guide walks you through every step -- from installing the package to handling common printing errors -- so you can add PDF printing to your VB.NET application quickly and confidently.

By the end of this tutorial, you will know how to print silently, display the Windows print dialog, apply custom settings such as DPI and paper orientation, enumerate available printers, and handle exceptions gracefully.

How Do You Install IronPrint in a VB.NET Project?

Installing IronPrint takes seconds through the NuGet Package Manager. Open your Package Manager Console in Visual Studio and run:

Install-Package IronPrint

After installation, add the namespace import at the top of any file that needs printing, then apply your license key before calling any IronPrint method:

Imports IronPrint

' Apply your license key (get a free trial key at ironsoftware.com)
License.LicenseKey = "YOUR-LICENSE-KEY"
Imports IronPrint

' Apply your license key (get a free trial key at ironsoftware.com)
License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

IronPrint targets .NET Framework 4.6.2 and above, as well as .NET 6, 7, 8, 9, and 10. It ships with native rendering engines for each platform, so you do not need to install Adobe Acrobat, Ghostscript, or any other PDF renderer. The same NuGet package works for Windows Forms, WPF, console applications, and ASP.NET projects written in VB.NET.

Supported document formats include PDF, PNG, HTML, TIFF, GIF, JPEG, and BMP. You can explore the full capabilities in the IronPrint unified printing API reference.

For more information on licensing and activation, visit the IronPrint license key documentation.

How Do You Print a PDF Silently in VB.NET?

Silent printing sends a document directly to a printer without showing any dialog boxes. This mode is essential for automated workflows, batch invoice processing, report generation pipelines, and server-side document printing where no user is present.

According to Microsoft's documentation on GDI+ printing in .NET, traditional .NET printing involves creating a PrintDocument object, hooking into PrintPage events, and manually handling page layout. IronPrint eliminates all of that boilerplate:

Imports IronPrint

Module SilentPrinting
    Sub Main()
        Dim pdfPath As String = "invoice.pdf"

        ' Print to the system default printer
        Printer.Print(pdfPath)

        ' Print to a specific printer by name
        Dim settings As New PrintSettings()
        settings.PrinterName = "Microsoft Print to PDF"
        Printer.Print(pdfPath, settings)
    End Sub
End Module
Imports IronPrint

Module SilentPrinting
    Sub Main()
        Dim pdfPath As String = "invoice.pdf"

        ' Print to the system default printer
        Printer.Print(pdfPath)

        ' Print to a specific printer by name
        Dim settings As New PrintSettings()
        settings.PrinterName = "Microsoft Print to PDF"
        Printer.Print(pdfPath, settings)
    End Sub
End Module
$vbLabelText   $csharpLabel

The Printer.Print method handles all the PDF rendering internally. When you call Printer.Print(pdfPath) without a PrintSettings argument, IronPrint selects the system default printer automatically. When you supply a PrintSettings object with a PrinterName value, it routes the job to that specific device.

For batch scenarios, you can loop over a list of file paths and call Printer.Print for each one. Because IronPrint does not open any UI thread for silent printing, it works correctly in console applications, Windows services, and ASP.NET request handlers.

For a deeper look at the available options, read the IronPrint print settings documentation.

How Do You Show the Print Dialog Before Printing?

Sometimes you need to let users choose a printer, adjust the page range, or set the number of copies before committing to a print job. IronPrint provides Printer.ShowPrintDialog for exactly this scenario:

Imports IronPrint

Module DialogPrinting
    Sub Main()
        ' Display the standard Windows print dialog
        Printer.ShowPrintDialog("report.pdf")
    End Sub
End Module
Imports IronPrint

Module DialogPrinting
    Sub Main()
        ' Display the standard Windows print dialog
        Printer.ShowPrintDialog("report.pdf")
    End Sub
End Module
$vbLabelText   $csharpLabel

When this method runs, Windows displays its standard print dialog. The user can select any installed printer, pick a page range, choose the number of copies, and adjust duplex settings. After the user clicks Print or Cancel, control returns to your code.

This method integrates naturally into Windows Forms applications. You can call it from a button click handler and trust that the dialog will behave consistently with other Windows applications the user already knows.

VB .NET Print PDF Without Opening Adobe with IronPrint: Image 1 - Print dialog

The print dialog examples page shows additional use cases, including pre-selecting a printer or pre-populating the number of copies before the dialog opens.

How Do You Customize PDF Print Settings in VB.NET?

The PrintSettings class gives you full programmatic control over every aspect of a print job. You can set DPI, paper size, orientation, number of copies, and the target printer -- all before the job reaches the print queue:

Imports IronPrint

Module CustomPrintSettings
    Sub Main()
        Dim settings As New PrintSettings() With {
            .Dpi = 300,
            .NumberOfCopies = 2,
            .PaperOrientation = PaperOrientation.Landscape,
            .PaperSize = PaperSize.A4,
            .PrinterName = "Office Printer"
        }

        Printer.Print("document.pdf", settings)
    End Sub
End Module
Imports IronPrint

Module CustomPrintSettings
    Sub Main()
        Dim settings As New PrintSettings() With {
            .Dpi = 300,
            .NumberOfCopies = 2,
            .PaperOrientation = PaperOrientation.Landscape,
            .PaperSize = PaperSize.A4,
            .PrinterName = "Office Printer"
        }

        Printer.Print("document.pdf", settings)
    End Sub
End Module
$vbLabelText   $csharpLabel

Understanding the Key PrintSettings Properties

The Dpi property controls output resolution. A value of 300 is standard for professional documents; 600 is appropriate for high-quality graphics or engineering drawings. Lower values such as 150 are useful for draft prints where speed matters more than quality.

NumberOfCopies tells the printer how many copies to produce in a single job. Setting this value to 3 is equivalent to a user pressing Ctrl+P and entering 3 in the copies field -- but you control it from code without any UI interaction.

PaperOrientation accepts PaperOrientation.Portrait or PaperOrientation.Landscape. Selecting the wrong orientation for a PDF that was designed in landscape mode causes content to be clipped or scaled down. Setting this explicitly ensures the output matches the document design.

PaperSize accepts standard sizes such as PaperSize.A4, PaperSize.Letter, and PaperSize.Legal. This is important when your print environment mixes paper trays with different sizes loaded.

Choosing the Correct Printer Name

The PrinterName string must match the printer's registered name in Windows exactly, including capitalization and spacing. Use Printer.GetPrinterNames() (covered in the next section) to retrieve the list of valid names at runtime.

For more advanced customization options, visit the advanced print customization features page.

How Do You Enumerate and Select Printers Programmatically?

In enterprise environments, workstations often have access to dozens of network printers. IronPrint makes it straightforward to list all available printers and pick the right one at runtime:

Imports IronPrint

Module PrinterManagement
    Sub Main()
        ' Retrieve all available printers
        Dim printers As List(Of String) = Printer.GetPrinterNames()

        Console.WriteLine($"Found {printers.Count} printer(s):")
        For Each printerName As String In printers
            Console.WriteLine($"  - {printerName}")
        Next

        ' Print to the first available printer
        If printers.Count > 0 Then
            Dim settings As New PrintSettings()
            settings.PrinterName = printers(0)
            Printer.Print("document.pdf", settings)
        Else
            Console.WriteLine("No printers found. Check system configuration.")
        End If
    End Sub
End Module
Imports IronPrint

Module PrinterManagement
    Sub Main()
        ' Retrieve all available printers
        Dim printers As List(Of String) = Printer.GetPrinterNames()

        Console.WriteLine($"Found {printers.Count} printer(s):")
        For Each printerName As String In printers
            Console.WriteLine($"  - {printerName}")
        Next

        ' Print to the first available printer
        If printers.Count > 0 Then
            Dim settings As New PrintSettings()
            settings.PrinterName = printers(0)
            Printer.Print("document.pdf", settings)
        Else
            Console.WriteLine("No printers found. Check system configuration.")
        End If
    End Sub
End Module
$vbLabelText   $csharpLabel

Printer.GetPrinterNames() queries the Windows print subsystem and returns every printer the current user can access, including local USB printers, network printers, virtual printers like Microsoft Print to PDF, and any printer drivers installed through third-party software.

Routing Documents to the Right Printer

In multi-printer setups, you might want to route large documents to a high-speed departmental printer and small documents to a nearby desktop device. You can implement this logic by checking the document's page count or file size, then selecting the appropriate printer name from the list.

VB .NET Print PDF Without Opening Adobe with IronPrint: Image 2 - Printer selection

Read the printer information features documentation to learn about additional properties you can query, such as printer status and default paper tray.

How Do You Handle Print Errors in VB.NET?

Production printing code must handle failures gracefully. File paths might be wrong, printers might be offline, or the user account might lack print permissions. Wrapping your print calls in structured exception handling prevents unhandled exceptions from crashing your application:

Imports IronPrint
Imports System.IO

Module ErrorHandling
    Sub Main()
        Dim filePath As String = "document.pdf"

        If Not File.Exists(filePath) Then
            Console.WriteLine("PDF file not found. Verify the path and try again.")
            Return
        End If

        Try
            Dim settings As New PrintSettings()
            settings.PrinterName = "Office Printer"
            Printer.Print(filePath, settings)
            Console.WriteLine("Print job sent successfully.")
        Catch ex As Exception
            Console.WriteLine($"Printing failed: {ex.Message}")
        End Try
    End Sub
End Module
Imports IronPrint
Imports System.IO

Module ErrorHandling
    Sub Main()
        Dim filePath As String = "document.pdf"

        If Not File.Exists(filePath) Then
            Console.WriteLine("PDF file not found. Verify the path and try again.")
            Return
        End If

        Try
            Dim settings As New PrintSettings()
            settings.PrinterName = "Office Printer"
            Printer.Print(filePath, settings)
            Console.WriteLine("Print job sent successfully.")
        Catch ex As Exception
            Console.WriteLine($"Printing failed: {ex.Message}")
        End Try
    End Sub
End Module
$vbLabelText   $csharpLabel

Common Errors and How to Fix Them

The following table describes the most frequent printing errors and their solutions:

Common VB.NET PDF Printing Errors and Solutions
Error Cause Solution
Printer not found Printer name does not match Windows registry entry Call Printer.GetPrinterNames() and use the exact name returned
Blank pages printed Invalid file path or corrupted PDF Use File.Exists to verify the path; open the PDF in a viewer to check integrity
Poor print quality DPI set too low Set PrintSettings.Dpi to 300 or higher
Access denied Insufficient print permissions Run the application with a user account that has print privileges on the target printer
Printer offline Network or device connectivity issue Check the printer status in Windows Devices and Printers; retry after reconnection

VB .NET Print PDF Without Opening Adobe with IronPrint: Image 3 - Example error

For additional troubleshooting guidance, consult the IronPrint engineering request and troubleshooting guide or reach out to Iron Software technical support.

How Do You Combine PDF Generation and Printing in VB.NET?

A common workflow involves generating a PDF at runtime and then immediately printing it -- for example, creating an invoice from database records and sending it to the printer in one step. IronPDF handles PDF creation, and IronPrint handles the output:

Why Combine IronPDF and IronPrint?

IronPDF converts HTML, ASPX, and existing documents into properly formatted PDF files. Once the PDF is in memory or saved to disk, IronPrint sends it to the printer without requiring Adobe Reader. Both libraries share the same NuGet-based deployment model, so you add two packages and write straightforward VB.NET code to cover the entire generate-and-print pipeline.

This approach is particularly effective for:

  • Invoice and receipt printing -- generate PDFs from HTML templates, print immediately
  • Report generation -- convert database query results to formatted PDFs, print on demand
  • Label and barcode printing -- combine IronBarcode for barcode generation with IronPrint for output
  • Batch document processing -- loop over records, generate one PDF per record, print each in sequence

To learn how to generate PDFs from HTML in VB.NET, visit the IronPDF for VB.NET documentation.

According to W3C's specification for print media queries, controlling print layout through CSS @page rules is the standard approach for HTML-to-print workflows. IronPDF respects these CSS rules during rendering, so the PDF you generate will have the correct margins, page breaks, and size before IronPrint sends it to the printer.

How Do You Print Multiple Pages and Control Page Ranges?

When printing large documents, you may need to print only specific pages -- for example, pages 1 through 5 of a 50-page report. IronPrint's PrintSettings class supports page range configuration:

Configuring Page Ranges

You can specify a starting page and an ending page within the PrintSettings object. Page numbers are one-based, matching the convention users expect from standard print dialogs. If you omit the page range, IronPrint prints the entire document.

Page range printing is especially useful in high-volume environments where reprinting a single damaged page is faster than reprinting the whole document. Combined with NumberOfCopies, you can precisely control how many copies of which pages reach the output tray.

For the complete list of PrintSettings properties including page range, visit the IronPrint print settings how-to guide.

Printing in Grayscale

Some printers default to color output even when the document contains no color content, wasting toner or ink. You can force grayscale output through PrintSettings. This setting is available on both Windows and macOS targets and works for all supported document formats, not just PDFs.

The IronPrint features overview lists all available print settings with examples for each platform.

What Are Your Next Steps?

You now have the building blocks for PDF printing in VB.NET applications:

  • Silent printing -- Printer.Print(path) for automated workflows
  • Dialog printing -- Printer.ShowPrintDialog(path) for user-controlled jobs
  • Custom settings -- PrintSettings for DPI, orientation, copies, and printer selection
  • Printer enumeration -- Printer.GetPrinterNames() for dynamic printer routing
  • Error handling -- structured exception handling with pre-flight file validation
  • Combined workflows -- IronPDF for generation, IronPrint for output

To put these capabilities to work, start your free IronPrint trial and explore these additional resources:

Frequently Asked Questions

What is IronPrint?

IronPrint is a library that simplifies the process of printing PDF documents in VB.NET by eliminating the need for Adobe Reader and other dependencies.

How does IronPrint facilitate PDF printing in VB.NET?

IronPrint enables PDF printing in VB.NET by providing a straightforward method that works across multiple platforms, including Windows, macOS, and mobile devices.

Can I perform silent printing with IronPrint?

Yes, IronPrint supports silent printing, allowing PDF documents to be printed without displaying dialog boxes or requiring user interaction.

Is IronPrint compatible with mobile platforms?

Yes, IronPrint is designed to work across Windows, macOS, and mobile platforms, providing flexibility in PDF printing applications.

Does IronPrint require any external dependencies?

No, IronPrint is a dependency-free solution, meaning you do not need additional software like Adobe Reader to print PDFs in VB.NET.

What advantages does IronPrint offer over traditional PDF printing methods?

IronPrint offers a simplified and efficient PDF printing process by removing the need for complex workarounds and external dependencies, making it easier to integrate into .NET applications.

Can I customize print settings with IronPrint?

Yes, IronPrint provides options to customize print settings through the PrintSettings class, allowing developers to control DPI, paper orientation, copies, and printer selection.

How does IronPrint improve the PDF printing process in VB.NET applications?

IronPrint improves the PDF printing process by offering a single, easy-to-use method for printing across various platforms without requiring additional software.

Is IronPrint suitable for cross-platform development?

Yes, IronPrint is suitable for cross-platform development, as it supports printing on Windows, macOS, Linux, and mobile platforms.

What kind of support does IronPrint offer for developers?

IronPrint offers support for developers through detailed documentation, code examples, and technical support access, ensuring a smooth development experience.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More