An EMF Spoolfile Viewer

What Is an EMF Spool File?

When an application sends pages to a printer, they are held in an intermediary file that the application can write to and the printer driver can read from simultaneously. This speeds up the print process because 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 knowns a an EMF spool file.

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

To generate EMF spool files from Windows NT, 200, XP, and 2003, select the printer properties and on the scheduling tab select "Keep printed documents." This will create a .shd and .spl file for each document you print in your spool directory (usually C:\WINNT\system32\spool).

The EMF Spool File Record Types

The spool file is composed of the following record types:

Private Enum SpoolerRecordTypes
   SRT_EOF           = &H0       ' // int32 zero
   SRT_RESERVED_1    = &H1       '*  1                               */
   SRT_FONTDATA      = &H2       '   2 Font Data                     */
   SRT_DEVMODE       = &H3       '   3 DevMode                       */
   SRT_FONT2         = &H4       '   4 Font Data                     */
   SRT_RESERVED_5    = &H5       '   5                               */
   SRT_FONT_MM       = &H6       '   6 Font Data (Multiple Master)   */
   SRT_FONT_SUB1     = &H7       '   7 Font Data (SubsetFont 1)      */
   SRT_FONT_SUB2     = &H8       '   8 Font Data (SubsetFont 2)
   SRT_RESERVED_9    = &H9
   SRT_UNKNOWN       = &H10      ' // int unknown...
   SRT_PAGE          = &HC       ' 12  Enhanced Meta File (EMF)      */
   SRT_EOPAGE1       = &HD       ' 13  EndOfPage                     */
   SRT_EOPAGE2       = &HE       ' 14  EndOfPage                     */
   SRT_EXT_FONT      = &HF       ' 15  Ext Font Data                 */
   SRT_EXT_FONT2     = &H10      ' 16  Ext Font Data                 */
   SRT_EXT_FONT_MM   = &H11      ' 17  Ext Font Data (Multiple Master)
   SRT_EXT_FONT_SUB1 = &H12      ' 18  Ext Font Data (SubsetFont 1)  */
   SRT_EXT_FONT_SUB2 = &H13      '* 19  Ext Font Data (SubsetFont 2) */
   SRT_EXT_PAGE      = &H14      ' 20  Enhanced Meta File? 
   SRT_JOB_INFO      = &H10000   ' // int length, wchar jobDescription
End Enum

Of these, the most important record types are:


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.


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.


This signifies the end of the spool file records.

An EMF Spoolfile Viewer

Using the EMF Spoolfile Viewer

To view an EMF spool file, select the menu File -> Open. A dialog box will appear, allowing 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.)

Uses for EMF Spoolfiles

Because pretty much every application has a print function, the EMF spool file can serve as a quick and dirty portable document format. Thus, if you have an application and you want to send a file to someone who doesn't have that application to view it, 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 is possible to parse the file and extract information from it. You might want to extract just the text from a printed document for archival purposes; you can do this by parsing the file and extracting the EMR_EXTTEXTOUTA and EMR_EXTTEXTOUTW records.

About the Author

Duncan Jones

Freelance developer with 10 years experience in Visual basic and SQL - now moving on up to the next generation with .NET



  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Today's agile organizations pose operations teams with a tremendous challenge: to deploy new releases to production immediately after development and testing is completed. To ensure that applications are deployed successfully, an automatic and transparent process is required. We refer to this process as Zero Touch Deployment™. This white paper reviews two approaches to Zero Touch Deployment--a script-based solution and a release automation platform. The article discusses how each can solve the key …

  • Learn How A Global Entertainment Company Saw a 448% ROI Every business today uses software to manage systems, deliver products, and empower employees to do their jobs. But software inevitably breaks, and when it does, businesses lose money -- in the form of dissatisfied customers, missed SLAs or lost productivity. PagerDuty, an operations performance platform, solves this problem by helping operations engineers and developers more effectively manage and resolve incidents across a company's global operations. …

Most Popular Programming Stories

More for Developers

RSS Feeds