Spooling EMF Files

The following illustration shows the sequence of calls that start with an application initiating an EMF spooling request by calling GDI (labeled step 1 in the illustration) and the local print provider writing a print job description file to the disk and calling spooler process with an EndPage or EndDoc function call which signals the availability of an EMF file to despool (these two steps are labeled 8 and 9 in the illustration).

Note one major difference between the EMF spooling scenario shown in the following illustration and the raw print file spooling scenario. In the raw spooling scenario, the local print provider writes the raw spool file to the disk; in the EMF spooling scenario, the GDI writes the EMF spool file to disk and in the EMF despooling scenario it is GDI that reads the EMF spool file and generates the file that is actually printed.

Each of the following paragraphs describes one of the calls in the EMF file spooling process.

  1. The application creates a printer DC and draws an object to the DC, for example a circle, and then calls GDI with an EMF spooling request for a particular printer.
  2. GDI queries the printer driver to find out if the driver supports EMF spooling.
  3. If the driver supports EMF spooling, GDI changes the printer DC to an EMF DC and writes the instructions for rendering the circle to the DC (to the EMF file).
  4. GDI passes the print request to 32-bit GDI because the Windows 95 spooler process is 32-bit code.
  5. GDI32 makes an interprocess call to the spooler subsystem with a description of the print job.
  6. SPOOL32.EXE calls the router to pass the print job description to the print provider that can reach the printer specified by the application. In this example, the router sends the print job to the local print provider but it could send the job to a printer on the network through a network print provider (which is not shown in this picture). Note that the router could send the job to a printer on the network through the network print provider (which is not shown in the illustration). The default Windows 95 spooler spools the network jobs locally, so they show up on the local spooler queue, even those jobs bound for a Windows NT servers. A network print job is spooled and despooled on the client machine, not the server. It is only in the relatively late step of despooling that the remote print server is actually contacted. The way Windows 95 handles network print jobs contrasts with the way they are handled by Windows NT client machines, which use RPC to call the necessary printing APIs on the print server. This way, the print job never shows up on the local spooler queue and the spooling and despooling is handled by the print spooler on the print server. On Windows 95 RPC is not used by the default print spooler. A print spooler that does use RPC is available as an option for Windows 95 client machines.
  7. The router calls the local print provider.
  8. The local print provider creates a job description file and adds a record to the job description file each time it is called for the job, until all the EMF page files have been spooled and each EMF file name and location is recorded in the job description file.
  9. When the local print provider records the information about the last EMF file in the job, it calls the spooler process with an EndDoc function call. This signals the spooler process that a complete job is spooled and ready for despooling. Note that for a multipage job, steps 1 through 8 are repeated once for every page in the job.