Windows Printing Software, Articles and Press Release


SPL - Microsoft® Windows Spool File Format

This article is licensed under the GNU Free Documentation License. It uses material from the Undocumented Printing.

The print job’s spooled data is contained in a spool file.

For each print job there are two spool files generated by the Windows® NT/2000 spooler. One file with the .SHD extension for job settings, and one with the .SPL extension for the drawing commands.

:!: Microsoft has released official documentation about this format in connection to the Open Protocol Specifications.
[MS-EMF (Enhanced MetaFile)SPOOL]: Enhanced Metafile Spool Format Specification
[MS-EMF (Enhanced MetaFile)]: Enhanced Metafile Format Specification

:!: Warning
While you might use the information you find here to extract EMF (Enhanced MetaFile) and other data from the Windows spoolfiles, you should remember, that this information is undocumented and might change without prior notice!

You can probably locate the information about the EMF (Enhanced MetaFile) structs in   the spool file format. But note that one major caveat with this   approach is that since the spool file format is MS proprietary,   it might change in future releases without notice. So if your   driver is dependent on a particular spool file format, it could   break on future releases. This is the reason for us recommending   that you not rely on the spool file format.  //Ashwin, Microsoft 

This document includes documentation for the EMF (Enhanced MetaFile)-SPL file format.

The Windows® SPL files can include RAW data or EMF (Enhanced MetaFile) data.

RAW-SPL

In the case of RAW data, the content of the file is exactly the same as the data send to the printer.

So this data could be personal computerL, PostScript, ESC-P, CaPSL, Prescribe or similar.

When is RAW used?

A Print Processor must support the RAW data type or it simply won’t work. Beyond that, the data types it supports have little effect.

The decision on whether to spool EMF (Enhanced MetaFile) or RAW is made by GDI based on various factors.

More information on the Spool Files page.

EMF (Enhanced MetaFile)-SPL

EMF (Enhanced MetaFile) stands for Enhanced Metafile. You can find information on standard EMF (Enhanced MetaFile) in the Windows Platform SDK.

Basically the SPL files consist of one or more standard EMF (Enhanced MetaFile) files, surrounded by some extra records. The EMF (Enhanced MetaFile) SPL files contain a special version of EMF (Enhanced MetaFile), not compatible with standard EMF (Enhanced MetaFile), although most of the records are the same.

SPL_HEADER    SMR_PAGE_EMF (Enhanced MetaFile)/WMF (Windows MetaFile)  SMR_OFFS_FONT  SMR_OFFS_FONT  SMR_EO_PAGE    SMR_PAGE_EMF (Enhanced MetaFile)/WMF (Windows MetaFile)  SMR_DEVMODE  SMR_OFFS_FONT  SMR_OFFS_FONT  SMR_OFFS_FONT  SMR_EO_PAGE

Records

Header

The SPL files always start with the SPL_HEADER, this record differs in the way, that the specified recordsize includes both header and data of the SPL header.

Base Record Structure

The records following the SPL_HEADER, always start with (include) the SMR base record. The nSize member specifies the size of the following data, including the size of the remaining header members and the data. nSize = (RECORDSIZE - sizeof(SMR)).

So the SMR_EO_PAGE.nSize member would be = 8, as the complete record is 16 bytes (SMR + 8)

Page Record

Every page contained in the file consists of at least one SMR_PAGE_EMF (Enhanced MetaFile) and one SMR_EO_PAGE record. The SMR_PAGE_EMF (Enhanced MetaFile) contains the EMF (Enhanced MetaFile) data for the page.

Between these 2 records, every page can include some additional records like DEVMODE and font data for the page.

Font Records

You can find more information about the various font data formats used in the SPL files, at the Font Formats page.

EOF Record (End of File)

SPL files can also include an SMR_PAGE_EMF (Enhanced MetaFile) record specifying a length of 0. This record indicates the end of file. The following data should not be considered valid.

Definition

