How to Print Word Documents in C
To print Word documents in C#, use IronWord to create documents, IronPDF to convert them to PDF format, and IronPrint to handle the printing process with customizable settings across multiple platforms.
When building C# applications, you'll often need to generate and print Word documents programmatically. Whether you're creating reports, processing documents, or producing professional outputs, having reliable tools makes all the difference. That's where Iron Software's IronWord, IronPDF, and IronPrint come in - these libraries work together to simplify document creation, conversion, and printing in your C# applications.
This article guides you through using IronPrint for printing, creating Word documents with IronWord, and converting them to PDFs with IronPDF. Whether you're building enterprise reporting systems or automating document workflows, these tools provide everything you need for document processing.
How to Print a Word Document in C#?
- Create a Visual Studio Project
- Install IronWord, IronPDF, and IronPrint libraries
- Create a Word Document using IronWord
WordDocumentclass - Save the Word document using
SaveAsmethod - Create a PDF document using IronPDF's
DocxToPdfRenderermethod - Adjust
PrinterSettingsusing IronPrint - Print using IronPrint
Printer.Printmethod
What is IronPrint?
IronPrint is an effective print library for .NET that gives you complete control over printing in C#. Built by Iron Software, it offers dedicated classes and methods specifically designed for printing tasks, letting you fine-tune every aspect of the printing process. The library works smoothly with both .NET Framework and .NET Core, so you can use it in any type of application.
What are the Key Features of IronPrint?
How Does IronPrint Handle Print Settings?
IronPrint lets you customize every aspect of your print jobs:
- Paper size (Letter, Legal, A4, A3, custom)
- Orientation (Portrait or Environment)
- DPI for quality control
- Number of copies with collation
- Printer selection and validation
- Margins with precise measurements
- Grayscale printing for cost savings
// Example: Advanced print settings configuration
using IronPrint;
// Create complete print settings
PrintSettings advancedSettings = new PrintSettings()
{
PrinterName = "HP LaserJet Pro",
PaperSize = PaperSize.A4,
PrintOrientation = PrintOrientation.Portrait,
Dpi = 600, // High quality print
NumberOfCopies = 3,
Grayscale = true,
PaperMargins = new Margins(50, 50, 40, 40) // Left, Right, Top, Bottom
};
// Apply settings to print job
Printer.Print("document.pdf", advancedSettings);// Example: Advanced print settings configuration
using IronPrint;
// Create complete print settings
PrintSettings advancedSettings = new PrintSettings()
{
PrinterName = "HP LaserJet Pro",
PaperSize = PaperSize.A4,
PrintOrientation = PrintOrientation.Portrait,
Dpi = 600, // High quality print
NumberOfCopies = 3,
Grayscale = true,
PaperMargins = new Margins(50, 50, 40, 40) // Left, Right, Top, Bottom
};
// Apply settings to print job
Printer.Print("document.pdf", advancedSettings);How Does the Printer Class Work?
The Printer class is the heart of IronPrint. It provides methods for printing various file types including images and PDFs. You can integrate it into any printing scenario, and it even supports print dialogs for real-time applications. The ShowPrintDialog method gives users familiar print configuration options when they need them.
Which Platforms Does IronPrint Support?
IronPrint works across Windows, macOS, Android, and iOS - ensuring consistent printing functionality wherever you deploy. This cross-platform support extends to WPF, Windows Forms, and ASP.NET applications.
What Prerequisites Are Needed?
Before starting, make sure you have:
How Do I Create, Convert, and Print Word Documents?
Let's build a C# console application that creates a Word document, converts it to PDF, and prints it using all three libraries.
Step 1: Create a C# Console Application in Visual Studio
- Open Visual Studio and create a new C# Console Application.
- Configure the Project and click "Next."
- From Additional Information, choose your .NET Framework and click "Create."
Step 2: Install Necessary Libraries via NuGet Package Manager
- Open the NuGet Package Manager Console from the Tools menu.
- In the browse tab, search for each library and click install.
Install IronPrint using this command:
Install-Package IronPrint
Install IronWord and IronPDF the same way. For the console, use:
Install-Package IronWord Install-Package IronPdfInstall-Package IronWord Install-Package IronPdfSHELL
Step 3: Create a Word Document using IronWord
Let's start by creating a simple Word document with IronWord:
using IronWord;
using IronWord.Models;
// Code to Create Word File
// Create a TextRun object with sample text
TextRun textRun = new TextRun("Sample text");
// Create a paragraph and add the TextRun to it
Paragraph paragraph = new Paragraph();
paragraph.AddTextRun(textRun);
// Create a Word document object with the paragraph and save it as a .docx file
WordDocument doc = new WordDocument(paragraph);
doc.SaveAs("assets/document.docx");using IronWord;
using IronWord.Models;
// Code to Create Word File
// Create a TextRun object with sample text
TextRun textRun = new TextRun("Sample text");
// Create a paragraph and add the TextRun to it
Paragraph paragraph = new Paragraph();
paragraph.AddTextRun(textRun);
// Create a Word document object with the paragraph and save it as a .docx file
WordDocument doc = new WordDocument(paragraph);
doc.SaveAs("assets/document.docx");Here's what's happening:
- We create a
TextRunwith our text - Add it to a
Paragraph - Create a
WordDocumentand save it
For more complex documents, add formatting, multiple paragraphs, and tables:
using IronWord;
using IronWord.Models;
// Create a more complex Word document
WordDocument complexDoc = new WordDocument();
// Add a title paragraph with formatting
TextRun titleRun = new TextRun("Quarterly Sales Report")
{
FontSize = 24,
Bold = true,
FontFamily = "Arial"
};
Paragraph titleParagraph = new Paragraph();
titleParagraph.AddTextRun(titleRun);
// Add body content
TextRun bodyRun = new TextRun("This report contains sales data for Q4 2023.");
Paragraph bodyParagraph = new Paragraph();
bodyParagraph.AddTextRun(bodyRun);
// Add paragraphs to document
complexDoc.AddParagraph(titleParagraph);
complexDoc.AddParagraph(bodyParagraph);
// Save the document
complexDoc.SaveAs("assets/sales_report.docx");using IronWord;
using IronWord.Models;
// Create a more complex Word document
WordDocument complexDoc = new WordDocument();
// Add a title paragraph with formatting
TextRun titleRun = new TextRun("Quarterly Sales Report")
{
FontSize = 24,
Bold = true,
FontFamily = "Arial"
};
Paragraph titleParagraph = new Paragraph();
titleParagraph.AddTextRun(titleRun);
// Add body content
TextRun bodyRun = new TextRun("This report contains sales data for Q4 2023.");
Paragraph bodyParagraph = new Paragraph();
bodyParagraph.AddTextRun(bodyRun);
// Add paragraphs to document
complexDoc.AddParagraph(titleParagraph);
complexDoc.AddParagraph(bodyParagraph);
// Save the document
complexDoc.SaveAs("assets/sales_report.docx");Output Word Document

