Export (0) Print
Expand All

PrinterSettings Class

Specifies information about how a document is printed, including the printer that prints it, when printing from a Windows Forms application.

System.Object
  System.Drawing.Printing.PrinterSettings

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

[<SerializableAttribute>]
type PrinterSettings =  
    class 
        interface ICloneable 
    end

The PrinterSettings type exposes the following members.

  NameDescription
Public methodPrinterSettingsInitializes a new instance of the PrinterSettings class.
Top

  NameDescription
Public propertyCanDuplexGets a value indicating whether the printer supports double-sided printing.
Public propertyCollateGets or sets a value indicating whether the printed document is collated.
Public propertyCopiesGets or sets the number of copies of the document to print.
Public propertyDefaultPageSettingsGets the default page settings for this printer.
Public propertyDuplexGets or sets the printer setting for double-sided printing.
Public propertyFromPageGets or sets the page number of the first page to print.
Public propertyStatic memberInstalledPrintersGets the names of all printers installed on the computer.
Public propertyIsDefaultPrinterGets a value indicating whether the PrinterName property designates the default printer, except when the user explicitly sets PrinterName.
Public propertyIsPlotterGets a value indicating whether the printer is a plotter.
Public propertyIsValidGets a value indicating whether the PrinterName property designates a valid printer.
Public propertyLandscapeAngleGets the angle, in degrees, that the portrait orientation is rotated to produce the landscape orientation.
Public propertyMaximumCopiesGets the maximum number of copies that the printer enables the user to print at a time.
Public propertyMaximumPageGets or sets the maximum FromPage or ToPage that can be selected in a PrintDialog.
Public propertyMinimumPageGets or sets the minimum FromPage or ToPage that can be selected in a PrintDialog.
Public propertyPaperSizesGets the paper sizes that are supported by this printer.
Public propertyPaperSourcesGets the paper source trays that are available on the printer.
Public propertyPrinterNameGets or sets the name of the printer to use.
Public propertyPrinterResolutionsGets all the resolutions that are supported by this printer.
Public propertyPrintFileNameGets or sets the file name, when printing to a file.
Public propertyPrintRangeGets or sets the page numbers that the user has specified to be printed.
Public propertyPrintToFileGets or sets a value indicating whether the printing output is sent to a file instead of a port.
Public propertySupportsColorGets a value indicating whether this printer supports color printing.
Public propertyToPageGets or sets the number of the last page to print.
Top

  NameDescription
Public methodCloneCreates a copy of this PrinterSettings.
Public methodCreateMeasurementGraphics()Returns a Graphics that contains printer information that is useful when creating a PrintDocument.
Public methodCreateMeasurementGraphics(Boolean)Returns a Graphics that contains printer information, optionally specifying the origin at the margins.
Public methodCreateMeasurementGraphics(PageSettings)Returns a Graphics that contains printer information associated with the specified PageSettings.
Public methodCreateMeasurementGraphics(PageSettings, Boolean)Creates a Graphics associated with the specified page settings and optionally specifying the origin at the margins.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetHdevmode()Creates a handle to a DEVMODE structure that corresponds to the printer settings.
Public methodGetHdevmode(PageSettings)Creates a handle to a DEVMODE structure that corresponds to the printer and the page settings specified through the pageSettings parameter.
Public methodGetHdevnamesCreates a handle to a DEVNAMES structure that corresponds to the printer settings.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsDirectPrintingSupported(Image)Gets a value indicating whether the printer supports printing the specified image file.
Public methodIsDirectPrintingSupported(ImageFormat)Returns a value indicating whether the printer supports printing the specified image format.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSetHdevmodeCopies the relevant information out of the given handle and into the PrinterSettings.
Public methodSetHdevnamesCopies the relevant information out of the given handle and into the PrinterSettings.
Public methodToStringInfrastructure. Provides information about the PrinterSettings in string form. (Overrides Object.ToString().)
Top

Typically, you access a PrinterSettings through PrintDocument.PrinterSettings or PageSettings.PrinterSettings properties to modify printer settings. The most common printer setting is PrinterName, which specifies the printer to print to.

For more information about printing with Windows Forms, see the System.Drawing.Printing namespace overview. If you wish to print from a Windows Presentation Foundation application, see the System.Printing namespace.

The following code example prints a document on the specified printer. The example has three prerequisites:

  • A variable named filePath has been set to the path of the file to print.

  • A method named pd_PrintPage, which handles the PrintPage event, has been defined.

  • A variable named printer has been set to the printer's name.

Use the System.Drawing, System.Drawing.Printing, and System.IO namespaces for this example.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft