2

I'm looking for a way to hook up all printing jobs on a machine.

We have some Kiosk computers running windows XP, and we would like to allow customers to print. We would like to be able to catch the printing job, as it is sent to the printer, analyze it, show the user a dialog with the price for the printing and if he approves - send the job to the printer.

If he doesn't approve, the job must be canceled.

My first idea was to use a hook. But is there a hook for printing jobs? How is it used?

Someone also mentioned PCL (Printer Command Language), meaning us to write a wrapper for the local printer driver. How difficult is that? Where can i find a good tutorial for PCL?

What about PJL (Printer job language)?

The target language is c++.

Your input will be appreciated.

Thanks, Summerbulb

summerbulb
  • 5,709
  • 8
  • 37
  • 83

1 Answers1

2

You can use WMI to get notified about new printer jobs using Win32_PrintJob.

As soon as the job is created, call Pause on it to suspend, show your GUI. If the client accepts the job, call Resume to actually print the file.

See Example: Receiving Event Notifications Through WMI for a C++ example which handles WMI notifications.

Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207
  • Some of my colleagues claim that WMI is very unreliable. Since we're dealing with billing, reliability is a must. – summerbulb Aug 26 '11 at 07:30
  • 1
    @summerbulb: I suggest to just test it instead of basing technical decisions on fear, uncertainity and doubt. I worked fine for me, but I don't claim that it's bug free (just like I won't claim that any software is bug free, except TeX maybe :-). – Frerich Raabe Aug 26 '11 at 13:05
  • We've decided to go with the WMI. I'll let you know if we run into unreliability issues. – summerbulb Aug 27 '11 at 19:11