PrinterSettings.PrintRange Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the page numbers that the user has specified to be printed.

Namespace:   System.Drawing.Printing
Assembly:  System.Drawing (in System.Drawing.dll)

public PrintRange PrintRange { get; set; }

Property Value

Type: System.Drawing.Printing.PrintRange

One of the PrintRange values.

Exception Condition

The value of the PrintRange property is not one of the PrintRange values.

The PrintRange property is used by the PrintDialog.when the user selects a print range. The default PrintRange is AllPages. To enable the user to specify a range of pages to print, the PrintDialog.AllowSomePages property must be set to true. To enable the user to specify the selected pages to print, the PrintDialog.AllowSelection property must be set to true.

During the printing process, in the PrintDocument.PrintPage event, view the PrintRange to determine what should be printed. If PrintRange is PrintRange.SomePages, use the FromPage and ToPage properties to determine what pages should be printed. If PrintRange is PrintRange.Selection, then specify output only for the selected pages.

The FromPage, ToPage and PrintRange can also be set programmatically, though the PrintDocument.PrintPage implementation is the same.

.NET Framework
Available since 1.1
Return to top