How Windows Printing Really Works - Citrix MetaFrame XP

Before we explore the challenges of MetaFrame XP printing and the many solutions, you need to understand how Windows printing works.

Before we explore the challenges of MetaFrame XP printing and the many solutions, you need to understand how Windows printing works. After all, the process by which a MetaFrame XP server prints is no different than any other Windows computer.

There are a surprising number of steps that take place whenever a document is printed, even in a traditional computing environment. However, whether you're printing a document to a local printer, a network printer, or through a Citrix ICA session, the process is basically the same.

Behind the scenes, there are three phases that take place from the moment you hit the "print" button in your application to the moment the finished print job appears on the printer:

  • Phase 1. Windows Application.
  • Phase 2. Print Spooler.
  • Phase 3. Printer.


Figure 7.1: The Windows printing process

Phase 1. Windows Application

When a user requests a printout from a Windows application, the application is responsible for generating its own output in preparation for printing. This output includes items such as formatting the pages properly and adding page numbers. The application processes its printer output via a Windows subsystem called the Graphics Device Interface (GDI). This GDI generates the application's output in the form of an enhanced metafile (EMF).

EMF files are not printer-specific. An application would generate the same EMF file for one printout no matter what kind of printer it was printing to. This is why any Windows application can print to any printer. The EMF file is the common middleman between the application and the printer. In order to understand this, let's consider how the following line of text would be printed:

All people seem to need data processing.

The EMF file for this line of text would contain instructions for the printout, including things like the color, font, characters, and the spacing. The EMF document is a vectorized document that is very small in size. As soon as the EMF file is generated, the application is no longer involved in the printing process. This is why you can close an application before it's done printing and the print job will still finish. The application is only involved in the beginning of the print process to generate the EMF print file. After that, it hands everything over to Windows. Windows then passes the EMF file to the print spooler.

Phase 2. Print Spooler

The print spooler itself performs many printing-related functions. The easiest way to understand what the print spooler does is to break it up into logical steps. The print spooler is responsible for the following three tasks:

  • Receiving the EMF print file from the application via the GDI.
  • Translating the EMF file to another file in the printer's native language.
  • Ensuring that the native file is successfully transferred to the printer.

After receiving the EMF file from the GDI, the print spooler uses the printer drivers to translate the EMF file into a printer spool file (.SPL). The printer spool file contains detailed instructions for the print device. Take another look at our example:

All people seem to need data processing.

In this case, the printer spool file would contain the printer-specific detailed instructions and formatting needed for printing in the printer's native language. This would include resolution, paper tray information, form feed data, and the rasterized image of the page. Printer spool files vary in size depending on the type of printer and how well the drivers are written. In all cases, however, the printer spool files are much larger than the EMF files.

Once the spool file is created, the print spooler ensures that the file is transferred to the printer.

Phase 3. Printer

In the final printing phase, the printer receives the spool file from the print spooler. The printer prints this file no matter what. This is why printers will print garbage if the wrong drivers are used. Using the wrong drivers creates spool files that are not compatible with the printer. However, the printer doesn't know this and it tries to print whatever it receives.


Start the conversation

Send me notifications when other members comment.

Please create a username to comment.