/*****************************************************************************   * Terms of Use   * Copyright © Christoph Lindemann. All rights reserved.   *   * Permission is granted to copy, distribute and/or modify this document under   * the terms of the GNU Free Documentation License, Version 1.2 or any later    * version published by the Free Software Foundation; with no Invariant    * Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the    * license is included in the section entitled "GNU Free Documentation    * License".   *----------------------------------------------------------------------------   * History:   *  24-03-2004  Initial Document   *     Christoph Lindemann, christoph@lindemann.nu   *     *  24-03-2004  Release to public   *     Christoph Lindemann, christoph@lindemann.nu   *     *  10-06-2004  Added SPL_SMR_PADDING   *     Thanks to Fabian Franz   *     *  11-06-2004  CORRECTED FAULTY INFORMATIONS   *     Christoph Lindemann, christoph@lindemann.nu   *     *  14-06-2004  Added some text explaining the format.   *     Christoph Lindemann, christoph@lindemann.nu   *     *  19-05-2005  Corrected typos in SMREXT definition   *     Thanks to Peter Wasser   *     *  02-11-2005  Updated End-Of-Page records 0x0D and 0x0E   *     Thanks to Krzys   *   *  15-06-2006  Updated EMF (Enhanced MetaFile) Spool Metafile record types   *     Christoph Lindemann, christoph@lindemann.nu   *   *  16-06-2006  Added information about PRESTARTPAGE record   *     Christoph Lindemann, christoph@lindemann.nu   *   *  08-04-2008  Updated with new info found in MS Official Released Specs.   *     Christoph Lindemann, christoph@lindemann.nu   *   *****************************************************************************/     //Spool Metafile constants  #define SPLMETA_SIGNATURE 0x00010000 //Version 1.0      // Spool Metafile record types  // Please note remarks in the corresponding struct definitions  #if(WINVER >= 0x0400)  /* Windows NT Workstation 4.0 SP2 */  #define SRT_METAFILE          0x00000001 /*  1 Enhanced Meta File (EMF (Enhanced MetaFile)) NT4             */                                           #define SRT_ENGINE_FONT       0x00000002 /*  2 A TrueType font definition               */  #define SRT_DEVMODE           0x00000003 /*  3 DevMode                                  */  #define SRT_TYPE1_FONT        0x00000004 /*  4 A PostScript Type 1 font definition      */  #define SRT_PRESTARTPAGE      0x00000005 /*  5 The start page for EPS (Encapsulated PostScript)                   */  #if (WINVER >= 0x0500)  /* Windows 2000 */  #define SRT_DES (Data Encryption Standard)IGNVECTOR      0x00000006 /*  6 A font design vector (Multiple Master)   */  #define SRT_SUBSET_FONT       0x00000007 /*  7 A subset font definition                 */  #define SRT_DELTA_FONT        0x00000008 /*  8 A delta font definition                  */  #define SRT_FORM_METAFILE     0x00000009 /*  9 EMF (Enhanced MetaFile)                                      */  #define SRT_BW_METAFILE       0x0000000A /* 10 Monochrome EMF (Enhanced MetaFile)                           */   #define SRT_BW_FORM_METAFILE  0x0000000B /* 11 Monochrome EMF (Enhanced MetaFile)                           */  #define SRT_METAFILE_DATA (Advanced Technology Attachment)     0x0000000C /* 12 Enhanced Meta File (EMF (Enhanced MetaFile)) Win2k           */   #define SRT_EXT_METAFILE      0x0000000D /* 13 An offset to document content            */  #define SRT_EXT_BW_METAFILE   0x0000000E /* 14 An offset to monochrome document content */  #define SRT_EXT_ENGINE_FONT   0x0000000F /* 15 An offset to a TrueType font definition  */  #define SRT_EXT_TYPE1_FONT    0x00000010 /* 16 An offset to a PS Type 1 font definition */  #define SRT_EXT_DES (Data Encryption Standard)IGNVECTOR  0x00000011 /* 17 An offset to a font design vector        */  #define SRT_EXT_SUBSET_FONT   0x00000012 /* 18 An offset to a subset font definition    */  #define SRT_EXT_DELTA_FONT    0x00000013 /* 19 An offset to a delta font definition     */  #define SRT_EXT_PS_JOB_DATA (Advanced Technology Attachment)   0x00000014 /* 20 Document-level PostScript data           */  #if (WINVER >= 0x0501)  /* Windows XP */  #define SRT_EXT_EMBED_FONT    0x00000015 /* 21 an offset to embedded font identifiers   */  #endif  #endif  #endif  /*****************************************************************************   * SPL_HEADER   *----------------------------------------------------------------------------   * SPL file header for EMF (Enhanced MetaFile)SPL files   *****************************************************************************/  typedef struct tagSPLHEADER {       DWORD SIGNATURE;       DWORD nSize;            // record size INCLUDING header       DWORD offDocumentName;  // offset of Job Title from start       DWORD offPort;          // offset of portname from start      BYTE HeaderData[];   } SPL_HEADER, *PSPL_HEADER;     /*****************************************************************************   * SMR - Base record   *----------------------------------------------------------------------------   * Base record type for the Spool Metafile.   *****************************************************************************/  typedef struct tagSMR{       DWORD iType; // Spool metafile record type       DWORD nSize; // length of the following data                    // NOT INCLUDING this header   } SMR, *PSMR;     /*****************************************************************************   * SMREXT - Extended record   *----------------------------------------------------------------------------   * Contains neg. distance to start of Data   *****************************************************************************/  typedef struct tagSMREXT{       SMR smr;       DWORD DistanceLow;       DWORD DistanceHigh;  } SMREXT, *PSMREXT;     /*****************************************************************************   * SMRPRESTARTPAGE - PRESTARTPAGE   *----------------------------------------------------------------------------   * Written before pagedata is written to spoolfile   * Used as a temporary "end of file" indicating following data is not   * fully spooled yet   *****************************************************************************/  typedef struct tagSMRPRESTARTPAGE{       SMR smr;       DWORD Unknown1;       DWORD Unknown2; //0xFFFFFFFF  } SMRPRESTARTPAGE, *PSMRPRESTARTPAGE;     /*****************************************************************************   * SMR_PAGE - EMF (Enhanced MetaFile)/Page data   *----------------------------------------------------------------------------   * EMF (Enhanced MetaFile)/Page data   *****************************************************************************/  typedef struct tagSMRPAGE{       SMR smr;   // if smr.nSize == 0, this indicates EndOfFile      BYTE EMF (Enhanced MetaFile)Data[];  } SMR_PAGE, *PSMR_PAGE;     /*****************************************************************************   * SMR_DEVMODE - DEVMODE data   *----------------------------------------------------------------------------   * DEVMODE data   *****************************************************************************/  typedef struct tagSMRDEVMODE{       SMR smr;       BYTE DEVMODEData[];  } SMR_DEVMODE, *PSMR_DEVMODE;     /*****************************************************************************   * SMR_FONT - FONT data   *****************************************************************************/  typedef struct tagSMRFONT{       SMR smr;       BYTE FONTData[];  } SMR_FONT, *PSMR_FONT;     /*****************************************************************************   * SMR_EXTFONT - Extended Font Data   *----------------------------------------------------------------------------   * Contains neg. distance to start of   * Font Data   * Font data is typically embedded as   * GDICOMMENT in the prev EMF (Enhanced MetaFile) data   *****************************************************************************/  typedef struct tagEXTFONT{       SMREXT smrext;  } SMR_EXTFONT, *PSMR_EXTFONT;     /*****************************************************************************   * SMR_EOPAGE - End of Page   *----------------------------------------------------------------------------   * Contains neg. distance to   * start of page record   *****************************************************************************/  typedef struct tagSMREOPAGE{       SMREXT smrext;   } SMR_EOPAGE, *PSMR_EOPAGE;

