How to create a virtual printer?

I am trying to create a virtual printer. There are already answers like this and.

However, my requirement is more specific. I just want to create a virtual printer that can be added to the system, and it can be accessed from any application. When you press the print command, the dialog box looks as if a real printer appears on the screen and a PDF document is created when printing. Then other actions are performed, such as clicking PDF on my server.

Do I need to delve into a set of Windows drivers? Or is there a free SDK for this?

Thanks.

+4
source share
2 answers

Not sure if this question still applies to you, but you probably want to think about something like this:

Use the WDK (Windows Driver Kit) to create the Unidrv UI plugin. This will allow you to specify the user interface during printing (for your dialogue with the printer). The reason you want to show the interface is because it is one of the only components of the printer driver that work in a user session (the same process as the print application). The XPS pipeline and port monitor are session 0.

If you want to adhere to the MS agreement, you will create a spool file to convert the PDF to a render filter by the XPS filter pipeline (this is if you use the XPSDrv driver ). The filter pipeline is where you have the opportunity to change the XPS satellite data included in the last filter and convert it to your output type (PDF in your case).

To do post-print processing, you might want to create a port monitor (again with the WDK) and start a new process to do subsequent printing after the port monitor has output to disk on disk.

The only problem with this approach is that you cannot use port monitors in version 4 drivers (this is a new type of driver in Windows 8). Version 3 drivers still work in Win 8, but I think they will be phased out.

It is a pity that this is probably not very obvious, but, as I said, this is a high-level review (and, unfortunately, driver development is still very difficult outside of a simple fingerprint to a file). Version 4 drivers become much easier to develop, but, unfortunately, with the removal of port monitor support and other improvements, this greatly complicates the development of something that requires further processing.

[DISCLAIMER: I am associated with the Mako SDK R & D team

I know that you asked for a free SDK, unfortunately, I do not know anything that would be suitable, but I know that our company offers a virtual printer platform (SDK) that would be good for you (prints in PDF and supports processing after printing). Further information can be found on the Mako SDK website.

Hope this helps anyway. I know that developing a printer driver can be very confusing at times!

+3
source

After reading and doing a lot of research, in order to configure something like redmon and use the printer SDK, I completed the project using this SDK: http://www.novapdf.com/pdf-sdk.html

This solution, however, will only work with windows.

[I am not affiliated with novaPDF]

I researched the OSX version, however it will be a different assembly, you can probably install something using this method: http://www.jms1.net/osx-pdf-services.shtml [I have not tried this yet]

+1
source

Source: https://habr.com/ru/post/1491317/


All Articles