Printer Drivers

The printing model is a subset of the printing model defined for Microsoft® Windows®–based desktop platforms. For more information, see the Microsoft Windows 2000 Driver Development Kit (DDK) documentation. Only a small number of the graphics driver functions defined for printer drivers are required in printer drivers for Microsoft Windows CE.

Printer drivers are required to implement only those graphics driver functions that are necessary for gathering printer metrics, setting up the printer, starting and ending print jobs, and preparing rendered strips for printing.

Printing is supported over parallel port, universal serial bus (USB), serial port, and Bluetooth wireless technology. The printing architecture provides application programming interfaces (APIs) that are exposed by the Graphics, Windowing, and Events Subsystem (GWES) to communicate with the printer driver. The printer driver communicates with the port driver that sends the print data over the selected bus. Therefore, for any printing application, you will need a print driver that is independent of the bus and the corresponding bus driver. The bus driver could be a parallel, USB, serial or Bluetooth, depending on the interface the device supports.

The Windows CE graphics device interface (GDI) and display driver perform most of the work involved in printing. At the beginning of the printing process, GDI creates a device context with attributes that are retrieved from the printer driver during a call to DrvEnablePDEV. The display driver, not the printer driver, is used to render subsequent drawing commands that are issued from the application into the device context. Therefore, some drawing functions that are present in a printer driver, such as DrvStrokePath, are never actually called because the printer driver is not rendering the document.

After the document has been rendered, GDI sends the resulting 24-bit blue-green-red bitmap to the printer driver, which formats the bitmap and sends it to the printer. To conserve memory, GDI actually renders the document in several bands, which are the horizontal sections of the page, and makes several calls to the printer driver to send the rendered bands to the printer. The document is therefore rendered several times. GDI optimizes the rendering as much as it can to skip items that are outside of the current band. The band ranges in size from one-quarter of the page down to one one-hundredth of the total page, depending on the resources available to GDI. GDI always renders the largest bands possible. The band bitmaps passed to the printer driver are in the pixel format requested by the printer driver.

The following illustration shows the relationship between the various system components involved in printing.

In the illustration, the interaction between the application and GDI happens only once, while the interactions between GDI, the display driver, and the printer driver happen once for each band. The port monitor is responsible for routing data from the printer driver to the actual hardware port that connects to the printer. The display driver shown in the diagram is the system's currently loaded graphics driver.

The printer driver converts the bitmap data from a GDI bitmap format into the format that is required by the printer. This can include such operations as color reduction to the color space of the printer, data compression, and data conversion into the format that is used by the printer, a format sometimes known as a printer description language. Then, the printer driver calls the port monitor to send the rendered strips to the printer.

See Also

Printer Driver Architecture | Printer Driver Samples | Printer Driver Registry Settings

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.