USING IRONPRINT

How to Print a PDF from a Network Printer Using IronPDF

<div class="alert alert-info iron-variant-1" role="alert">
    <a href="https://ironsoftware.com/csharp/print/">IronPrint</a> is Iron Software's brand new .NET printing library, offering compatibility across a wide range of platforms, including Windows, macOS, Android, and iOS. <a href="https://ironsoftware.com/csharp/print/docs/">Get started with IronPrint</a> now!
</div>
<div class="alert alert-info iron-variant-1" role="alert">
    <a href="https://ironsoftware.com/csharp/print/">IronPrint</a> is Iron Software's brand new .NET printing library, offering compatibility across a wide range of platforms, including Windows, macOS, Android, and iOS. <a href="https://ironsoftware.com/csharp/print/docs/">Get started with IronPrint</a> now!
</div>
HTML

1. Introduction

This tutorial will show you how to print PDFs from any printer on a network using IronPDF.

1.1 IronPDF Features

IronPDF is a potent PDF library that can convert from HTML to PDF with minimal loss of the original formatting shown in browsers. The .NET library for developers makes it easy to produce, read, and manipulate PDF files.

IronPDF converts HTML files to PDF files using the Chrome engine. IronPDF supports HTML, ASPX, Razor pages, and MVC Views, in addition to other web formats. IronPDF supports all Microsoft.NET technologies (both ASP.NET Web applications and traditional Windows applications).

IronPDF can be used to create visually stunning PDF documents. We can produce PDF documents with IronPDF from HTML5, JavaScript, CSS, and images. There may also be headers and footers in the files. It is also easy to view PDF files using IronPDF.

  • Some of the sources that can be used to make a PDF file include HTML, HTML5, ASPX, and Razor/MVC View. We also have the option to convert picture files as well as HTML files to PDF.
  • You can build interactive PDF files with IronPDF, fill out and submit interactive forms with it, merge and split PDF files, extract text and images from PDF files, search text within a PDF file, rasterize PDF pages to images, convert PDF to HTML, and print PDF files.
  • A document can be generated using IronPDF from a URL. It also supports user agents, proxies, cookies, HTTP headers, and form variables for logins made behind HTML login forms.
  • IronPDF can view and edit PDF files.
  • Images can be extracted from documents using IronPDF.
  • We can add headers, footers, text, images, bookmarks, watermarks, and more to documents with IronPDF.
  • We can combine and divide pages in brand-new or recent documents using IronPDF.
  • IronPDF can convert documents to PDFs without relying on Acrobat software.
  • IronPDF can create PDFs from HTML files that use CSS files.

2. Creating a New Project in Visual Studio

In this article, we are going to use a console application to generate PDF documents.

Open the Visual Studio software, and go to the File menu. Select "New Project", and then select "Console Application".

![How to Print a PDF from a Network Printer, Figure 1](/static-assets/pdf/blog/csharp-print-pdf-network-printer/csharp-print-pdf-network-printer-1.webp)

Enter the project name and select the file path in the appropriate text box. Then, click the Create button and select the required .NET Framework, as in the screenshot below.

![How to Print a PDF from a Network Printer, Figure 2](/static-assets/pdf/blog/csharp-print-pdf-network-printer/csharp-print-pdf-network-printer-2.webp)

The Visual Studio project will now generate the structure for the selected application. If you have selected the console, Windows, or the Web application template in the New Project wizard, Visual Studio will open the Program.cs file, where you can enter code.

![How to Print a PDF from a Network Printer, Figure 3](/static-assets/pdf/blog/csharp-print-pdf-network-printer/csharp-print-pdf-network-printer-3.webp)

Next, we can add the library to test the code.

3. Install the IronPDF Library

The IronPDF Library can be downloaded and installed in four ways.

These are:

  1. Using Visual Studio NuGet Package Manager UI
  2. Using the Visual Studio Command Line
  3. Direct download from the NuGet website
  4. Direct download from the IronPDF website

3.1 Using Visual Studio NuGet Package Manager UI

Visual Studio provides the NuGet Package Manager UI for installing packages directly to a solution. The below screenshot shows how to open the NuGet Package Manager.

![How to Print a PDF from a Network Printer, Figure 4](/static-assets/pdf/blog/csharp-print-pdf-network-printer/csharp-print-pdf-network-printer-4.webp)

The Package Manager UI provides a search box to show the list of packages from the NuGet website. In the Package Manager, search for the IronPDF library using the keyword "IronPDF," as shown in the screenshot below.

![How to Print a PDF from a Network Printer, Figure 5](/static-assets/pdf/blog/csharp-print-pdf-network-printer/csharp-print-pdf-network-printer-5.webp)

In the above image, we can see the list of the related search items. We need to select the required option to install the package to the solution.

3.2 Using the Visual Studio Command-Line

In Visual Studio, go to Tools > NuGet Package Manager > Package Manager Console.

Enter the following line in the package manager console tab:

Install-Package IronPrint

The package will download/install to the current project and be ready to use.

![How to Print a PDF from a Network Printer, Figure 6](/static-assets/pdf/blog/csharp-print-pdf-network-printer/csharp-print-pdf-network-printer-6.webp)

3.3 Direct download from the NuGet website

The third way to install IronPDF is to download the NuGet package directly from the website.

  1. Navigate to IronPDF's NuGet gallery page.
  2. Select the "Download package" link from the menu on the right-hand side.
  3. Double-click the downloaded package from the File Explorer to install it.
  4. Reload the Visual Studio project.

3.4 Direct download from the IronPDF website

Download the latest version of IronPDF directly from the website. Once downloaded, follow the steps below to add the package to the project.

  1. From Visual Studio, right-click the project from the Solution Explorer panel.
  2. Select the Add Reference option. Click the Browse button and search for the location of the downloaded reference.
  3. Click OK to add the reference.