Step 4: Convert Word Document to PDF using IronPDF
Now let's convert our Word document to PDF with IronPDF:
using IronPdf;
// Code to convert DOCX file to PDF using IronPDF
// Create a DocxToPdfRenderer instance
var renderer = new DocxToPdfRenderer();
// Render the DOCX document as a PDF
var pdf = renderer.RenderDocxAsPdf("assets/document.docx");
// Save the resulting PDF
pdf.SaveAs("assets/word.pdf");using IronPdf;
// Code to convert DOCX file to PDF using IronPDF
// Create a DocxToPdfRenderer instance
var renderer = new DocxToPdfRenderer();
// Render the DOCX document as a PDF
var pdf = renderer.RenderDocxAsPdf("assets/document.docx");
// Save the resulting PDF
pdf.SaveAs("assets/word.pdf");The process is straightforward:
- Create a
DocxToPdfRenderer - Render the Word document as PDF
- Save the result
Step 5: Print the PDF using IronPrint
Finally, let's print our PDF with IronPrint:
using IronPrint;
using System.Collections.Generic;
// Code for Printing using IronPrint
// Fetch printer names available in the system
List<string> printerNames = Printer.GetPrinterNames();
// Configure print settings
PrintSettings printerSettings = new PrintSettings();
foreach(string printerName in printerNames)
{
if(printerName.Equals("Microsoft Print to PDF"))
{
printerSettings.PrinterName = printerName;
}
}
// Set paper size to A4 and configure margins
printerSettings.PaperSize = PaperSize.A4;
Margins margins = new Margins(30, 10);
printerSettings.PaperMargins = margins;
// Print the PDF with the specified settings
Printer.Print("assets/word.pdf", printerSettings);using IronPrint;
using System.Collections.Generic;
// Code for Printing using IronPrint
// Fetch printer names available in the system
List<string> printerNames = Printer.GetPrinterNames();
// Configure print settings
PrintSettings printerSettings = new PrintSettings();
foreach(string printerName in printerNames)
{
if(printerName.Equals("Microsoft Print to PDF"))
{
printerSettings.PrinterName = printerName;
}
}
// Set paper size to A4 and configure margins
printerSettings.PaperSize = PaperSize.A4;
Margins margins = new Margins(30, 10);
printerSettings.PaperMargins = margins;
// Print the PDF with the specified settings
Printer.Print("assets/word.pdf", printerSettings);This code:
- Gets available printers with
Printer.GetPrinterNames() - Selects a specific printer
- Configures paper size and margins
- Prints the PDF

