How to Configure Print Settings

by Chaknith

A print setting refers to a configuration or set of parameters that dictate how a document or content should be printed. These settings include details such as paper size, orientation (e.g., portrait or landscape), print resolution (dots per inch - DPI), the number of copies, printer selection, margins, and options like grayscale printing. Users can customize these settings to achieve specific printing preferences and requirements.

C# NuGet Library for

Install with NuGet

Install-Package IronPrint
C# NuGet Library for

Install with NuGet

Install-Package IronPrint
or
Java PDF JAR

Download DLL

Download DLL

Manually install into your project

Start using IronPDF in your project today with a free trial.

First Step:
green arrow pointer

Check out IronPrint on Nuget for quick installation and deployment. With over 8 million downloads, it's transforming with C#.

C# NuGet Library for nuget.org/packages/IronPrint/
Install-Package IronPrint

Set Print Settings

To configure print settings, instantiate the PrintSettings class and configure it according to your preferences. In the Print or ShowPrintDialog methods, pass the PrintSettings object as the second parameter. The code example below illustrates this usage.

:path=/static-assets/print/content-code-examples/how-to/print-settings-set-print-setting.cs
using IronPrint;

// Configure print setting
PrintSettings printSettings = new PrintSettings();
printSettings.Dpi = 150;
printSettings.NumberOfCopies = 2;
printSettings.PaperOrientation = PaperOrientation.Portrait;

// Print the document
Printer.Print("newDoc.pdf", printSettings);
Imports IronPrint

' Configure print setting
Private printSettings As New PrintSettings()
printSettings.Dpi = 150
printSettings.NumberOfCopies = 2
printSettings.PaperOrientation = PaperOrientation.Portrait

' Print the document
Printer.Print("newDoc.pdf", printSettings)
VB   C#

Available Print Settings

Explore all available print settings options below:

  • DefaultSettings: Initializes a new instance of the IronPrint.PrintSettings class with default values.
  • PaperSize: Sets the paper size used by the printer. The default value is IronPrint.PaperSize.PrinterDefault.
  • PaperOrientation: Specifies the paper orientation (e.g., Portrait or Landscape). The default value is IronPrint.PaperOrientation.Portrait.
  • Dpi: Represents the intended print resolution in dots per inch. The default value is 300, a common setting used in commercial printing. Remarks: The actual DPI used for printing might be limited by the capabilities of the printer.
  • NumberOfCopies: Indicates the number of identical copies to be generated when printing a document. The default value is 1 copy. Remarks: In certain platforms, limitations may exist that prevent the accurate reproduction of multiple copies. In such cases, the specified value of IronPrint.PrintSettings.NumberOfCopies might be ignored, resulting in only one copy being printed.
  • PrinterName: Specifies the name of the printer to use for printing. The default value is null, meaning the current default printer of the operating system will be used. Remarks: If you choose the printer in a PrintDialog, this setting will be ignored. To obtain the available printer names, you can use IronPrint.Printer.GetPrinterNames or IronPrint.Printer.GetPrinterNamesAsync to fetch the printer name list.
  • PaperMargins: Sets the margins to use for printing in millimeters. The default value is null, indicating the use of the default margins provided by the printer.
  • Grayscale: Indicates whether to print in grayscale. Remarks: The default value is false, indicating an attempt to print in color.
  • Flatten: Flatten the PDF before printing, which is useful for displaying form field values and images. The default value is false, indicating that the PDF will be flattened before printing.
  • Tray: Printer tray used for the printing job. This allows users to specify a particular tray from which paper should be fed into the printer. If you choose the tray in a PrintDialog, this setting will be ignored. To obtain the available tray, you can use IronPrint.Printer.GetPrinterTrays(System.String) or IronPrint.Printer.GetPrinterTraysAsync(System.String). The default value is null, indicating the use of the default tray provided by the printer. This tray selection property is available only in Windows.

Chaknith Bin

Software Engineer

Chaknith is the Sherlock Holmes of developers. It first occurred to him he might have a future in software engineering, when he was doing code challenges for fun. His focus is on IronXL and IronBarcode, but he takes pride in helping customers with every product. Chaknith leverages his knowledge from talking directly with customers, to help further improve the products themselves. His anecdotal feedback goes beyond Jira tickets and supports product development, documentation and marketing, to improve customer’s overall experience.When he isn’t in the office, he can be found learning about machine learning, coding and hiking.