0

I would like to know if c# has the capacity to detect when a print job has been sent to the printer.

I have to write a small program that will keep count of how many pages an employee prints in my company and I want to detect this activity and record in a database. Incrementing the value as he prints.

Any pointers on where to start or documentation to read would be really helpful

Vincent N.
  • 99
  • 1
  • 12
  • Possible duplicate of [How to catch print jobs in C# .NET](http://stackoverflow.com/questions/10229077/how-to-catch-print-jobs-in-c-sharp-net) – Alexander Apr 21 '16 at 10:45

2 Answers2

0

I suggest to look into System.Prinitng namespace. I think PrintJobStatus enum contain the information you need.

VitaliyK
  • 279
  • 1
  • 8
0

Windows has something called an eventlog that can be read by a c# application. This log contains much information about what has happened on your system. You could look for even log records with ids that relate to printing. Events with ids of 307, 801 and 842 might all be suitable for determining a print has completed but be aware that a single print might raise several of these events so if you kept a count of them all it might be misleading (i.e. just use one!).

The events can also be viewed in the event viewer and are found in Applications and Services Logs/Microsoft/Windows/PrintService/Operational. They are not logged by default (there would be loads!) so you may have to enable logging and you would have to remember to clear the log periodically to prevent it from growing too large.

mark_h
  • 5,233
  • 4
  • 36
  • 52