For more control over copies, multiple pages, grayscale, and DPI, check out these code examples. You can also enable printer dialogs for user interaction.
What Are the Advantages of Using IronPrint for Printing?
Here's why IronPrint excels for C# printing tasks:
Why Does Asynchronous Printing Matter?
IronPrint offers asynchronous functions that prevent print operations from blocking your application. Your UI stays responsive during long print jobs:
// Asynchronous printing example
using IronPrint;
using System.Threading.Tasks;
public async Task PrintDocumentAsync(string filePath)
{
PrintSettings settings = new PrintSettings
{
PrinterName = "Default Printer",
NumberOfCopies = 2
};
// Non-blocking print operation
await Printer.PrintAsync(filePath, settings);
Console.WriteLine("Print job completed!");
}// Asynchronous printing example
using IronPrint;
using System.Threading.Tasks;
public async Task PrintDocumentAsync(string filePath)
{
PrintSettings settings = new PrintSettings
{
PrinterName = "Default Printer",
NumberOfCopies = 2
};
// Non-blocking print operation
await Printer.PrintAsync(filePath, settings);
Console.WriteLine("Print job completed!");
}How Do the Printing Options Improve Functionality?
The Printer class handles various file types including PDF, PNG, JPG, TIFF, and BMP. This versatility means you can print different content types without changing your approach.
Which Platforms Can I Deploy To?
IronPrint runs on Windows, Android, iOS, and macOS. Your printing code works consistently across all platforms, making deployment straightforward.
What Print Settings Can Be Customized?
Through the PrintSettings class, you control:
- Paper size and orientation
- DPI and print quality
- Copies and collation
- Margins and layout
- Duplex printing
- Custom page ranges
How Does IronPrint Integrate with Other Libraries?
IronPrint works smoothly with other Iron Software products like IronBarcode and IronPDF. The consistent API design makes it easy to create, convert, and print documents in one workflow.
Why Is the API Considered User-Friendly?
IronPrint's intuitive method names and complete IntelliSense support make it accessible to all developers. You can add printing functionality quickly without a steep learning curve.
What Support Resources Are Available?
Iron Software provides complete documentation, examples, API references, and best practices. Their support team helps you implement printing features effectively.
How Does IronPrint Improve Control Over Printing?
IronPrint gives you precise control over every aspect of printing. Set exact paper sizes, margins, and parameters to ensure your output meets specific requirements. Monitor printer status and handle errors for reliable print job management.
What Are the Next Steps?
You now have everything needed to create Word documents, convert them to PDFs, and print them in your C# applications. IronWord, IronPDF, and IronPrint work together to provide a complete document handling solution. Whether you're building web, mobile, desktop, or console applications, these tools simplify your document workflows.
For more printing techniques, visit the documentation page. Explore features like batch printing and custom print processors to improve your application's capabilities.
IronPrint licenses start from $799. Download the library and add professional printing to your C# application today.
Frequently Asked Questions
How can I print a Word document without losing formatting in C#?
To print a Word document while maintaining its formatting in C#, use IronWord to create the document, convert it to PDF using IronPDF, and then print it with IronPrint. This ensures that the document's formatting is preserved throughout the process.
What are the benefits of using IronPrint for document printing in C#?
IronPrint offers asynchronous printing, customizable settings such as paper size and orientation, cross-platform compatibility, and seamless integration with Iron Software's other libraries, providing a robust solution for printing tasks in a C# environment.
How do you integrate IronWord, IronPDF, and IronPrint into a C# project?
To integrate these libraries into a C# project, install them via the NuGet Package Manager Console in Visual Studio. Use Install-Package IronWord, Install-Package IronPDF, and Install-Package IronPrint to add the necessary functionalities for Word creation, PDF conversion, and printing.
Can I customize print settings when using IronPrint?
Yes, IronPrint allows you to customize a variety of print settings, including paper size, orientation, DPI, number of copies, printer name, margins, and grayscale printing, giving you full control over the printing process.
Is IronPrint suitable for cross-platform printing tasks?
IronPrint is designed for cross-platform support, allowing it to be deployed on Windows, macOS, Android, and iOS, making it versatile for various development environments.
What steps are involved in creating and printing a Word document in C#?
First, use IronWord to create the Word document. Next, convert it to a PDF using IronPDF's DocxToPdfRenderer. Finally, print the PDF using IronPrint, ensuring the document's formatting is maintained throughout.
How does IronPrint enhance document handling in C# applications?
IronPrint enhances document handling by providing comprehensive print settings, asynchronous printing, and seamless integration with other Iron Software libraries, thereby facilitating efficient document processing and printing in C# applications.
What tools are recommended for generating and printing documents in C#?
Iron Software recommends using IronWord for document creation, IronPDF for conversion to PDF, and IronPrint for the final printing process. This combination ensures high-quality outputs and ease of use.









