How to Print PDF Files in C#
IronPDF enables C# developers to programmatically print PDF files directly to physical printers with a single method call, offering precise control over printer settings, resolution (DPI), and document handling for automated printing workflows in .NET applications.
Sending PDFs to printers from .NET C# code automates the printing process, allowing you to integrate printing functionality into your applications, reduce manual efforts, and ensure consistency in document production. It provides precise control over the printing process. This capability is essential for applications that generate invoices, reports, or any documents requiring physical copies without user intervention.
IronPDF offers the option to print programmatically to a physical printer in one method call, allowing you to print multiple PDF files. The printer resolution can also be specified with configurable horizontal and vertical DPI. Use the method that accepts both Microsoft PrinterSettings and PrintController for further control over the PDF printing process. Before diving into printing, ensure you've properly installed IronPDF in your .NET project.
Quickstart: Print PDFs in .NET with IronPDF
Easily print your PDF documents using IronPDF with just a few lines of code. This guide shows you how to quickly integrate PDF printing into your .NET applications. With IronPDF, you can send files directly to printers with minimal setup, all while enjoying flexible settings and high-quality output. Get started now and simplify your document workflow. For more advanced printing scenarios, explore our comprehensive paper printing PDFs guide.
Get started making PDFs with NuGet now:
Install IronPDF with NuGet Package Manager
Copy and run this code snippet.
IronPdf.PdfDocument.FromFile("example.pdf").Print();Deploy to test on your live environment
Minimal Workflow (5 steps)
- Download IronPDF Library for printing PDFs
- Prepare the input PDF file for printing
- Use
Printmethod to send PDFs to default printer - Specify printer name to target different printers
- Use
GetPrintDocumentmethod for advanced settings
How Do I Print PDF Files Using IronPDF?
The Print method is available through the PdfDocument object, allowing you to print both newly created and existing PDF files. By default, the method uses the system's default printer, but you can specify a different printer by passing its name as a string to the Print method. This flexibility makes it easy to integrate PDF printing into existing workflows, whether you're generating documents dynamically or working with pre-existing PDFs.
Which Printers Can I Target?
IronPDF supports printing to any installed printer on your Windows system, including network printers, virtual printers like "Microsoft Print to PDF," and physical printers connected via USB or network. To print to network printers specifically, check our network printer troubleshooting guide for additional configuration tips.
:path=/static-assets/pdf/content-code-examples/how-to/print-pdf-print.csusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Test printing</h1>");
// Send the document to "Microsoft Print to PDF" printer
pdf.Print("Microsoft Print to PDF");What Happens When I Send a PDF to Print?
When you invoke the Print method, IronPDF sends your PDF document to the Windows print spooler, which manages the print queue for the selected printer. The document appears in the print queue with details such as file name, size, and status. The print spooler then processes the document according to the printer's capabilities and current queue position.

