Sub topic 12
The Print Spooler and Managing the Print Queue
This chapter explains how Windows holds print jobs before they reach the printer, and how to manage and repair that queue. It assumes you can open Services and a command prompt, you know what a printer driver is, and you have read the earlier chapters on connections and installation.
What the spooler does
The print spooler is software that accepts print jobs, stores them on disk, and sends them to the printer one at a time. In Windows it runs as the Print Spooler service (the process is spoolsv.exe). On Linux and macOS the same job belongs to CUPS (Common UNIX Printing System).
Without a spooler, an application would have to wait until the printer finished every page. The spooler fixes this in three ways:
- Speed for the user. The application hands the job to the spooler and returns control right away.
- Ordering. Many users and programs can send jobs at once. The spooler lines them up in a print queue.
- Control. Because jobs wait on disk, an administrator can pause, cancel, reorder or restart them.
The queue belongs to a printer, so each installed printer has its own. A job in the queue is stored as files in the spool folder, C:\Windows\System32\spool\PRINTERS. Each job usually has an .SPL file (the spooled data) and an .SHD file (the shadow file, which holds job settings such as owner and printer).
The path of a print job
- The user chooses Print in an application.
- The application and the printer driver convert the document into data the printer understands, such as PCL or PostScript. The driver chapter covers these page description languages.
- The spooler writes the converted job to the spool folder.
- The spooler reads the job back and sends it through the port (USB, a TCP/IP port or a WSD port) to the printer.
- The printer prints, and the spooler removes the job files.
Because the spooler sits in the middle, many "printer" problems are really spooler problems. A good first question is whether the job reached the queue at all. If it did, the application and driver worked. If it sits in the queue, the fault is the spooler, the port, or the printer.
Viewing and managing the queue in Windows
Open Settings > Bluetooth & devices > Printers & scanners, select the printer, and choose Open print queue. The queue window lists each job with its document name, status, owner, page count, size and submission time.
The Printer menu in that window provides these actions:
| Action | Effect |
|---|---|
| Pause Printing | Stops the whole queue. Jobs stay stored and new jobs keep arriving. |
| Cancel All Documents | Removes every job from the queue. |
| Use Printer Offline | Holds jobs on the computer instead of sending them. |
| Set As Default Printer | Makes this printer the one applications choose first. |
Right-clicking a single job gives you Pause, Resume, Restart and Cancel. Restart sends the job again from the beginning. Pause on one job lets later jobs print first, which helps when a large job is blocking short urgent ones.
Printing from the command line works too. These PowerShell cmdlets list printers and jobs:
Get-Printer | Select-Object Name, DriverName, PortName, PrinterStatus
Get-PrintJob -PrinterName "Office Printer"To remove a job, pass its ID from the listing:
Remove-PrintJob -PrinterName "Office Printer" -ID 3Common queue states
- Printing: The spooler is sending data. This is normal.
- Spooling: The job is still being written to disk. Large graphics can stay here a while.
- Paused: A person paused the job or the queue.
- Error: The printer reported a problem such as no paper, a jam or an open door. Fix the printer and the job resumes or can be restarted.
- Offline: The computer cannot reach the printer, or Use Printer Offline is turned on.
- Deleting: A cancel request is pending but the spooler cannot finish it. A job that stays in this state is stuck.
Clearing a stuck queue
A stuck queue happens when a job is corrupt or the spooler lost contact with the printer mid-job. The signs are a job that will not cancel, a status of Deleting that never ends, or every later job waiting behind one that never prints. Cancelling in the queue window does nothing, because the spooler itself is holding the file.
The fix is to stop the spooler, delete the leftover job files, and start the spooler again:
- Open a command prompt as administrator. Stopping services needs elevated rights.
- Stop the Print Spooler service.
- Delete everything in the spool folder.
- Start the service.
- Print a test page.
net stop spooler
del /Q /F /S "%systemroot%\System32\spool\PRINTERS\*.*"
net start spooler/Q suppresses confirmation prompts, /F forces deletion of read-only files, and /S includes subfolders. The command removes only job files. It does not remove printers or drivers. You can also do the same through services.msc: right-click Print Spooler, choose Stop, delete the files in File Explorer, then choose Start.
If the spooler stops again
If the service stops on its own or will not start, look for these causes:
- A bad driver. A corrupt or incompatible driver can crash the spooler each time it loads. Remove the printer, remove the driver package in Print server properties > Drivers, then reinstall a current driver.
- A stopped dependency. The spooler depends on the Remote Procedure Call (RPC) service. If RPC is not running, the spooler cannot start.
- A disabled service. Check in
services.mscthat the startup type is Automatic. - Corrupt leftover files. Repeat the clearing steps above.
Managing the queue on Linux and macOS
CUPS provides the same functions through commands. lpstat reports status, and cancel removes jobs:
lpstat -p -d
lpstat -o
cancel -alpstat -p -d lists printers and names the default. lpstat -o lists pending jobs with their IDs. cancel -a cancels all jobs, while cancel followed by a job ID (for example cancel office-12) cancels only that one. CUPS also has a web interface at http://localhost:631, where you can pause printers, view jobs and manage settings. On macOS you can also open the printer from System Settings > Printers & Scanners and use its queue window.
Separating network problems from queue problems
When jobs leave the queue but nothing prints, test the connection to the printer. A reachable raw-printing port suggests the problem is the driver, the printer or the job. An unreachable one suggests the network:
Test-NetConnection -ComputerName 192.168.1.50 -Port 9100TcpTestSucceeded : True means the computer can reach port 9100, the common raw printing port. False points toward a wrong IP address, the printer being off or asleep, a firewall, or the wrong network.
Exam points
- The spooler stores jobs in
C:\Windows\System32\spool\PRINTERSand runs as the Print Spooler service. - The usual fix for a job that will not delete is to restart the spooler and clear the spool folder.
- Spooling lets users keep working while a document prints.
- Pausing or restarting individual jobs and using Cancel All Documents are normal administrative actions.
- If the spooler does not start, check dependencies and drivers.
- On Linux and macOS, use
lpstatandcancelwith CUPS.
Exercise
A user's print job shows "Deleting" and will not go away, and every later job is stuck behind it. Cancel All Documents does nothing. List the steps, in order, that clear the queue on a Windows computer.
Show answer
Open a command prompt as administrator. Stop the Print Spooler service (net stop spooler). Delete the files in C:\Windows\System32\spool\PRINTERS. Start the service again (net start spooler). Print a test page. Warn other users first, because this deletes all waiting jobs.
Exercise
A printer is powered on and connected, but its status in Windows is Offline and jobs wait in the queue. Name one setting to check first, and one command that tells you whether the network path to a printer at 192.168.1.50 is working.
Show answer
Check whether "Use Printer Offline" is selected in the Printer menu of the print queue window. To test the network path, run Test-NetConnection -ComputerName 192.168.1.50 -Port 9100 and look for TcpTestSucceeded : True.
Exercise
On a Linux computer using CUPS, which commands show the printers and default printer, and which cancels every pending job?
Show answer
lpstat -p -d shows the printers and the default printer. cancel -a cancels all pending jobs.