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
Classes
Delegates
Enumerations
| 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