RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Empower Your Printing with Custom Print Processors

Using Custom Print Processors is one of the many ways to take control of the printing process. Find out how to use this user-mode DLL and C/C++ to enforce security policies, add missing printing functionality, or alter print jobs.

n this world of emerging technologies and modern, ultra-small, and super-capable electronic devices, there is still a place of honor for printers. People haven't completely switched to soft copies. There are many reasons to look at a printed document instead of scrolling through it on your PC. For example, some technical writers insist on having hard copies of old documentation on which to make comments while working on a new version.

Whatever the reason, people still print often and, in many cases, they may want to coordinate printing activities or alter print jobs on-the-fly, etc. There are many ways to take control of the printing process. Using Custom Print Processors is one of them.

The Print Job Life Cycle
Figure 1 depicts the major stages through which a print job passes—starting from the Windows application request, to print, and ending with the actual print-out.

Users initiate the process by sending their documents to the printer. Normally, in the Windows corporate environment, the application sends the print job to the print server, which shares the network printer device. The Windows Print Spooler service receives the print request and spools the job to disk. Next, the Print Processor associated with the printer device is called to translate the print job to device language. Afterwards, the Print Monitor performs the additional task of directing the translated data stream to the appropriate printer port (COM, LPT, etc.) using the CreateFile, WriteFile, ReadFile, and DeviceIOControl Win32 API functions. Finally, you receive your hard copy on the device.

Figure 1. An Overview of Printing Stages: The image shows the stages through which a print job passes.

What Is the Print Processor?
As its name suggests, the Print Processor processes jobs that are spooled to the printer. You may view the Print Processor as a layer between a Windows application and the printer driver. This layer translates the job stream from the supported data type (such as NT EMF, RAW, TEXT, etc.) to a specific printer language with the help of the appropriate driver. Every printer is assigned a Print Processor in charge of handling the print jobs spooled to it. Print Processors are also responsible for handling any requests to stop, pause, or continue printing.

In fact, the Print Processor is a user-mode DLL, which runs in the context of the Windows Print Spooler service. Microsoft supplies code samples as part of the Driver Development Kit (DDK)—even though it is not a driver. Because of this, it's important to remember that, while you don't need driver development knowledge to implement your own Print Processor, you will need C/C++ and Win 32 programming experience to understand the essence of the code.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date