The namespace provides print-related services for Windows Forms applications. Typically, when you print from a Windows Forms application, you create a new instance of the class, set properties, such as and , that describe how to print, and call the method to actually print the document. Calling the method raises the event, which should be handled to perform the document layout for printing. Use the property of the object obtained from the event to specify the output to print. If you are printing a text file, use to read one line at a time from the stream and call the method to draw the line in the graphics object. For more information about this process, see the and classes. You can view an example of printing a text document in the class overview topic. The methods of the class are not supported for printing. Instead, use the methods of the class. When implemented in a derived class, the controls how a is printed. The method invokes the print controller's , , , and methods, which in turn tell the printer how to print the document. For more information about printing dialog boxes, see and . The print-preview process uses a specialized print controller, dialog box, and control. For an example of such a print controller and dialog box, see , , and . Classes within the namespace are not supported for use within a Windows service or ASP.NET application or service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions. If you want to print from a Windows Presentation Foundation (WPF) application, see the namespace.