问题
Need an idea to write a code to authenticate users before they send the commands to print.
Initial idea is to create a windows service which could bypass the call to the printer driver and can open a form for login credentials.
so that only the authenticated users who qualifies the monthly quota for printing the pages could access the printer.
Please share your views whether this approach is feasible and how this can be achieved.
回答1:
You can monitor the Win32_PrintJob
WMI Class or the winspool.drv
. You will find additional information here and here. Also, have a look at the FindFirstPrinterChangeNotification method.
Monitor the Win32_PrintJob
WMI Class and pause the print job. Resume the job if the user has not reached the monthly quota. Otherwise, delete it.
来源:https://stackoverflow.com/questions/29486125/how-to-authenticate-users-every-time-they-send-print-commands