How to Set Paper Size for Printing in C#
IronPrint's PrintSettings class gives developers direct control over paper size through the PaperSize property. We assign a value from the PaperSize enum - such as PaperSize.A4 or PaperSize.Letter - and pass the configured PrintSettings object to any of IronPrint's print methods. The printer then uses that exact paper size for the job.
This guide walks through setting standard paper sizes, combining size with other print settings, and printing asynchronously - all with working C# code.
Quickstart: Set Paper Size- Install IronPrint via NuGet:
Install-Package IronPrint - Add
using IronPrint;to the file - Create a
PrintSettingsobject - Set
PaperSizeto any value from thePaperSizeenum (e.g.,PaperSize.A4) - Pass settings to
Printer.Print()orPrinter.PrintAsync()
-
1Install IronPrint with NuGet Package Manager
-
2Copy and run this code snippet.
using IronPrint; // Print a PDF on A4 paper Printer.Print("report.pdf", new PrintSettings { PaperSize = PaperSize.A4 });C# -
3Deploy 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
- Create a
PrintSettingsobject - Set
PaperSizefrom thePaperSizeenum - Pass settings to
Printer.Print() - Run the project to print on the selected paper size
How Do I Set Paper Size When Printing in C#?
We set paper size by assigning a value from the PaperSize enum to the PaperSize property on a PrintSettings object. We then pass that object to any of IronPrint's print methods.
using IronPrint;
// Configure print settings with US Letter paper
PrintSettings settings = new PrintSettings();
settings.PaperSize = PaperSize.Letter;
// Print to the default printer
Printer.Print("invoice.pdf", settings);Imports IronPrint
' Configure print settings with US Letter paper
Dim settings As New PrintSettings()
settings.PaperSize = PaperSize.Letter
' Print to the default printer
Printer.Print("invoice.pdf", settings)We first instantiate PrintSettings, which initializes with the printer's defaults. We then override PaperSize with PaperSize.Letter, which maps to the standard 8.5 × 11 inch format. When we call Printer.Print, IronPrint sends the document to the system's default printer using that paper size.
If no PaperSize is specified, IronPrint uses PaperSize.PrinterDefault, which defers to whatever paper size the operating system's default printer is configured to use. This is an essential detail for production environments where printer configurations vary across machines.
Which Paper Sizes Does the Library Support?
The PaperSize enum includes twelve values covering ISO international standards, common US sizes, and the printer default. The table below lists every available option.
| Enum Value | Standard | Dimensions (mm) | Dimensions (in) |
|---|---|---|---|
PaperSize.A0 | ISO A0 | 841 × 1189 | 33.1 × 46.8 |
PaperSize.A1 | ISO A1 | 594 × 841 | 23.4 × 33.1 |
PaperSize.A2 | ISO A2 | 420 × 594 | 16.5 × 23.4 |
PaperSize.A3 | ISO A3 | 297 × 420 | 11.7 × 16.5 |
PaperSize.A4 | ISO A4 | 210 × 297 | 8.3 × 11.7 |
PaperSize.A5 | ISO A5 | 148 × 210 | 5.8 × 8.3 |
PaperSize.B4 | ISO B4 | 250 × 353 | 9.8 × 13.9 |
PaperSize.B5 | ISO B5 | 176 × 250 | 6.9 × 9.8 |
PaperSize.Letter | US Letter | 216 × 279 | 8.5 × 11.0 |
PaperSize.Legal | US Legal | 216 × 356 | 8.5 × 14.0 |
PaperSize.Executive | US Executive | 184 × 267 | 7.25 × 10.5 |
PaperSize.PrinterDefault | Printer default | Varies | Varies |
Each value maps directly to a well-known paper standard. The PrinterDefault option tells IronPrint to use whatever size the printer is currently configured for - useful when you want to respect end-user printer preferences rather than enforcing a specific format.
For a complete API reference, see the PaperSize class documentation.
How Do I Combine Paper Size with Other Print Settings?
The PrintSettings class exposes several properties beyond PaperSize. We can configure orientation, DPI, margins, copy count, and grayscale mode - all in one object.
using IronPrint;
// Configure full print settings
PrintSettings settings = new PrintSettings
{
PaperSize = PaperSize.A4,
PaperOrientation = PaperOrientation.Landscape,
Dpi = 300,
NumberOfCopies = 3,
PaperMargins = new Margins(15, 15, 15, 15),
Grayscale = false
};
// Print the quarterly report
Printer.Print("quarterly-report.pdf", settings);Imports IronPrint
' Configure full print settings
Dim settings As New PrintSettings With {
.PaperSize = PaperSize.A4,
.PaperOrientation = PaperOrientation.Landscape,
.Dpi = 300,
.NumberOfCopies = 3,
.PaperMargins = New Margins(15, 15, 15, 15),
.Grayscale = False
}
' Print the quarterly report
Printer.Print("quarterly-report.pdf", settings)We use object initializer syntax here for clarity. PaperOrientation rotates the A4 sheet to its wider axis. Dpi at 300 ensures sharp output for charts and fine text. Margins accepts four values in millimeters - top, right, bottom, left - through the Margins constructor. The NumberOfCopies property defaults to 1, but we set it explicitly for readability.
These properties work together without conflict. IronPrint validates the configuration and passes the combined settings to the printer driver as a single print job. For more advanced settings like printer selection and tray configuration, refer to the full print settings guide.
How Do I Print Asynchronously with a Custom Paper Size?
For applications where blocking the main thread is not an option - such as WPF or WinForms apps - we use Printer.PrintAsync. The method accepts the same PrintSettings object and returns a Task.
using IronPrint;
using System.Threading.Tasks;
public class DocumentPrinter
{
public async Task PrintLegalDocumentAsync(string filePath)
{
// Configure Legal paper size
PrintSettings settings = new PrintSettings
{
PaperSize = PaperSize.Legal,
PaperOrientation = PaperOrientation.Portrait,
Dpi = 300
};
// Print asynchronously
await Printer.PrintAsync(filePath, settings);
}
}Imports IronPrint
Imports System.Threading.Tasks
Public Class DocumentPrinter
Public Async Function PrintLegalDocumentAsync(filePath As String) As Task
' Configure Legal paper size
Dim settings As New PrintSettings With {
.PaperSize = PaperSize.Legal,
.PaperOrientation = PaperOrientation.Portrait,
.Dpi = 300
}
' Print asynchronously
Await Printer.PrintAsync(filePath, settings)
End Function
End ClassThis class-based example demonstrates a realistic pattern where a DocumentPrinter service wraps the print logic. We configure PaperSize.Legal (8.5 × 14 inches), which is the standard format for contracts and legal filings. The await keyword ensures the calling thread remains responsive while IronPrint processes the print job.
We can call this method from a button click handler, a background service, or anywhere async/await is supported. IronPrint's async methods - including PrintAsync and ShowPrintDialogAsync - accept the same PrintSettings configuration, so paper size behavior is identical between synchronous and asynchronous paths.
What Are My Next Steps?
We covered how to set paper size in C# using IronPrint's PaperSize enum, from basic single-property configuration to combined settings and asynchronous printing. The PrintSettings class provides a clean, strongly-typed API that eliminates guesswork around paper dimensions.
To continue exploring IronPrint's capabilities:
- Learn how to configure all print settings including printer name, tray, and grayscale
- See working print settings code examples for common scenarios
- Browse the full API reference for classes like
Printer,PrintSettings,PaperSize
Start a free 30-day trial to test paper size configuration in your own projects, or view licensing options for production deployment.
Frequently Asked Questions
How do I set a specific paper size for printing in C# using IronPrint?
To set a specific paper size in C#, use IronPrint's `PrintSettings` class. Assign a value from the `PaperSize` enum, such as `PaperSize.A4` or `PaperSize.Letter`, to the `PaperSize` property, and pass the `PrintSettings` object to the `Printer.Print` method.
Can IronPrint handle multiple paper sizes?
Yes, IronPrint supports multiple paper sizes through the `PaperSize` enum, which includes standard sizes like A4, Letter, Legal, and others. You can select any of these based on your printing needs.
Is it possible to print documents asynchronously with IronPrint?
Yes, IronPrint provides the `Printer.PrintAsync` method to print documents asynchronously, allowing for non-blocking operations, essential for applications like WPF or WinForms.
Which property controls the paper size when printing with IronPrint?
The `PaperSize` property within the `PrintSettings` class controls the paper size when using IronPrint.
Does IronPrint allow customization of printing settings beyond paper size?
Yes, IronPrint allows further customization of printing settings including orientation, DPI, margins, copy count, and grayscale mode through the `PrintSettings` class.
How does IronPrint handle cases where no paper size is specified?
If no `PaperSize` is specified in the `PrintSettings`, IronPrint defaults to `PaperSize.PrinterDefault`, which uses the paper size configured in the operating system's default printer.
What happens if I want to respect end-user printer preferences in IronPrint?
Using `PaperSize.PrinterDefault` allows IronPrint to respect end-user printer preferences, as it uses the size set in the default printer configuration.
How do I install IronPrint for use in a C# project?
You can install IronPrint via NuGet with the command `Install-Package IronPrint`, and then include `using IronPrint;` in your C# files to access its functionalities.
What are some paper sizes supported by IronPrint?
IronPrint supports several paper sizes including ISO standards like A0, A1, A2, A3, A4, A5, and common US sizes like Letter, Legal, and Executive.
How can I access the full API reference for IronPrint?
The full API reference for IronPrint can be accessed through their documentation at the IronSoftware website, providing detailed information on classes and methods.

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.