Click here to Skip to main content
15,120,268 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I've searched a lot but not getting any driver development code using C#. Most of the code or examples, i am getting is written in either C or C++.

What I have tried:

So, Is it possible to create Virtual Printer driver using C#?
Updated 25-Apr-17 22:15pm

1 solution

Short answer: You can't.

Searching for "c# windows driver" explains why:
kernel - C# driver development? - Stack Overflow[^]

To start with Windows driver developmnet see Getting started with Windows drivers[^].
Sachin Makwana 26-Apr-17 6:34am
I've found this link, which provides virtual printer using c#.

I'm still not getting what it is actually doing. and How can I use that.
Jochen Arndt 26-Apr-17 6:47am
That definitely does not contain virtual printer drivers.

A quick look shows that is about handling printing (jobs, settings, preview, print to file).
Sachin Makwana 26-Apr-17 7:39am
ok. I had a look at one of its example. It reads INI file and previews the print data stored in the form of emf file.

my question is, Does every printer stores its jobs in INI file? and Does the print data is stored in emf file??
Jochen Arndt 26-Apr-17 7:50am
The settings are handled by Windows and the drivers and are stored in the registry. See for example Registry entries for printing.

Print files may by EMF, raw, or text depending on the printer and the settings. They are managed by the Print Spooler.
Sachin Makwana 26-Apr-17 8:04am

Will it be useful to create Virtual Printer driver in C# or I need to go for C++?

I'm really confused on Virtual Printer Driver development (C# or C++).
Jochen Arndt 26-Apr-17 8:14am
A virtual printer driver is a driver that does not send data to a physical printer but to a file. Examples are the MS XPS document writer and various PDF writers.

But they are still drivers which have their requirements regarding creating them.

You might create an application that behaves similar (creates print files). But that would not be a driver and can't be selected with the common print dialogs.

A Windows driver can't be written in C#. It does not care if it is a virtual driver or one for a physical device, and for which kind of device (printer, keyboard, storage, ...).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900