6

For the needs of my software I need to create a printer driver which will allow me to save all the images which are sent to it to files and then open my program's window letting the user to do something with the rendered pages.
I have found this article, but the sample uses the FILE: port, while I need to make my own port, dump the images to files and run an executable. However, I think I can accomplish my task by doing that in the driver's code, but I am not really sure that it is a good decision, since it is a driver, even though it is a user-mode driver.
I would be glad to hear any advice on my problem. Thanks in advance.

Cracker
  • 912
  • 2
  • 14
  • 26

2 Answers2

2

You need a port monitor, not a driver. See my answer to this question. You can use RedMon, but I recommend using the sample port monitor found in the WDK instead.

Community
  • 1
  • 1
Carey Gregory
  • 6,836
  • 2
  • 26
  • 47
1

If you are OK with using XPS as format you can use the Github project: Microsoft/Windows-driver-samples/print/XPSDrvSmpl

https://github.com/Microsoft/Windows-driver-samples/tree/master/print/XPSDrvSmpl

Installer: http://wixtoolset.org/

Application: Listen to internal port

Flow: Install printer and application from a single installer. User prints something with your driver and while the application listens to the internal port. When data is sent the application picks it up. This is for XPS, can be converted to PDF, but the flow is similar no matter what you are printing. If you need anything else check out Microsoft/Windows-driver-samples/print/ on GitHub or other sources specific to your needs.

Ogglas
  • 62,132
  • 37
  • 328
  • 418
  • @Hi Ogglas, I have a requirement to change the spool file header of the normal windows print queue, can you please shed some light on how to achieve this? Thanks in advance. – PainPoints Feb 08 '17 at 00:53