我如何从USB打印机获取详细信息,例如卡纸,卡纸,模型,黑色耗材等? [英] How can i get the details such asTotal Pages Jammed,Model ,BlackSupply ,etc from USB Printer?

查看:137
本文介绍了我如何从USB打印机获取详细信息,例如卡纸,卡纸,模型,黑色耗材等?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从USB连接的打印机到我的C#应用​​程序中获取卡纸的总页数,型号,黑色耗材(可用),序列号等?我正在尝试使用Windows Spooler来获取这些详细信息,但我没有得到这些详细信息.谁能告诉我如何获取打印机的详细信息?

How can i get Total Pages Jammed,Model ,Black Supply(Available) ,serial number ,etc from usb connected printer to my c# app? I am trying to fetch these details by using Windows Spooler but i am not getting these details. Can anyone plz tell me how can i retrieve printer''s details?

推荐答案

您的问题的主要问题是我认为我们无法回答.打印机具有一些默认设置,可以通过.NET组件进行设置:
http://msdn.microsoft.com/en-us/library/5ekk3hse [ ^ ]

您的打印机在我的商店中存储了默认打印机类不需要的其他属性,如果要获取这些属性,则必须在打印机文档中查找单个产品.
The main problem with your question is I dont think we can answer it. Printers have some default settings that can be set via the .NET assembelies:
http://msdn.microsoft.com/en-us/library/5ekk3hse[^]

Your printer my store additional properties not required by the default printer class, and if you are going to get these then you will have to look in the printer documentation for the individual product.


有没有独立于供应商的方法,尤其是对于直接连接的打印机.由于没有标准和/或接口,因此驱动程序必须遵守此规定.每个供应商都将使用其自己的dll,自己的方法向用户发送此类情况(如果有的话).
对于网络打印机,如果设备支持,则唯一非厂商特定的监视方法是使用SNMP.咨询本文: http://techblog.willshouse.com /2012/01/24/how-to-monitor-canon-printers-with-snmp/ [ http://social.msdn.microsoft.com/Forums/zh/vcgeneral/thread/38280210-406a-4e4e-8d31-f044a59708e2 [使用C#更改打印机设置 [打印机和SafeHandles [
There is no vendor-independent approach, especially for direct attached printers. As there is no standard and/or interface the driver must comply in this matter. Every vendor will use it''s own dll-s, own methods to signal such conditions to the user (if at all).
For network printers the only not vendor-specific approach of monitoring them is using SNMP if the device supports it. Consult this article: http://techblog.willshouse.com/2012/01/24/how-to-monitor-canon-printers-with-snmp/[^]. And only network printers will have an embedded web server, that can be also used to retrieve this kind of information. But USB printers do not have this either.

Update: there is something you could follow. The PRINTER_INFO_2 structure contains a status field that is near of what you want. You need to call out to unmanaged api.
Read these:
http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/38280210-406a-4e4e-8d31-f044a59708e2[^]
Changing printer settings using C#[^]
Printers and SafeHandles[^]


这篇关于我如何从USB打印机获取详细信息,例如卡纸,卡纸,模型,黑色耗材等?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