[WinPrnDev] Re: hook virtual printer

  • From: "Rune Moberg" <jjflash@xxxxxxxxx>
  • To: winprndev@xxxxxxxxxxxxx
  • Date: Mon, 19 May 2008 10:07:14 +0200

On Sun, May 18, 2008 at 11:30 AM, Riccardo <riccardonews@xxxxxxxxx> wrote:
> I would like to hook print driver for manage the file that the MS
> windows'user want to print.

Which file?

When a Word document is printed, it is rendered to the printer's
canvas using GDI. In the case of a printer server, the print spooler
will record the GDI operations to an EMF (Enhanced Metafile) first
which is eventually transmitted to the print server (UNLESS the "print
directly to printer" option has been set on the client).

> "rundll32 printui.dll,PrintUIEntry /if /b "Virtual Printer Test" /f
> "%windir%\inf\ntprint.inf" /q /r "lpt1:" /m "driver" /z /u"

In my tests, Windows tests to see if there's anything physically
connected to lpt1... Don't you get any error messages with this?

What I tried was setting up a nul port using the local print monitor,
but using the WDK's Bitmap printer driver sample, I was unable to get
that working. Other virtual printer drivers seemed fine with that
though, so I don't know why it barfed. In the end I modified the
localmon WDK sample and used that port monitor instead.

Instead of trying to get at the EMF, you should probably look into
writing your own printer driver. (the Bitmap WDK sample is nice, but
limited to XP/Vista and newer)

-- 
Rune
---
Questions? First check the UndocPrint pages at 
http://www.undocprint.org/winspool

To unsubscribe, visit the List Server page at 
//www.freelists.org/list/winprndev

Other related posts: