To print a document, an application calls a variety of Win32 functions. Many of these functions depend on the printer graphics component of the printer driver to perform rendering actions that are specific to the particular type of printer device being used, such as:
·Drawing/rendering text and graphics
·Returning device-specific information
·Marking the starting and ending points of documents and pages
·Creating device-compatible realizations of graphics engine objects such as fonts, brushes, and palettes
In addition, the printer graphics driver portion of the printer driver always supports requests to enable and disable the driver, the PDEV, and the rendering surface. If the surface is device-managed, requests to implement rendering operations are also supported. Requests for the correct device-dependent data and behavior come to the appropriate driver from GDI through the DDI entry points.
Driver functions that return printer-specific information, such as DrvQueryAdvanceWidths, are often used even when no document is actually being printed. This is the case when an application must maintain a WYSIWYG display on the screen, so that what the user arranges on the display will be replicated by the printer whenever a printed copy is requested. For example, to display the line breaks in text properly, a word processor must base line-fitting calculations on character widths and other font metrics from the specific printer’s realization of a font. Without information on how the printer realizes a chosen font, the display could not accurately present the printed document.
Sample code for the printer graphics component of the PostScript printer driver can be found in the print\psprint\pscript directory of the Windows NT DDK.
For DDI functions and implementation details that are common to all graphics drivers, see Supporting the DDI in Part 1. Printer-specific DDI support is described in Supporting DDI Printing and User Interface Functions.
Raster Device Drivers
Microsoft Windows NT includes RasDD to simplify the task of building a raster printer driver. RasDD is capable of carrying out print-related requests — such as printing text, rendering bitmaps, and advancing a page — on most types of printers, which means that the driver writer doesn’t have to write this code. Instead, driver writers have only to build a minidriver for their particular printer. The Unitool is provided with the Windows NT DDK for this purpose. For more information on RasDD and minidrivers, see Printer Minidrivers and RasDD.
RasDD is a data-driven printer driver that uses the minidriver to provide essential data about a printer. For example, RasDD retrieves required information from the minidriver to determine the current resolution of the printer, to identify which fonts are available, and so on.
Note that RasDD does not support plotters, Adobe PostScript printers, or printers that use printer-control languages similar to PostScript. For these devices, a vendor might be able to use the Microsoft-provided drivers, or might have to implement the functions required by GDI for these types of printers.