Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a Windows Printer Driver

I want to write a application in C++ or C# that will behave as a printer driver when installed. It will be available in the drop down list in Print dialog but instead of printing it will call into my code.

I think there may be some interfaces that Windows provide to write printer drivers.

like image 736
A9S6 Avatar asked Mar 16 '09 06:03

A9S6


People also ask

How do I create a virtual printer driver?

Yes, it's possible to create virtual printers. Please open Devices and Printers on the Start Menu, click on Add a printer, select Add a local printer, then select Use an existing port FILE: (Print to File), after that select a printer driver you'd like and finish the wizard.


1 Answers

Windows provides loads of interfaces. Do you know what sort of a printer driver you want to write? At present, Windows supports three flavors of printer drivers -- PostScript, Unidrv and XPSDrv (the latter on XP/2003 Server with EP 1.0 and upwards only). Most of the time, it suffices to write a driver plug-in instead. Read up on INF architecture to know these things get installed, specially the section on minidrivers.

As suggested, you will need the WDK to be able to build a driver or a plug-in thereof. Note that drivers do not use the Visual Studio IDE or compilers. The WDK comes with a compiler of its own. You can always hook up the latter with VS, but that's a different story.

The WDK has setups to target different OS-es. You will have to know which OS (or set of OS-es) you want to address and choose the appropriate setup.

I want to write a simple driver that will displays in the list of printers.

I don't see how that will be helpful. If you are writing a driver, why would you want a list of all other drivers present on the system?

Printing to this driver will call into my code so that I can do stuff like create a PDF of the document, calling the Web Service etc.

Interesting! You can achieve all those things in a UI plug-in. An UI plug-in is a dll that is loaded when you select the Advanced driver properties.

To get started with UI plug-ins take a look at the sample oemui source code in the WDK.

like image 106
dirkgently Avatar answered Sep 20 '22 11:09

dirkgently