Printer Driver Development Concepts (Windows CE 5.0)

Send Feedback

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 called because the printer driver does not render 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. Previous versions of the printer driver requested different color ordering, for more information, see Printer Driver Migration. To conserve memory, GDI renders the document in several bands, which are the horizontal sections of the page. It also makes several calls to the printer driver to send the rendered bands to the printer. Thus, the document is 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 a page to one and one-hundredth of the page, depending on the resources available to GDI. GDI always renders the largest bands possible. The 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.

Aa447571.prntarch(en-us,MSDN.10).gif

As the illustration indicates, the interaction between the application and GDI happens only once, but 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 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 page-description language (PDL). Then, the printer driver calls the port monitor to send the rendered bands to the printer.

Only a small number of the graphics driver functions defined for printer drivers are required in printer drivers for 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 bands for printing.

Printing is supported over parallel ports, universal serial bus (USB) ports, serial ports, infrared (IR) ports, network printer ports, 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 printer driver that is independent of the bus and the corresponding bus driver. The bus driver could be for use with parallel, USB, or serial ports, with Bluetooth technology, depending on the interface the device supports.

See Also

Shell and User Interface

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.