-->

Windows programmable virtual printer “device”

2019-08-22 04:09发布

问题:

I have no idea how this windows service called or how should I tag it. But I have seen around some software driven printing devices/configurations at windows, like Send to OneNote or Convert to PDF (from different pdf applications).

So I want to create one like this myself, lets say a virtual printer device that converts documents into PDF file.

How it called? Where I can find some information about it ?

Thank you.

回答1:

A lot of these applications (on Windows) actually use the built-in Windows PostScript printer driver to produce a PostScript program from the application.

That is then sent to a virtual printer (in versions of Windows before Windows 10, a Port Monitor is used) which stores the program on disk. It then starts up a PostScript interpreter which is capable of creating a PDF file from a PostScript file. Notably these include Adobe Acrobat Distiller, the JAWS PostScript interpreter and Ghostscript. Because Ghostscript is open-source, it is probably the most widely used.

The alternative approach is to write a printer driver. This needs to accept OS native drawing operations (which differ according to the operating system) and then produce PDF equivalents for those drawing operations, and wrap the whole thing up as a PDF file.

The first solution is easiest, because it leverages the work other people (the OS vendor and the PostScript interpreter vendor) have done. The latter is, I think you'll find, much harder.

Of course, since Windows and MacOS can both now produce PDF files, it seems somewhat redundant to implement these now.