What is an EMF spool file?

When an application sends pages to a printer they are held in an intermediary file which the application can write to and the printer driver can read from simultaneously. This speeds up the print process as control can return to the application before the printer has finished printing the document.

Usually this spool file is held in the raw printer page definition language (which could be PCL, PostScript or one of many other options) but in Windows NT, 2000, XP and 2003, it is possible to make the spooler use a different, more device independent format known as an EMF spool file.

The file layout of an EMF spool file is not officially documented by Microsoft, but this article reveals that it is a series of enhanced metafile records (one for each page) and a number of other record types which are specific to the business of printing these pages.

SRT_PAGE

This record contains a Windows standard enhanced metafile, consisting of an EMF header and one or more EMF graphics record structures. The EMF header record gives you the dimensions of the boundary rectangle (the area inside the print margins), the number of graphics records that make up the page, and the file size of this single EMF page.

SRT_DEVMODE

This record contains the device settings that apply to the rest of the pages in the document (or until another DEVMODE record is encountered that overrides it). The DEVMODE structure holds details such as the number of copies, the page orientation (landscape versus portrait), the paper size and paper source, and so on.

SRT_EOF

This signifies the end of the spool file records.

Using the EMF spoolfile viewer

To view an EMF spool file, select the menu File -> Open. A dialog box will appear to allow you to browse to the spool file (extension .spl). These are typically held in your $winnt$\System32\spool\ directory. (I have included some samples with this application code as well.)

The viewer allows you to go to a particular page, zoom in and out, and even print the spool file using the following menu options:

Uses for EMF spoolfiles

Since pretty much every application has a print function, the EMF spool file can serve as a quick and dirty portable document format (though much less featured than a PDF). Thus if you have an application and you want to send a file to someone who doesn't have that application to view, you simply use the application's print function and send them the spool file.

In addition, knowing the structure of the spool file means that it is possible to parse the file to extract information from it. You might want to extract just the text from a printed document for archival purposes, and you can do this by parsing the file and extracting the EMR_EXTTEXTOUTA and EMR_EXTTEXTOUTW records.

Acknowledgements

The source code in this application draws heavily on the work of Feng Yuan and Christophe Lindemann as well as numerous others on the various forums and news groups.

first !
My English is very poor
Don't tease me, oh
The second i want to know about ‘How many kinds of format SPL file’ becouse i use the EMF Viewer's API take me very happy but i have some error for the program , i think it's spl file is not a emf format, but the spl file Of the printer 'HP 1005' , i dont know the how many kinds of format spl file , So I don't know To deal with this program ,can you help me Understand this concept ? I really hope to get your help! Thank you!

Thank you for your advice,
According to your steps,
I found the print processor and his configuration, There are two print processor,The first is the HP1005PrintProc there are only two data types are optional:'RAW'/'IMF' , The second is to own a 'winprint' should be system , Contains the 'NT EMF 1.008'/' NT EMF 1.007' / ' RAW'/ 'TEXT' and so on

I chose 'NT EMF 1.008'
But I found the documents produced or do not conform to the EMF format is this why?

================
and i found the Error:
in System.Drawing.Imaging.Metafile..ctor(Stream stream)
in EMFSpoolfileReader.EMFPage..ctor(BinaryReader FileReader)