windowsprintingprint-spooler-api

understanding print-spooler Raw .spl structure


i have a project that is supposed to read a spooler .spl file and add extra information at the end of the file then forward it to another printer. My biggest headache is getting the structure of the .spl file to be able to extract just the printed text and manipulate it.


Solution

  • The problems you need to solve will vary depending on your ability to control the spool format. The behaviour of Windows spooling is described in this archived website.

    I will quote from one of my comments on a previous answer:

    "The print system isn't aware if any particular file is being printed, just a series of print API calls (e.g. GDI); Depending on many factors the print system might spool the file as EMF or XPS or the printer's Page Description Language (PCL, PostScript etc)."

    The default in older versions of Windows is EMF, which is basically a stream of serialised GDI calls, and because this API evolved, there are different versions of EMF. You could reverse engineer this format, or there are third-party EMF viewers (or use the old Windows Photo Viewer) and libraries.

    XPS is the spool format for XPSDrv drivers. "An XPS file is a ZIP archive using the Open Packaging Conventions, containing the files which make up the document. These include an XML markup file for each page, text, ..."

    Otherwise if you need to deal with raw PDLs, you'll need to handle PostScript, PCL6, etc.