IRONSOFTWAREHOME

How to Print with a Dialog in C#

Curtis Chau
Curtis Chau
Updated: August 2, 2026

IronPrint provides Printer.ShowPrintDialog(): one method that opens the native OS print dialog, captures the user's printer and paper selections, and dispatches the document to the print queue. Install one NuGet package and write one line of code.

The print dialog is the standard OS window that lets users choose a printer, set copies, pick a page range, and adjust paper options before committing to print. Desktop applications that need to give users this control before every job are the primary use case.

Quickstart: Print with a Dialog
  1. 1Install IronPrint with NuGet Package Manager

    PM > Install-Package IronPrint

  2. 2Copy and run this code snippet.

    using IronPrint;
    
    // Display the print dialog and print the document
    Printer.ShowPrintDialog("document.pdf");
    C#
  3. 3Deploy to test on your live environment

    Start using IronPrint in your project today with a free trial
    arrow pointer

How Does the Print Dialog Work in C#?

The Printer.ShowPrintDialog() method opens the operating system's native print dialog. The user sees the full set of print options: printer selection, number of copies, page range, orientation, and paper size. They click Print to send the job, or Cancel to dismiss the dialog without printing.

Under the hood, the native .NET approach requires creating a System.Windows.Forms.PrintDialog instance, wiring it to a PrintDocument, handling the PrintPage event to draw content onto the print graphics surface, checking the DialogResult, and then calling PrintDocument.Print(). That setup typically runs 15-25 lines of code. It also does not include built-in PDF or image rendering (printing a PDF through the native dialog means first parsing the PDF into drawable pages, which requires yet another library).

IronPrint handles the entire pipeline in one call:

Input

The quarterly-report.pdf passed to ShowPrintDialog, a styled corporate Q3 financial summary with KPI metric cards and division revenue tables, representing a typical business document sent to the print dialog.

using IronPrint;

// Open the print dialog and print
Printer.ShowPrintDialog("quarterly-report.pdf");

Output

Native print dialog opened by ShowPrintDialog

Native print dialog opened by ShowPrintDialog for the quarterly report.

The method accepts a file path as a string or raw file data as a byte[]. IronPrint detects the document format, renders it through the appropriate engine, and presents the dialog. When the user confirms, the document prints with their chosen settings. The print document tutorial walks through the full printing lifecycle in more detail.

How Do I Pre-Configure Dialog Settings?

We can set default values before the dialog opens by creating a PrintSettings object and passing it as the second parameter. The dialog will open with these values pre-selected, and the user can accept them as-is or override any setting.

Input

The invoice.pdf pre-loaded with A4 portrait settings at 300 DPI: a professional billing invoice with line items, discount, tax, and wire transfer instructions, showing a realistic document where the application already knows the required paper size and orientation.

using IronPrint;

// Pre-configure default dialog settings
var settings = new PrintSettings
{
    PrinterName = "HP LaserJet Pro",
    PaperSize = PaperSize.A4,
    PaperOrientation = PaperOrientation.Portrait,
    Dpi = 300,
    NumberOfCopies = 2,
    Grayscale = false
};

// Open the dialog with pre-filled settings
Printer.ShowPrintDialog("invoice.pdf", settings);

Output

Windows print dialog with pre-configured settings

Native print dialog opened with pre-configured A4 portrait settings.

This is useful when the application knows the likely printer or paper format in advance. For example, a point-of-sale system that always prints receipts on a specific thermal printer can default PrinterName to that device. The user still has the option to change it in the dialog.

To discover which printers are available on the system, we call Printer.GetPrinterNames(), which returns a List<string> of all installed printers. Similarly, Printer.GetPrinterTrays() returns available paper trays for a given printer.

The full list of configurable properties includes PrinterName, PaperSize, PaperOrientation, Dpi, NumberOfCopies, Grayscale, PaperMargins, Flatten (for PDF form fields), and Tray. The print settings how-to covers each property with code examples. Any property not set in PrintSettings defaults to the selected printer's standard configuration.

How Do I Show the Dialog Asynchronously?

The Printer.ShowPrintDialogAsync() method returns a Task, making it compatible with async/await. This prevents the dialog from blocking the UI thread, which is essential for WPF, MAUI, and any application where a frozen interface creates a poor user experience.

Input

The report.pdf awaited asynchronously: a multi-section IT infrastructure and security report, representing the kind of long-form document where non-blocking dialog presentation keeps the UI responsive while the file loads.

using IronPrint;

// Open the print dialog asynchronously
await Printer.ShowPrintDialogAsync("report.pdf");

Output

Async print dialog opened via ShowPrintDialogAsync

Native print dialog opened asynchronously via ShowPrintDialogAsync, with the console confirming non-blocking execution.

