In computing, spooling is a specialized form of multi-programming for the purpose of mediating between a computer application and a slow peripheral, such as a printer. Spooling allows programs to "hand off" work to be done by the peripheral and then proceed to other tasks, or to not begin until input has been transcribed.
A dedicated program, the spooler, maintains an orderly sequence of jobs for the peripheral and feeds it data at its own rate. Conversely, for slow input peripherals, such as a card reader, a spooler can maintain a sequence of computational jobs waiting for data, starting each job when all of the relevant input is available.
Spooling is a combination of buffering and queueing.
MicroSoft support: Default Windows Spool Directory and Permissions.
Windows spools print jobs by default to the following directory as the they are processed:
%SystemRoot%\SYSTEM32\SPOOL\PRINTERS, such as: "C:\Windows\System32\spool\PRINTERS". 该路径可以在“打印服务器 属性 - 高级 - 后台打印文件夹”中设置。
The print jobs are then sent to the print device, and each job is deleted from the directory once the print job is complete.
Magnetic recording tape wound onto a 'spool' may have contributed to the origin of the term.
In computers, a printer driver or a print processor is a piece of software that converts the data to be printed to the form specific to a printer. The purpose of printer drivers is to allow applications to do printing without being aware of the technical details of each printer model.
Wikipedia: LPD protocol.
The Line Printer Daemon protocol / Line Printer Remote protocol (LPD/LPR) is a network protocol for communicating print jobs between clients (use LPR) and print servers (use LPD).
The Common Unix Printing System (or CUPS), which is common on modern Linux distributions and also found on Mac OS X, supports LPD as well as the Internet Printing Protocol (IPP).
A server for the LPD protocol listens for requests on TCP port 515. A request begins with a byte containing the request code, followed by the arguments to the request, and is terminated by an ASCII LF character (thus the name Line Printer Daemon).
It allows programs to send one or more print jobs to the Printer or print server and perform administration such as querying the status of a printer, obtaining the status of print jobs, or cancelling individual print jobs.
Like all IP-based protocols, IPP can run locally or over the Internet. Unlike other printing protocols, IPP also supports access control, authentication, and encryption, making it a much more capable and secure printing mechanism than older ones.
IPP is implemented using the Hypertext Transfer Protocol (HTTP) and inherits all of the HTTP streaming and security features.
IPP uses the traditional client-server model, with clients sending IPP request messages with the MIME media type "application/ipp" in HTTP POST requests to an IPP printer.
The IPP response is sent back to the client in the HTTP POST response, again using the "application/ipp" MIME media type.
IPP uses TCP with port 631 as its well-known port. IPP implementations such as CUPS also use UDP with port 631 for IPP printer discovery.
IPP began as a proposal by Novell for the creation of an Internet printing protocol project in 1996. The result was a draft written by Novell and Xerox called the Lightweight Document Printing Application (LDPA), derived from ECMA-140: Document Printing Application (DPA).
CUPS (Common Unix Printing System) is a modular printing system for Unix-like computer operating systems which allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.
The original design of CUPS used the LPD protocol, but due to limitations in LPD and vendor incompatibilities, the Internet Printing Protocol (IPP) was chosen instead.
CUPS consists of a print spooler and scheduler, a filter system that converts the print data to a format that the printer will understand, and a backend system that sends this data to the print device.
The CUPS scheduler implements IPP over HTTP/1.1. A helper application (cups-lpd) converts LPD requests to IPP. The scheduler also provides a web-based interface for managing print jobs, the configuration of the server, and for documentation about CUPS itself.
It converts the print-job data into the final language/format of the printer via a series of filters. It uses MIME types for identifying file formats.
The mime.convs file has the syntax:
source destination cost program. The cost field assists in the selection of sets of filters when converting a file. The last field, program, determines which filter program to use to perform the data conversion.
text/plain application/postscript 50 texttops
application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster
image/* application/vnd.cups-postscript 50 imagetops
image/* application/vnd.cups-raster 50 imagetoraster
CUPS can convert supplied data either into PostScript data or directly into raster data.
The intermediary raster format is passed onto a final filter which converts the raster data to a printer-specific format such as PCL, ESC/P (Epson), ZPL (zebra) etc.
When CUPS is installed the
lp System V printing system command and the
lpr Berkeley printing system commands are installed as compatible programs.
The backends are the ways in which CUPS sends data to printers. There are several backends available for CUPS: parallel, serial, and USB ports, cups-pdf PDF Virtual Printing, as well as network backends that operate via the IPP, JetDirect (AppSocket), Line Printer Daemon ("LPD"), and SMB protocols.
A new mdns backend in CUPS 1.4 provides Bonjour (DNS-SD) based printer discovery. In CUPS 1.6, Bonjour printer discovery and sharing using Avahi is also supported.
PostScript Printer Description (PPD) files are created by vendors to describe the entire set of features and capabilities available for their PostScript printers.
A PPD also contains the PostScript code (commands) used to invoke features for the print job. As such, PPDs function as drivers for all PostScript printers, by providing a unified interface for the printer's capabilities and features.
Microsoft Windows uses PPD files but converts these to a binary .BPD file format before using them. These are normally stored in C:\WINDOWS\system32\spool\drivers\w32x86\3 on a x86 system, or C:\Windows\System32\spool\drivers\x64\3 on a 64 bit system. Updating the PPD files requires removing and then reinstalling the printer.
Each PDF file encapsulates a complete description of a fixed-layout flat document, including the text, fonts, graphics, and other information needed to display it.
PDF is largely based on PostScript but simplified to remove flow control features like "if else", while graphics commands such as "lineto" remain.
The PDF combines three technologies:
- A subset of the PostScript page description programming language, for generating the layout and graphics.
- A font-embedding/replacement system to allow fonts to travel with the documents.
- A structured storage system to bundle these elements and any associated content into a single file, with data compression where appropriate.
"C:\Program Files\gs\gs9.07\bin\gswin64c.exe" -dPrinted -dBATCH -dNOPAUSE -sDEVICE=mswinpr2 -sPAPERSIZE=a4 -dPDFFitPage -dNoCancel -sOutputFile="%printer%printer name" "pdfdocument.pdf"
rem To print to shared printer:
-sOutputFile="\\spool\\\MyServer\hp color LaserJet 4600 PCL 6"
See "gs/gs9.19/doc/Use.htm" for documentation.
// For help:
Un-define a name, cancelling -d or -s.
-dNOPAUSE no pause after page
-q `quiet', fewer messages
Interprets arguments as PostScript code up to the next argument that begins with "-" followed by a non-digit, or with "@". For example, if the file quit.ps contains just the word "quit", then -c quit on the command line is equivalent to quit.ps there.
Interprets following non-switch arguments as file names to be executed using the normal run command. Since this is the default behavior, -f is useful only for terminating the list of tokens for the -c switch.
-g<width>x<height> page size in pixels
-r<res> pixels/inch resolution
-sDEVICE=<devname> select device
-dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, | command for pipe
Output to the named printer. If your printer is named "HP DeskJet 500" then you would use -sOutputFile="%printer%HP DeskJet 500".
-dSAFER Disables the deletefile and renamefile operators, and the ability to open piped commands (%pipe%cmd) at all.
Determines whether the file should be displayed or printed using the "screen" or "printer" options for annotations and images. With -dPrinted, the output will use the file's "print" options; with -dPrinted=false, the output will use the file's "screen" options.
This is a "convenience" operator that sets the various options to perform page fitting for specific file types.
This option sets the -dEPSFitPage, -dPDFFitPage, and the -dFitPage options.
Add these switches to shrink the document to an A4 page.
Convert PDF to PS. wcfNote: the output file can't be "c:\a.ps" or there will be an error. See SO: converting PDF to PS with GhostScript.
"D:\proGreen\gs\gs9.19\bin\gswin64c.exe" -sDEVICE=ps2write -dBATCH -dNOPAUSE -sOutputFile="a.ps" "c:\Users\wangcf\Desktop\test.pdf"
The mswinpr2 device uses MS Windows printer drivers, and thus should work with any printer with device-independent bitmap (DIB) raster capabilities.
GSView doesn't use the mswinpr2 device. Russel (who wrote both) says that gsview prints faster too.
The mswinpr2 device is ugly, it works by using Ghostscript to render the document to a bitmap, creating a Device Context suitable for the printer. Some of the printer device's characteristics are retrieved and used to set up Ghostscript parameters before rendering (eg the media size, and possibly resolution) so that the rendered image is suitable for the device.
Options for mswinpr2
The mswinpr2 device supports a limited number of command-line parameters (e.g. it does not support setting the printer resolution). The recognized parameters are the following:
Selects the MS Windows printer device. If Ghostscript was not compiled with this device as the default output device, you have to specify it on the command line.
Hides the progress dialog, which shows the percent of the document page already processed and also provides a cancel button. This option is useful if GS is intended to print pages in the background, without any user intervention.
Specifies which printer should be used. The printer_name should be typed exactly as it appears in the Printers control panel, including spaces.
"-dBitsPerPixel=24" is required. wcfNote: the output became colored after I set this.
"D:\proGreen\gs\gs9.19\bin\gswin64c.exe" -sDEVICE=mswinpr2 -dBitsPerPixel=24 -sOutputICCProfile=default_cmyk.icc -dPrinted -dBATCH -dNOPAUSE -sPAPERSIZE=a4 -dPDFFitPage -dNoCancel -sOutputFile="\\spool\\\127.0.0.1\Microsoft XPS Document Writer" "c:\Users\me\Desktop\test.pdf"
The problem is a result of the switch to an all (within reason) ICC based color workflow in GS 9.xx. The mswinpr2 device is, for some reason, not getting an ICC profile associated with it.
My suspicion is that the root cause is that mswinpr2 is one of the few devices that doesn't have an inherent color model, and it hasn't been updated to setup it's own device ICC profile.
As workaround, you can give Ghostscript a specific profile to use for the output device on the command line, thus:
PDL, Printer Description Language
PostScript (PS) is a computer language for creating vector graphics. It is a dynamically typed, concatenative programming language. It is used as a page description language (PDL) in the electronic publishing and desktop publishing.
PostScript is a Turing-complete programming language, belonging to the concatenative group.
Prior to the introduction of PostScript, printers were designed to print character output given the text - typically in ASCII - as input. There were a number of technologies for this task, but most shared the property that the glyphs were physically difficult to change, as they were stamped onto typewriter keys, bands of metal, or optical plates.
This changed to some degree with the increasing popularity of dot matrix printers. The characters on these systems were drawn as a series of dots, as defined by a font table inside the printer.
Vector graphics printing was left to special-purpose devices, called plotters.
Laser printers combine the best features of both printers and plotters. Like plotters, laser printers offer high quality line art (vector graphics), and like dot-matrix printers, they are able to generate pages of text and raster graphics. Unlike either printers or plotters, however, a laser printer makes it possible to position high-quality graphics and text on the same page. PostScript made it possible to fully exploit these characteristics, by offering a single control language that could be used on any brand of printer.
When the PostScript program is interpreted, the interpreter converts these instructions into the dots needed to form the output. For this reason PostScript interpreters are occasionally called PostScript Raster Image Processors, or RIPs.
Advantages and Disadvantages
When would you need to use PostScript? Generally, you would need to use PostScript in the following scenarios:
- To match font styles with other users in the organization
- To work with Macintosh computers
- The work requires the rendering of graphic images in a particular way which possibly only PostScript can provide
- To be compatible with a particular application or environment (this is more common in certain UNIX (R) environments)
Are there any potential disadvantages in using PostScript? Some of the disadvantages related to PostScript printing are:
- Can be slower at printing -- Simple graphics or mixed text and graphics jobs printed in PostScript may take up to 2 to 5 times longer to print than the same job sent as PCL.
- Memory intensive -- PostScript generally needs more printer memory to produce a job. There is no direct correlation between file size and the amount of memory needed to produce a job.
If you create complex documents containing both text and graphics, PostScript may give you better printed results even from a desktop printer.
If you need a PostScript printer but can't afford one there are some software solutions available to you. Programs such as GhostScript and PowerRIP provide varying degrees of PostScript capability to non-PostScript laser and inkjet printers. See about.com: postscript printer.
Hewlett-Packard created the PCL (Printer Control Language) printer language.