More information, examples and software tools

Books

Windows Graphics Programming: Win32 GDI and DirectDraw by Feng Yuan.
The world’s most complete guide to Windows graphics programming!

  • Win32 GDI and DirectDraw: Accurate, under the hood, and in depth
  • Beyond the API: Internals, restrictions, doance, and real-life problems
  • Complete: Pixel, lines, curves, filled area, bitmap, image processing, fonts, text, metafile, printing
  • And more

http://www.amazon.com/exec/obidos/ASIN/0130869856

Articles, Code and Tools

EMF (Enhanced MetaFile) Printer Spool File Viewer (Article, Code & Tool)
A viewer application for EMF (Enhanced MetaFile) format spool files.
http://www.codeproject.com/dotnet/EMF (Enhanced MetaFile)SpoolViewer.asp

Spool File View (Tool)
An EMF (Enhanced MetaFile)-Spool file viewer. Shows information about SHD and SPL files. For developers.
splview.zip

O&K Printer Viewer (Tool)
Viewing and saving as image the printed documents.

http://www.prnwatch.com/pviewer.html

Metafile Extraction (Article)
By Vipin Aravind
Part 1:http://www.microsoft.com/india/msdn/articles/130.aspx
Part 2:http://www.angelfire.com/extreme4/vprint/MetafileExtractionPartII.htm

PrintMirror (Driver)
Open Source printer which creates EMF (Enhanced MetaFile) files

http://sourceforge.net/projects/printmirror/

SPL Viewer (Tool)
Viewer for SPL files. Freeware. German
http://www.lvbprint.de/html/splviewer.htm

EMF (Enhanced MetaFile) Printer(Driver)
Virtual printer for creation of EMF (Enhanced MetaFile)s and many more! http://emfprinter.sourceforge.net

EMF (Enhanced MetaFile)explorer (Tool)
A program to manipulate Windows Metafile data. This open-source product displays, scales, rotates documents, and, using GDI+, optionally enhances their quality.
http://frazmitic.free.fr/emfexplorer/

 

Submit yous article, press release or software

 

Webhotell - 3d Ready Lcd Tv - Memory Garden - Celeb News - Florida Vacation Rentals

Editor's Choice

 

 

 

 

 

HSLAB Print Logger
HSLAB Print Logger EE
Print Spooler Utility
Adolix PDF Converter
HSLAB Print Logger SE
HSLAB Print Logger SBE
Java Printing Tool
Miraplacid Text Driver
WFil2PRN - Windows File Printer
PCLCodes

 

Popular Software

DOS2USB
Remote Queue Manager Personal
novaPDF Std
Advanced Directory Printer
ChequeSystem Electronic Cheque Writer
RPM Remote Print Manager Select
Print Censor Professional
@SwIt Printfil
Print Censor Personal
BookPrintXP