ShowPrintDialogAsync() accepts the same parameters as the synchronous version: a file path or byte array, plus an optional PrintSettings object. The async pattern follows the same Task-based Asynchronous Pattern used throughout modern .NET development.

IronPrint works across WinForms, WPF, MAUI, and console applications. The dialog appearance adapts to the host platform and OS version, so the user always sees the native print window they expect.

When Should I Use a Dialog vs. Silent Printing?

Use the dialog when users need to choose printer settings before each job; use silent printing for automated workflows where no human decision is needed.

CriteriaPrint with DialogSilent Printing
User interactionUser selects printer, copies, page rangeNo interaction; prints immediately
Best forDesktop apps, one-off prints, user-facing featuresBatch jobs, background services, kiosk apps
Printer selectionUser chooses from dialogSet programmatically via PrintSettings
IronPrint methodPrinter.ShowPrintDialog()Printer.Print()
Async variantShowPrintDialogAsync()PrintAsync()

Report exports, invoice prints, and any job where the wrong printer wastes materials are good candidates for the dialog. Silent printing fits automated workflows where no human decision is needed between documents.

What File Formats Does the Print Dialog Support?

Printer.ShowPrintDialog() supports the same formats as silent printing: PDF, PNG, TIFF, JPEG, GIF, HTML, and BMP. We pass the file path regardless of format, and IronPrint handles rendering and print spooler communication. File data as a byte[] is also accepted, which is useful when the document is generated in memory or retrieved from a database.

Input

monthly-report.pdf read into a byte[], representing a document retrieved from a database or generated in memory before being sent to the dialog.

using IronPrint;

// Print an image with the dialog
Printer.ShowPrintDialog("product-photo.png");

// Print from a byte array
byte[] reportData = File.ReadAllBytes("monthly-report.pdf");
Printer.ShowPrintDialog(reportData);

Output

The dialog opens as seen in the examples above. Format detection is automatic: whether we pass a file path or a byte[], IronPrint renders the document and presents the same native dialog.

The code examples page shows additional format-specific scenarios. For PDF-specific workflows (generating a PDF and printing it immediately), IronPDF pairs naturally with IronPrint.

Next Steps

Printing with a dialog comes down to two methods: Printer.ShowPrintDialog() for synchronous calls and Printer.ShowPrintDialogAsync() for non-blocking execution. Pre-configure defaults with PrintSettings and let the user adjust from there. Both methods support all of IronPrint's document formats and work across WinForms, WPF, MAUI, and console projects.

Explore the IronPrint tutorials for full walkthroughs, the Printer class API reference for every available method, or the print settings how-to for advanced configuration. The changelog tracks recent improvements and new features.

Start a free 30-day trial to test dialog printing in a live project, no credit card required. When ready to ship, view licensing options starting at $999.

Frequently Asked Questions

What is IronPrint's Print Dialog feature?

IronPrint's Print Dialog feature uses the 'Printer.ShowPrintDialog()' method, which launches the native OS print dialog for users to select printer settings and sends the document to the print queue.

How does IronPrint simplify the printing process in C#?

IronPrint simplifies the printing process by allowing users to call one method ('Printer.ShowPrintDialog') that opens the OS-native print dialog and handles document dispatch, requiring significantly less code than native .NET frameworks.

Can I pre-configure print dialog settings with IronPrint?

Yes, you can pre-configure print dialog settings in IronPrint by creating a 'PrintSettings' object, which allows you to set default printer properties before opening the dialog.

How can I display the print dialog asynchronously using IronPrint?

You can display the print dialog asynchronously with IronPrint by using the 'Printer.ShowPrintDialogAsync()' method, which is compatible with async/await patterns and prevents UI blocking.

When should I use a print dialog instead of silent printing with IronPrint?

Use a print dialog when users need to select print settings manually, while silent printing is suitable for automated workflows without user interaction.

What file formats are supported by IronPrint's print dialog?

IronPrint's print dialog supports several formats including PDF, PNG, TIFF, JPEG, GIF, HTML, and BMP. File handling can be done via file paths or byte arrays.

How does IronPrint handle different document formats?

IronPrint automatically detects the document format when provided as a file path or byte array and manages rendering and print spooler communication for supported formats.

What platforms does IronPrint's dialog support?

IronPrint's print dialog is compatible with WinForms, WPF, MAUI, and console applications, adjusting its appearance according to the host platform and OS version.

How can I get started with IronPrint's print dialog functionality?

To get started, install the IronPrint library via NuGet, write a simple line of code using 'Printer.ShowPrintDialog()', and optionally configure settings using the 'PrintSettings' object.

Can IronPrint be used for printing content generated in memory?

Yes, IronPrint can handle printing documents generated in memory by accepting them as byte arrays, which is practical for dynamically created or database-retrieved documents.

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

Ready to Get Started?

Nuget Downloads 46,090Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPrint
nuget.org/packages/IronPrint/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPrint"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronPrint to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPrint.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required