开发者

Read printer pool to get number of pages being printed

I have a network printer in the classroom lab. I'd like to keep record of how many pages of each student has printed. I want to know how can I read the printer pool to get the number of pages, when a student prints. Here开发者_JS百科's what I have in mind: Write a Windows service to get:

  1. User logged in name
  2. Number of printed everytime they print the docs
  3. Send username + number of pages to remote database

What I don't know:

  1. how to get number of pages every time they print

If possible I'd like to see this done in VB.NET.

Thanks.


You can use the WMI class Win32_PrintJob to get out information about each job. It has properties called PagesPrinted and TotalPages which would hopefully give you what you need. It also has other properties like Status that might also be relevant (if you don't want to count pages in deleted or failed jobs or similar).

This article has information about calling this class from VB.Net:
Interrogating your Printer Queries with WMI

Just remember to add a reference to System.Management since that's not added by default to a new project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