From: andreas.baus on
Hi. I'm trying to create a custom printer driver which is supposed to
intercept the printer output and write it to a file (for example as
PostScript or maybe as individual image filed) instead of sending it to
an actual printer (it's supposed to do some more processing on the
resulting files, so a simple "print to file" won't be enough, I'm
afraid).

I have the DDK installed, and I've looked at the documentation and the
provided samples, but ... well, I admit I'm not sure I've fully
understood where to begin.

I suppose what I need to do to accomplish my goal is to create a
Rendering Plugin DLL for the default Microsoft Printer Driver which
provides a COM class implementing the IPrintOemPS2 interface, and then
in my IPrintOemPS2::WritePrinter function write the code which saves
the data sent to the printer in a file... (correct me if I am wrong).
Sounds easy enough, but I still wonder if there's not some more
examples or documents out there (besides those in the DDK) that would
illustrate the basic steps necessary for doing this in a bit more
detail.

I'd be grateful for any hints or pointers in the right direction.

From: Kerry Krieske on
You should look at the Genprint sample in the DDK. It is a print
processor which can be modified to extract the emf data from the spool
file.

From: andreas.baus on
Hm, I don't think that does what I want. The point is that the user
should be able to decide what happens to his print job by selecting
either a real printer or my "virtual" one (once it has been properly
set up) from the list of available printer drivers. If I understand the
GenPrint example correctly, the dll created this way needs to be hooked
into the spooler by some external executable which the user would have
to run everytime he wants to activate this behaviour (or to deactivate
if he wants to print normally again). Although this seems to be an
easier method to implement, I believe the driver method would be more
transparent to the user...

From: Kerry Krieske on
Here is an FAQ about what a print processor can do with a dummy print
driver...

http://www.mabuse.de/faq.mhtml

From: Radu Cosoveanu on
>From what I undestood, there are two problems:

1. GenPrint is a print processor. That means if you will print on a
shared printer you will receive the data and will process data on the
computer that share that printer. If I am mistaking, please correct me.
2. If you want to modify the emf file (spl file that have a
collection of emf files on Windows XP by example), the emf format is
Microsoft propretary and it si undocummented. I saw an example on the
net with source code in VB.net. It is good and working on XP. Microsoft
can change when they want the format of the file and your driver will
not be reliable.


If you want to use the genprint sample, it will be complicated for
you if you have no idea about that. Take and read from codeproject.
There is a project sample for genprint named separatorpp made by a good
guy. Thanks again to him.
I suggest to you to write a new driver. Do not take the genprint
because of the problems related. Of course, you can use this print
processor to any kind of printer. But this is not your target from what
I undestand.
Anyway, if you find a good ebook about device drivers, be generous
with us.

Radu Cosoveanu