4. Print PDF Files

IronPDF allows us to print PDF documents using a network printer driver. We can print PDF documents however many times we wish. Below is a code sample for printing on network printers.

try
{
    // Initialize the Chrome Pdf Renderer object
    var chromePdfRenderer = new ChromePdfRenderer();

    // Render the HTML content to a PDF
    using (var pdfDocument = chromePdfRenderer.RenderHtmlAsPdf("<h1>Hello, world!</h1>"))
    {
        // Get the print document from the rendered PDF
        using (var printDocument = pdfDocument.GetPrintDocument())
        {
            // Specify the printer name
            printDocument.PrinterSettings.PrinterName = "Brother DCP-T700W Printer";
            // Alternative printer for local PDF creation
            printDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF";

            // Trigger the print process
            printDocument.Print();
        }
    }
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}
try
{
    // Initialize the Chrome Pdf Renderer object
    var chromePdfRenderer = new ChromePdfRenderer();

    // Render the HTML content to a PDF
    using (var pdfDocument = chromePdfRenderer.RenderHtmlAsPdf("<h1>Hello, world!</h1>"))
    {
        // Get the print document from the rendered PDF
        using (var printDocument = pdfDocument.GetPrintDocument())
        {
            // Specify the printer name
            printDocument.PrinterSettings.PrinterName = "Brother DCP-T700W Printer";
            // Alternative printer for local PDF creation
            printDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF";

            // Trigger the print process
            printDocument.Print();
        }
    }
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}
Try
	' Initialize the Chrome Pdf Renderer object
	Dim chromePdfRenderer As New ChromePdfRenderer()

	' Render the HTML content to a PDF
	Using pdfDocument = chromePdfRenderer.RenderHtmlAsPdf("<h1>Hello, world!</h1>")
		' Get the print document from the rendered PDF
		Using printDocument = pdfDocument.GetPrintDocument()
			' Specify the printer name
			printDocument.PrinterSettings.PrinterName = "Brother DCP-T700W Printer"
			' Alternative printer for local PDF creation
			printDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF"

			' Trigger the print process
			printDocument.Print()
		End Using
	End Using
Catch ex As Exception
	Console.WriteLine(ex.Message)
End Try
$vbLabelText   $csharpLabel

The above code helps us to print the created PDF document on the local or network printer programmatically. First, we create an object for the ChromePdfRenderer, which helps us to convert text, HTML code, URLs, and other documents into PDF documents. Various types of methods such as RenderHtmlAsPdf, RenderHTMLFileAsPdf, and RenderUrlAsPdf are used to perform various types of operations. This sample code uses RenderHtmlAsPdf, as it allows us to convert the entered HTML code into a PDF document.

Once we have created an object for the ChromePdfRenderer by using the required method, we then need to use the method GetPrintDocument on the created object, which allows us to access all the printer settings. This provides setting options such as page size, margin, DPI, etc., while we can further gain access to many more settings. We can also pass the printer name to the PrinterSettings.PrinterName property, which allows us to print the pages from a specified printer. After specifying all the printer settings, we call the Print method, which will trigger printing on the specified printer. To use this method, you will need to add an assembly reference to the System.Drawing.dll.

IronPDF does not have any restrictions on printing documents. We can print any number of documents as required. If we do not specify a printer name, it will print from the default printer.

5. Conclusion

IronPDF is one of the best-known PDF libraries. It functions independently of all other libraries, and your computer does not need to have Adobe Reader installed. It also works on a variety of platforms. The initial price point for IronPDF is $749.00. There is an option to make a one-year payment for product maintenance and upgrades. IronPDF also provides coverage for royalty-free SaaS and OEM redistribution at an extra cost.

For further details on pricing, go here.

Frequently Asked Questions

What is IronPrint?

IronPrint is a .NET printing library developed by Iron Software, offering cross-platform compatibility, including Windows, macOS, Android, and iOS.

What are the primary features of IronPDF?

IronPDF is a powerful PDF library capable of converting HTML to PDF with minimal formatting loss, supporting various .NET technologies, creating interactive PDFs, extracting text and images, and printing PDF files.

How can I create a new project in Visual Studio to generate PDF documents?

Open Visual Studio, go to the File menu, select 'New Project', choose 'Console Application', enter the project name and file path, then click 'Create' and select the required .NET Framework.

How do I install the IronPDF library in Visual Studio?

You can install IronPDF using the Visual Studio NuGet Package Manager UI, the Visual Studio Command Line, or by directly downloading from the NuGet or IronPDF websites.

How can I print a PDF file using a network printer with IronPDF?

Initialize a ChromePdfRenderer object, render the HTML as a PDF, get the print document from the rendered PDF, specify the printer name, and trigger the print process using the Print method.

Does IronPDF require Adobe Reader for printing PDF documents?

No, IronPDF functions independently and does not require Adobe Reader to be installed on your computer.

Can IronPDF be used to create interactive PDF files?

Yes, IronPDF can create interactive PDF files, allowing users to fill out and submit forms, merge and split documents, and more.

What platforms does IronPDF support?

IronPDF supports all Microsoft .NET technologies, including ASP.NET Web applications and traditional Windows applications.

Is there a limit to the number of documents I can print with IronPDF?

No, IronPDF does not impose any restrictions on the number of documents you can print.

What is the pricing model for IronPDF?

IronPDF has an initial price point for the lite license, with options for one-year maintenance and upgrades, as well as coverage for royalty-free SaaS and OEM redistribution at an extra cost.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.
< PREVIOUS
How to Print PDF Files in C# Without Using Adobe
NEXT >
How To Print PDF Files in .NET Core

Ready to get started? Version: 2025.6 just released

View Licenses >