如何查看打印机状态?
我尝试编写一个代码来查找打印机的状态以打印 pdf 格式的水晶报告。我有以下问题:
单击水晶报表中的打印按钮后如何触发代码?是否有任何事件(点击)来检查打印机状态?
当打印机处于不同模式(如盖打开、无纸、盖打开且无纸、关闭、打开、预热等模式)时,属性会发生哪些变化?它确切返回的数值是什么?不同类别打印机(惠普激光打印机、佳能等)的返回值是否有任何变化?
如何在成功打印报告后显示“成功”消息?
请澄清任何一项。
I try to write a code for finding status of a printer to print crystal reports which are in pdf format. I have following doughts:
How can I fire the code after click the print button in crystal report? Is there any events(lick click) to check the printer staus?
What are the properties change when printer in different modes like lid open, no paper, lidopen and no paper, swtch off, switch on, warmup ect.? what are the numeric values it exactly returns? and is there any changes in return values for different catagery printers(hp laser printes, canon ect..)?
How can I display the message "Success" after successful printing of a report?
Pls, Clarify any one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 System.Management 与 Win32_Printer 类来查询打印机信息。
还有 Win32_PrintJob,您可以使用它可以枚举以确定给定作业何时完成。
Status
属性可以为您提供有关打印机状态的更多粒度。您可以监视这些对象的创建和删除 - 这将为您提供新的和已完成的作业信息。此处列出了其他打印机类别。
You can use System.Management with the Win32_Printer class to query printer information.
There is also Win32_PrintJob, which you could enumerate to determine when a given job completes. The
Status
property may give you additional granularity on printer status. You can monitor creation and deletion of these objects - that would give you new and completed job info.Other printer classes listed here.
您需要编写一个 ObjectQuery。 “从 Win32_PrintJob 选择 *”。然后您必须使用 ManagementObjectSearcher 和 ManagementObjectCollection 来获取项目数在打印队列中。
您可以使用“SELECT * FROM Win32_Printer”来获取打印机状态
You need to write a ObjectQuery. "Select * from Win32_PrintJob". Then you have to use ManagementObjectSearcher and ManagementObjectCollection to get the count of items in printqueue.
you can use "SELECT * FROM Win32_Printer" to get printer status