1.1.3.1 Required Printer-Driver Functions

All Windows printer drivers must support 24 required functions that are
called by Windows GDI. These functions initialize the device, return device
data, set the printer mode, and generate output. The following sections
briefly describe these functions. For more information about these
functions, see the Microsoft Windows Device Driver Adaptation Guide.


Initialization Functions

The initialization functions start and stop print jobs, allocate memory for
a driver's data structures, deallocate memory that was used by a driver's
data structures, and so on. The following briefly describes each function.

Function   Description
---------------------------------------------------------------------------

Control    The Control function performs device-dependent operations such
           as starting a print job, canceling a print job, processing a new
           band of bitmap data, and so on.

Disable    The Disable function deallocates memory used by the printer
           driver's data structures, and unloads the driver from memory if
           no other device contexts (DCs) exist for this device.

Enable     The Enable function allocates memory for and initializes the
           members within the driver's PDEVICE data structure. This data
           structure contains device-dependent data and device-state
           information.

WEP        The WEP (Windows Exit Program) function signals that the driver
           DLL will be removed from memory, or signals that Windows is
           shutting down.


Information Functions

The information functions retrieve color, font, pen, and brush information
for a printer. The following briefly describes each function.

Function          Description
---------------------------------------------------------------------------

ColorInfo         The ColorInfo function translates physical colors to
                  logical colors and logical colors to physical colors.

DevGetCharWidth   The DevGetCharWidth function returns width values for
                  characters in a given printer font.

DeviceBitmap      The DeviceBitmap function is not supported in the current
                  release of Windows. It must be implemented as a stub
                  function.

EnumDFonts        The EnumDFonts function enumerates the fonts available on
                  a printer.

EnumObj           The EnumObj function enumerates the pens and brushes (if
                  any) which are available on a printer.


Output Functions

The output functions render output on a printer. The following briefly
describes each function.

Function        Description
---------------------------------------------------------------------------

DevBitBlt       The DevBitBlt function sets pels on a page of printer
                paper. These pels correspond to bits in a source bitmap.

DevExtTextOut   The DevExtTextOut function renders text as well as a
                background pattern.

Output          The Output function renders a shape on a page of printer
                paper.

Pixel           The Pixel function sets a single pel on a page of printer
                paper.

ScanLR          The ScanLR function sets pels that appear on a single row
                or scan.

StrBlt          The StrBlt function renders scaled bitmaps.


Attribute Functions

The attribute functions initialize data structures for the printer driver.
The following briefly describes each function.

Function        Description
---------------------------------------------------------------------------

RealizeObject   The RealizeObject function initializes a data structure for
                the specified pen, brush, font, and so on.

SetAttribute    The SetAttribute function is not supported in the current
                release of Windows. It must be implemented as a stub
                function.


Printer-Mode Functions

The printer-mode functions display special dialog boxes. The following
briefly describes each function.

Function        Description
---------------------------------------------------------------------------

DeviceMode      The DeviceMode function displays a dialog box that allows a
                user to select printer options such as paper size, paper
                orientation, output quality, and so on.

ExtDeviceMode   The ExtDeviceMode function also displays a dialog box that
                allows a user to select printer options such as paper size,
                paper orientation, output quality, and so on. Printer
                drivers written for Windows 3.x and later versions support
                this function.


Printer-Escape Functions

The printer-escape functions support device-specific operations. The
following briefly describes these escape functions.

Escape function   Description
---------------------------------------------------------------------------

ABORTDOC          The ABORTDOC escape function signals the abnormal
                  cancellation of a print job.

BANDINFO          The BANDINFO escape function returns information about a
                  band of bitmap data.

ENDDOC            The ENDDOC escape function signals the end of a print job.

NEXTBAND          The NEXTBAND escape function prints a band of bitmap data.

QUERYESCSUPPORT   The QUERYESCSUPPORT escape function specifies whether the
                  driver supports a specified escape.

SETABORTDOC       The SETABORTDOC escape function calls an application's
                  cancellation procedure.

STARTDOC          The STARTDOC escape function signals the beginning of a
                  print job.

The previous list of printer escapes is a list of escapes supported by the
Microsoft Windows Universal Printer Driver (UNIDRV.DLL). It is not a
comprehensive list of all Windows escape functions. Most of the escape
functions now have equivalent Windows API functions with Windows 3.1. The
escapes are supported for backward compatibility, but application
developers are encouraged to start using the new API calls.