Supporting Pages and Documents

Printer drivers are required to support the following entry points, which support page and document printing:

Printing a document begins with a call from GDI to the driver function DrvStartDoc. This function requests that the driver supply any control information needed to start the printing of a document. DrvStartDoc also sends the document name to the printer driver.

The driver calls EngWritePrinter to send data to the printer by way of the spooler. Along with a buffer of data, the driver should also supply the printer handle received when GDI called DrvEnablePDEV.

DrvStartPage is called to give the driver a chance to send any control codes needed to make sure the page is in the correct format. DrvStartPage should also erase the surface each time it is called.

DrvSendPage requests the driver to process and send the page to the printer by calling EngWritePrinter. If the surface is a bitmap on which the drawing is accumulated, the driver should access the raw bits by using SURFOBJ_Xxx service functions. Drivers that use a device-managed surface and send the bits to the printer as the image is rendered do not send out the drawing in DrvSendPage. During DrvSendPage, the driver should also send the appropriate printer sequences to eject the page from the printer.

If DrvSendPage is slow, the user might want to stop the print job while in this call. In this case, the driver should call EngCheckAbort at least every five seconds to determine whether printing should be terminated. If EngCheckAbort returns TRUE, the processing of the page should be stopped and this function should return FALSE.

DrvEndDoc requests that the driver send any control information needed at the end of a document. The control codes should be sent by way of EngWritePrinter.