How to create a virtual printer in Windows?

前端 未结 6 1973
盖世英雄少女心
盖世英雄少女心 2020-12-02 09:19

I want to create a virtual printer driver for Windows. How and where can I start properly? The WDK has some printing drivers examples that do not seems a good introductory.

相关标签:
6条回答
  • 2020-12-02 09:28

    Create a Print Port Monitor, associate that port with a printer, and you'll get the data the printer driver sends to the port.

    working example of how is it done in Cpp and java can be found here: http://www.mms-computing.co.uk/uk/co/mmscomputing/device/printmonitor/index.php

    0 讨论(0)
  • 2020-12-02 09:36

    You can look to the 'minidriver' development in the from Microsoft (Microsoft MDT), that might help depending on your exact needs. If the port you need to deal with (ie: you are going to take the data from an existing printer driver and want to process) you could look to the source code for RedMon. It doesn't support Vista/Win7 but might point you in the right direction.

    0 讨论(0)
  • 2020-12-02 09:38

    When I did it (which about 12 years ago) I started with the postscript driver sample, replaced all the postscript-specific stuff (in my case, to write to a bitmap instead of generating postscript commands).

    I also wrote a custom print monitor (the driver writes to the spooler, which write to a monitor): my monitor wrote to a file instead of e.g. to the parallel port.

    However, printer driver architecture and/or the set of sample drivers may have changed since then.

    0 讨论(0)
  • 2020-12-02 09:44

    Someone else already mentioned PDFCreator. Here's a more specific link to their code that's creating the printer, port and monitor. Despite being in VB, I can follow it as someone more used to C++, so I guess you can too. modPrinter.bas does the leg work. modMain.bas, from about line 28 onwards, calls into modPrinter.bas.

    0 讨论(0)
  • 2020-12-02 09:45

    This book maybe help you Developing Drivers with the Windows® Driver Foundation

    A list of my links

    1. http://www.codeproject.com/KB/system/driverdev.aspx
    2. http://www.microsoft.com/whdc/ddk/winddk.mspx
    3. http://jungo.com/wdusb.html
    4. https://web.archive.org/web/20130717135254/https://msdn.microsoft.com/en-us/library/ff554651.aspx
    5. http://channel9.msdn.com/posts/Rory/Driver-Development-and-Much-More-With-Mike-Calligaro/
    0 讨论(0)
  • 2020-12-02 09:46

    One of the drivers you mention is open-source (GPL), maybe you could explore its source or adapt it: http://www.pdfforge.org/products/pdfcreator/download

    0 讨论(0)
提交回复
热议问题