This documentation is archived and is not being maintained.

System.Drawing.Printing Namespace

The System.Drawing.Printing namespace provides print-related services.

Typically, you create a new instance of the PrintDocument class, set the properties that describe what to print, and call the Print method to actually print the document.

Use the PrintPageEventArgs.Graphics property to specify the output to print. If you are printing a text file, use StreamReader in the following manner: read one line at a time from the stream and call the DrawString method to draw the line in the graphics object. For more information on this process, see the Graphics and StreamReader classes.

When implemented in a derived class, the PrintController controls how a PrintDocument is printed. The PrintDocument.Print method invokes the print controller's OnStartPrint, OnEndPrint, OnStartPage, and OnEndPage methods, which in turn tell the printer how to print the document. For more information on printing dialogs, see PrintDialog and PageSetupDialog.

The print-preview process uses a specialized print controller, dialog, and control. For an example of such a print controller and dialog, see PreviewPrintController, PrintPreviewDialog, and PrintPreviewControl.

Namespace hierarchy


Class Description
InvalidPrinterException Represents the exception that is thrown when trying to access a printer using invalid printer settings.
Margins Specifies the margins of a printed page.
MarginsConverter Provides a MarginsConverter for Margins.
PageSettings Specifies settings that apply to a single, printed page.
PaperSize Specifies the size of a piece of paper.
PaperSource Specifies the paper tray from which the printer gets paper.
PreviewPageInfo Specifies print preview information for a single page. This class cannot be inherited.
PreviewPrintController Specifies a print controller that displays a document on a screen as a series of images.
PrintController Controls how a document is printed.
PrintDocument Defines a reusable object that sends output to a printer.
PrinterResolution Represents the resolution supported by a printer.
PrinterSettings Specifies information about how a document is printed, including the printer that prints it.
PrinterSettings.PaperSizeCollection Contains a collection of PaperSize objects.
Contains a collection of PaperSource objects.
Contains a collection of PrinterResolution objects.
PrinterUnitConvert Specifies a series of conversion methods that are useful when interoperating with the Win32 printing Application Program Interface (API). This class cannot be inherited.
PrintEventArgs Provides data for the BeginPrint and EndPrint events.
PrintingPermission Controls access to printers. This class cannot be inherited.
PrintingPermissionAttribute Allows declarative printing permission checks.
PrintPageEventArgs Provides data for the PrintPage event.
QueryPageSettingsEventArgs Provides data for the QueryPageSettings event.
StandardPrintController Specifies a print controller that sends information to a printer.


Delegate Description
PrintEventHandler Represents the method that will handle the BeginPrint or EndPrint event of a PrintDocument.
PrintPageEventHandler Represents the method that will handle the PrintPage event of a PrintDocument.
QueryPageSettingsEventHandler Represents the method that handles the QueryPageSettings event of a PrintDocument.


Enumeration Description
Duplex Specifies the printer's duplex setting.
PaperKind Specifies the standard paper sizes.
PaperSourceKind Standard paper sources.
PrinterResolutionKind Specifies a printer resolution.
PrinterUnit Specifies several of the units of measure that the Win32 Application Programming Interface (API) uses for printing.
PrintingPermissionLevel Specifies the type of printing that code is allowed to do.
PrintRange Specifies the part of the document to print.

See Also

.NET Framework Class Library | PageSetupDialog | PrintDialog | PrintPreviewControl | PrintPreviewDialog | Windows Forms Print Support