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

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.

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.