How Can I Control Print Quality and Resolution?
You can specify the resolution of the printed PDF by providing the desired DPI value to the Print method, which applies the same DPI for both horizontal and vertical dimensions. To use different DPI values, pass two parameters to the method: the first for horizontal (x) DPI and the second for vertical (y) DPI. Higher DPI values produce better quality prints but result in larger file sizes and longer processing times.
When Should I Adjust DPI Settings?
Different print scenarios require different DPI settings. For standard office documents, 150-300 DPI provides good quality. For high-quality graphics or photos, use 600 DPI or higher. Draft prints can use 72-150 DPI to save time and resources. When creating PDFs for digital viewing only, refer to our PDF compression guide to optimize file sizes.
:path=/static-assets/pdf/content-code-examples/how-to/print-pdf-dpi.csusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Test printing</h1>");
// Set custom DPI
pdf.Print(300);
// Specify printing resolution
pdf.Print(10, 10, "Microsoft Print to PDF");What DPI Values Work Best for Different Print Types?
Let's see how to rasterize and print a PDF file in the next example. The choice of DPI depends on your specific needs:
- Text documents: 300 DPI provides crisp, readable text
- Mixed content (text and images): 300-400 DPI balances quality and file size
- High-quality photos: 600 DPI or higher preserves image detail
- Draft prints: 150 DPI for quick review copies
- Archive quality: 1200 DPI for long-term preservation
How Do I Save PDFs Without Physical Printing?
The PrintToFile method efficiently rasterizes PDF documents by converting them into bitmap (pixel-based) images and saving them as a PDF file. This process is handled by the Windows built-in printer, such as "Microsoft Print to PDF." Notably, this method saves the PDF to disk without sending it to a physical printer. For more ways to save PDFs, explore our comprehensive guide on exporting and saving PDFs.
Why Use PrintToFile Instead of Regular Saving?
PrintToFile offers unique advantages when you need to simulate the printing process without physical output. It's particularly useful for creating print-ready files, testing print layouts, or generating documents that match exactly what would appear on paper. This method can also help when you need to convert PDFs to a specific format or apply printer-specific transformations.
:path=/static-assets/pdf/content-code-examples/how-to/print-pdf-print-to-file.csusing IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Test printing</h1>");
// Print to file
pdf.PrintToFile("");What Are the Benefits of Rasterization?
Rasterization through PrintToFile provides several benefits:
- Consistent appearance: Ensures the PDF looks identical across different viewers
- Font embedding: Converts text to images, eliminating font compatibility issues
- Security: Makes text non-selectable and harder to extract
- Print preview: Shows exactly how the document will appear when printed
- File size optimization: Can reduce file size for complex vector graphics
For working with PDFs in memory without saving to disk, see our PDF to MemoryStream guide.
How Can I Access Advanced Printer Settings?
To customize printing options, use the GetPrintDocument method, which accepts Microsoft PrinterSettings and PrintController objects. This method returns the current print document object. The PrinterSettings allows you to configure options such as page range and printer selection, while PrintController enables control over the printing process, including handling exceptions, progress reporting, print dialogs, print previews, and other related tasks. Detailed descriptions of PrinterSettings options are provided below the code example. For custom paper sizes, refer to our custom paper size guide.
Which Settings Can I Configure?
:path=/static-assets/pdf/content-code-examples/how-to/print-pdf-printer-setting.csusing IronPdf;
using System.Drawing.Printing;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Testing</h1>");
PrinterSettings settings = new PrinterSettings() {
PrinterName = "Microsoft Print to PDF",
// Number of Copy
Copies = 2,
// Page range to print
FromPage = 2,
ToPage = 4,
};
PrintDocument document = pdf.GetPrintDocument(settings);
// Print
document.Print();What Does Each PrinterSettings Property Control?
Understanding each PrinterSettings property helps you fine-tune your printing workflow:
- CanDuplex: Indicates whether the printer supports duplex (double-sided) printing. If true, printing on both sides of the paper is possible; otherwise, it cannot.
- Collate: Specifies whether multiple PDF files or copies of a PDF document should be collated (organized in order) when printed. When true, the printer collates the copies; when false, it does not.
- Copies: Sets the number of copies of the PDF document to print. It determines how many identical copies of the document will be printed.
- DefaultPageSettings: Represents the default page settings for the printer, including paper size, margins, and orientation. This is crucial for ensuring your PDFs print correctly on different paper formats.
- Duplex: Specifies the duplex (double-sided) printing mode to use. Options include
Duplex.Default,Duplex.Simplex(single-sided),Duplex.Horizontal, andDuplex.Vertical. - InstalledPrinters: Provides a collection of installed printer names on the system. You can iterate through this collection to get the names of available printers.
- IsDefaultPrinter: Indicates whether the printer specified in
PrinterNameis set as the default printer on the system. - IsPlotter: Determines whether the printer is a plotter. Plotter printers are often used for large-format printing, such as for architectural or engineering drawings.
- IsValid: Indicates whether the printer settings are valid and can be used for printing PDF files.
- LandscapeAngle: Specifies the angle (rotation) of landscape orientation for the printer, usually 90 degrees for portrait.
- MaximumCopies: Represents the maximum number of copies that can be specified for printing PDF.
- MaximumPage: Specifies the maximum page number that can be set for printing or conversion.
- MinimumPage: Specifies the minimum page number that can be set for printing or conversion.
- PaperSizes: Provides a collection of supported paper sizes for the printer. You can query this collection to determine available paper sizes.
- PaperSources: Offers a collection of paper sources or trays available for the printer. This can be useful when selecting the paper source for printing PDF files.
- PrinterName: Specifies the name of the printer to use for printing or conversion.
- PrinterResolutions: Provides a collection of available printer resolutions, allowing you to choose the print quality.
- PrintFileName: Gets or sets the file name when printing to a file using
PrintToFile. - PrintRange: Specifies the range of PDF pages to print, such as all pages, a specific range, or a selection. Use this to print specific pages.
- FromPage: Specifies the starting page number for printing or conversion. Printing will begin from this page.
- ToPage: Specifies the ending page number for printing or conversion. Printing will stop after reaching this page.
- PrintToFile: Indicates whether to print to a file instead of a physical printer. When true, you can specify the file path using
PrintFileName. - SupportsColor: Indicates whether the printer supports color printing. If true, color printing is supported; otherwise, it is limited to black and white (monochrome) printing.
How Do I Configure the Default Printer?
Lastly, to configure the default printer to print PDFs, go to the "Printers & Scanners" section of the machine settings. In Windows 10 and 11, navigate to Settings > Devices > Printers & scanners, and click "Manage" next to your desired printer, then select "Set as default." This ensures IronPDF uses your preferred printer when no specific printer name is provided. For creating PDFs from scratch before printing, explore our complete PDF creation tutorial.
Frequently Asked Questions
How can I print PDF files programmatically in C# .NET?
IronPDF enables you to print PDF files programmatically with a single method call using the Print() method. Simply load your PDF file with IronPdf.PdfDocument.FromFile("example.pdf").Print() to send it to the default printer, or specify a printer name to target a different printer.
What control do I have over printer settings when printing PDFs?
IronPDF provides precise control over printer settings including resolution (DPI), both horizontal and vertical. You can use methods that accept Microsoft PrinterSettings and PrintController for advanced control over the PDF printing process.
Can I print to a specific printer instead of the default one?
Yes, IronPDF allows you to specify a different printer by passing its name as a string to the Print method. By default, it uses the system's default printer, but you can easily target any available printer on your system.
Is it possible to print multiple PDF files automatically?
Yes, IronPDF supports printing multiple PDF files programmatically, making it ideal for batch processing and automated workflows. This is particularly useful for applications that generate invoices, reports, or documents requiring physical copies without user intervention.
What platforms are supported for PDF printing?
While IronPDF focuses on .NET applications, Iron Software also offers IronPrint, a dedicated printing library with compatibility across Windows, macOS, Android, and iOS platforms for broader printing capabilities.
How do I get started with PDF printing in my .NET project?
First, install IronPDF in your .NET project, then use the simple workflow: load your PDF file using PdfDocument.FromFile(), and call the Print() method. For advanced settings, use the GetPrintDocument method to access more printing options.







