Print Processor Design and Implementation Notes

The Microsoft-provided print processor recognizes two printer object data types:

Raw data streams can be printed directly or put into spool files. Raw spool files are device-dependent. The spooled data is destined and formatted for a particular device and does not need to be printable on a device that is different than that. An example of a raw spool file is an encapsulated PostScript file, which is formatted to be understood by the PostScript printer for which it is destined, but which is just raw data to the Windows 95 spooler subsystem.

Enhanced metafiles (EMF) spool files are used to greatly reduce the amount of time between the time the application user initiates a print request and when control is returned back to application by the operating system. This is done by recording the GDI function calls that produce the application's graphic object on the specified printer in an EMF-format file, called a print spool file. The spool file can be built quickly this way and then control is returned to the application. Later, using a background thread, the Windows 95 print spooler performs the more time-consuming task of executing the GDI calls so the graphic object comes out on the printer.

Use of EMF spool files has another advantage besides the speed with which a print request returns to the application: device-independence. The bulk of an EMF is an array of variable-sized records that encode the GDI function calls necessary to reproduce the picture when the EMF is "played back." EMF spool files encode graphics information in such a way as to maintain device independence. In other words, a picture measuring 2 inches by 4 inches on a VGA display and stored in an EMF maintains those original dimensions when it is printed on a 300 dpi laser printer or a 75 dpi dot matrix printer. The key to achieving this device independence is the storage of a reference device context, that is, the context of the device on which the picture was created. For an excellent introduction to the use of EMFs in the Win32 API, see the article "Enhanced Metafiles in Win32" by Dennis Crain on the Microsoft Developer's Network.

Note that the Microsoft-provided default print processor, which is part of SPOOL32.DLL, can perform EMF to raw conversion.

As shown in Typical Printing Process Scenario Using an EMF Spool File, GDI manages the EMF files, not the print processor. It is not noted in that section but it is important to realize that GDI deletes each EMF file as soon as it is finished with it (after each page of rendered print data is sent to the printer). This means that a print job cannot be repeated at the print spooler level. In this release of the Windows 95 print spooler, there is no way for the print processor to manage EMF files to enable a print job to be repeated at the print spooler level. In order to repeat a print job, applications send the data multiple times, which, for example, gives the application the opportunity to manage collating.