Print Document Tutorial

IronPrint is a powerful printing library designed to assist .NET C# developers in integrating printing capabilities into their applications. With a broad compatibility spectrum spanning across Windows, macOS, iOS, and Android platforms, IronPrint works consistently and reliably across diverse operating systems. Whether you are creating applications for desktop environments, Apple's macOS ecosystem, or mobile platforms like iOS and Android, IronPrint simplifies the implementation of printing features, providing a versatile and user-friendly solution for all your printing needs in the .NET C# environment.

Table of Contents

C# NuGet Library for

Install with NuGet

Install-Package IronPrint

Print Document

Print Silently

Print documents seamlessly without displaying the print dialog. The print settings can then be done directly within the code.

using IronPrint;

// Print the document
Imports IronPrint

' Print the document
VB   C#

Print With Dialog

Initiate the printing process with the print setting dialog displayed. This allows users to customize print options interactively.

using IronPrint;

// Show print dialog
Imports IronPrint

' Show print dialog
VB   C#

Apply Print Settings

Programmatically adjust print settings to meet specific requirements. This section provides the capability to fine-tune printing configurations through code.

using IronPrint;

// Configure print setting
PrintSettings printSettings = new PrintSettings();
printSettings.Dpi = 150;
printSettings.NumberOfCopies = 2;
printSettings.PaperOrientation = PaperOrientation.Portrait;

// Print the document
Printer.Print("newDoc.pdf", printSettings);
Imports IronPrint

' Configure print setting
Private printSettings As New PrintSettings()
printSettings.Dpi = 150
printSettings.NumberOfCopies = 2
printSettings.PaperOrientation = PaperOrientation.Portrait

' Print the document
Printer.Print("newDoc.pdf", printSettings)
VB   C#

Get Printer Information

Get Printer Names

Access a list of all available printers. Retrieve the names of printers installed on the system for informative purposes or dynamic printer selection in your application.

using IronPrint;
using System;
using System.Collections.Generic;

// Retrieve printers' name
List<string> printersName = Printer.GetPrinterNames();

foreach (var printer in printersName)
Imports IronPrint
Imports System
Imports System.Collections.Generic

' Retrieve printers' name
Private printersName As List(Of String) = Printer.GetPrinterNames()

For Each printer In printersName
Next printer
VB   C#