Printing in the Windows Environment

In Windows, your application does not print by interacting directly with the printer. Instead, you print by sending output to a printer device context. This means that your application need not concern itself with each printer's specific capabilities or requirements.

Printing in Windows is handled by GDI. In general, the procedure for printing information is similar to that for displaying information; you get a handle to a

device context, then send output to that device context. Normally, an application follows these steps in order to print to the current printer:

1.The application first retrieves information about the current printer, such as its type, device driver, and printer port, from the WIN.INI initialization file.

This information is necessary in order to create a device context for the
current printer.

2.When you send output to a printer device context, Windows activates the print spooler to manage your print request.

3.Your application uses printer escapes to communicate with the printer's device driver.