Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
<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>
This tutorial will show you how to print PDFs from any printer on a network using IronPDF.
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.
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".

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.

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.

Next, we can add the library to test the code.
The IronPDF Library can be downloaded and installed in four ways.
These are:
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.

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.

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.
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.

The third way to install IronPDF is to download the NuGet package directly from the website.
Download the latest version of IronPDF directly from the website. Once downloaded, follow the steps below to add the package to the project.
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
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.
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.
IronPrint is a .NET printing library developed by Iron Software, offering cross-platform compatibility, including Windows, macOS, Android, and iOS.
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.
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.
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.
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.
No, IronPDF functions independently and does not require Adobe Reader to be installed on your computer.
Yes, IronPDF can create interactive PDF files, allowing users to fill out and submit forms, merge and split documents, and more.
IronPDF supports all Microsoft .NET technologies, including ASP.NET Web applications and traditional Windows applications.
No, IronPDF does not impose any restrictions on the number of documents you can print.
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.