StandardPrintController.OnStartPage Method (PrintDocument, PrintPageEventArgs)


Begins the control sequence that determines when and how to print a page in a document.

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

public override Graphics OnStartPage(
	PrintDocument document,
	PrintPageEventArgs e


Type: System.Drawing.Printing.PrintDocument

A PrintDocument that represents the document being printed.

Type: System.Drawing.Printing.PrintPageEventArgs

A PrintPageEventArgs that contains data about how to print a page in the document. Initially, the PrintPageEventArgs.Graphics property of this parameter will be null. The value returned from the OnStartPage method will be used to set this property.

Return Value

Type: System.Drawing.Graphics

A Graphics object that represents a page from a PrintDocument.

Exception Condition

The native Win32 Application Programming Interface (API) could not prepare the printer driver to accept data.


The native Win32 API could not update the specified printer or plotter device context (DC) using the specified information.

OnStartPage is called immediately before PrintDocument raises the PrintPage event.

OnStartPrint creates the Graphics object used in printing. After OnStartPrint is called, the OnStartPage method sets the Graphics object to a graphic of a single page. The OnEndPage method clears the Graphics object, while the OnEndPrint method deallocates the object.


for controlling access to printers. Related enumeration: PrintingPermissionLevel.

.NET Framework
Available since 1.1
Return to top