Events in PrintQueue

2019-06-01 12:23发布

ps = new PrintServer(printserverName);

PrintQueue pq1 = new PrintQueue(ps, pq.Name); 

As per my understanding, pq1 is a printer Queue which will handle print jobs.

I want to catch events for this print queue.

For example, if user A gives a print then this print job is added into the queue.I want to catch this job added into the queue event.So, I can know how many pages are allowed to user or validating the user.

标签: c# printqueue
2条回答
仙女界的扛把子
2楼-- · 2019-06-01 12:35

Looks like at the win32 API level you have an option to hook up to queue events:

I Could not find the same in .NET unless you keep polling for the job collection for the queue.

Take a look at:

http://msdn.microsoft.com/en-us/library/dd162722(v=vs.85).aspx

PRINTER_CHANGE_JOB

Notify of any changes to a job. You can set this general flag or one or more of the following specific flags:

PRINTER_CHANGE_ADD_JOB PRINTER_CHANGE_SET_JOB PRINTER_CHANGE_DELETE_JOB PRINTER_CHANGE_WRITE_JOB

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-06-01 12:54

As I understand it, ou can handle your OWN print queues (AddJob for example ..) but you cannot intercept the printjobs of other users.

查看更多
登录 后发表回答