Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
653 views
in Technique[技术] by (71.8m points)

printing - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...