How to Retrieve Printer Names in C#
Knowing which printers are available on a system is a common prerequisite for any .NET application that sends documents to print. Whether the goal is to let users pick a printer from a dropdown or to route print jobs to a specific device automatically, retrieving printer names programmatically is the first step.
IronPrint exposes a single static method — Printer.GetPrinterNames() — that returns every installed printer on the current Windows machine as a List<string>. We cover installation, synchronous and asynchronous retrieval, and how to feed a selected printer name into a print job below.
Quickstart: Retrieve Printer Names
- Install IronPrint via NuGet:
Install-Package IronPrint - Add
using IronPrint;to the file - Call
Printer.GetPrinterNames()to get aList<string>of printer names - Iterate over the list and display or store each name
- Pass a selected name to
PrintSettings.PrinterNamewhen printing
-
Install IronPrint with NuGet Package Manager
PM > Install-Package IronPrint -
Copy and run this code snippet.
using IronPrint; // Retrieve every printer installed on this machine List<string> printers = Printer.GetPrinterNames(); foreach (var name in printers) { Console.WriteLine(name); } -
Deploy to test on your live environment
Start using IronPrint in your project today with a free trial
Minimal Workflow (5 steps)
- Install the IronPrint C# printing library
- Call
Printer.GetPrinterNames() - Iterate over the returned
List<string> - Assign a name to
PrintSettings.PrinterNameto target that printer - Pass the configured settings to
Printer.Print()to print
How Can I List All Installed Printer Names?
Printer.GetPrinterNames() queries the operating system and returns every registered printer as a List<string>. We call this method once and iterate over the result:
:path=/static-assets/print/content-code-examples/how-to/retrieve-printer-names/retrieve-printer-names-list-all-printers.cs
using IronPrint;
using System;
using System.Collections.Generic;
// Get every printer registered on this Windows machine
List<string> printerNames = Printer.GetPrinterNames();
Console.WriteLine($"Found {printerNames.Count} printer(s):\n");
foreach (string name in printerNames)
{
Console.WriteLine($" • {name}");
}
Imports IronPrint
Imports System
Imports System.Collections.Generic
' Get every printer registered on this Windows machine
Dim printerNames As List(Of String) = Printer.GetPrinterNames()
Console.WriteLine($"Found {printerNames.Count} printer(s):" & vbCrLf)
For Each name As String In printerNames
Console.WriteLine($" • {name}")
Next
Console Output
Found 3 printer(s):
• Microsoft Print to PDF
• HP LaserJet Pro MFP M428
• OneNote (Desktop)
The returned list includes local printers, network printers, and virtual print drivers. Each string matches the exact name shown in the Windows Settings > Printers & scanners panel, so it can be used directly in print settings configuration.
If no printers are installed, the method returns an empty list rather than throwing an exception. A quick printerNames.Count check is all that's needed before presenting options to a user.
How Do I Retrieve Printer Names Asynchronously?
For applications where blocking the UI thread is not acceptable — WPF, MAUI, or ASP.NET web apps — IronPrint provides Printer.GetPrinterNamesAsync(). The method returns a Task<List<string>> and works identically to its synchronous counterpart:
:path=/static-assets/print/content-code-examples/how-to/retrieve-printer-names/retrieve-printer-names-async-printer-names.cs
using IronPrint;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
// Await the async call to avoid blocking the UI thread
List<string> printerNames = await Printer.GetPrinterNamesAsync();
foreach (string name in printerNames)
{
Console.WriteLine(name);
}
Imports IronPrint
Imports System
Imports System.Collections.Generic
Imports System.Threading.Tasks
' Await the async call to avoid blocking the UI thread
Dim printerNames As List(Of String) = Await Printer.GetPrinterNamesAsync()
For Each name As String In printerNames
Console.WriteLine(name)
Next
We await the call just like any other async API. The result is the same List<string> returned by GetPrinterNames(), so no additional parsing or conversion is necessary. This async pattern integrates naturally with async Task controller actions and async void event handlers.
How Do I Print to a Specific Printer by Name?
Once we have the printer name, we assign it to PrintSettings.PrinterName and pass the settings object to Printer.Print(). This sends the document directly to the chosen printer without displaying a dialog:
:path=/static-assets/print/content-code-examples/how-to/retrieve-printer-names/retrieve-printer-names-print-to-specific-printer.cs
using IronPrint;
using System.Collections.Generic;
// Step 1 — Retrieve available printers
List<string> printers = Printer.GetPrinterNames();
// Step 2 — Select a printer (first match containing "LaserJet" as an example)
string targetPrinter = printers.Find(p => p.Contains("LaserJet"))
?? printers[0]; // fallback to first available
// Step 3 — Configure print settings
PrintSettings settings = new PrintSettings
{
PrinterName = targetPrinter,
PaperSize = PaperSize.A4,
NumberOfCopies = 1
};
// Step 4 — Print the document
Printer.Print("invoice.pdf", settings);
Imports IronPrint
Imports System.Collections.Generic
' Step 1 — Retrieve available printers
Dim printers As List(Of String) = Printer.GetPrinterNames()
' Step 2 — Select a printer (first match containing "LaserJet" as an example)
Dim targetPrinter As String = printers.Find(Function(p) p.Contains("LaserJet")) _
OrElse printers(0) ' fallback to first available
' Step 3 — Configure print settings
Dim settings As New PrintSettings With {
.PrinterName = targetPrinter,
.PaperSize = PaperSize.A4,
.NumberOfCopies = 1
}
' Step 4 — Print the document
Printer.Print("invoice.pdf", settings)
PrintSettings supports additional properties such as Dpi, PaperOrientation, Grayscale, and PaperMargins. See the full list in the PrintSettings API reference and the print settings how-to guide.
We also retrieve available paper trays for a given printer using Printer.GetPrinterTrays(printerName), which is useful when a print job needs to pull paper from a specific tray.
What Are My Next Steps?
We covered four operations: installing IronPrint, listing all printer names with GetPrinterNames(), running the same query asynchronously with GetPrinterNamesAsync(), and routing a document to a specific printer through PrintSettings.PrinterName.
For further reading and deeper examples, explore these resources:
- IronPrint Tutorials — Print Document for end-to-end printing walkthroughs.
- Print Settings How-To for configuring DPI, margins, orientation, and more.
- Printer Class API Reference for the complete list of static methods.
Get a free trial license to test every feature in a live environment, or view licensing options when you're ready to deploy.

