Print – How to access the printer’s amount of ink in programming?

Okay, this is a Windows specific problem.

I need to be able to access the ink level of the printer connected to the computer. It may be a direct connection or a network Connect.

I realize that each printer (or printer company) may be different, but where can I find information on how they display ink levels to the PC. Also, it is best to read this information What is the language?

Okay, this is the OS agnostic answer…

< p>If the printer is not a very cheap model, it will have built-in support for SNMP (Simple Network Management Protocol). SNMP queries can return current values ​​from network devices stored in its MIB (Management Information Base).

For printers, there is a standard definition called Printer MIB. The Printer MIB defines the standard name and tree position for prtMarkerSuppliesLevel (OIDs == object identifier in ASN.1 notation), in the case of ink mark printers, it maps to Ink volume.

Please note that SNMP also allows dedicated extensions to the standard MIB. Most printer vendors do hide a lot of other information in their “private MIB”, but the standard information should always pass through the printer MIB OID query is provided.

In fact, each programming language has a standard library that can help you make specific SNMP queries from your own applications.

One of the implementations is Open Source, named Net-SNMP, it also comes with some powerful command line tools to run SNMP queries.

I think the OID of all levels for querying all inks is. 1.3.6.1.2.1.43.11.1.1.9 (this webpage confirms what I believe) but I can’t verify now because there is no printer in my local area network at this moment. So the snmpget command of Net-SNMP to query the ink level should be like this :

snmpget \
-c public \
192.168.222.111 \
".1.3.6.1.2.1.43.11.1.1.9 "

where public is the standard community string and 192.168.222.111 is the IP address of your printer.

Ok, this is Windows specific Question.

I need to be able to access the ink level of the printer connected to the computer. It may be a direct connection or a network connection.

I recognize that every printer (or printer company ) May be different, but where can I find them and how to P C shows the information of the ink level. In addition, what is the best language to read this information?

Ok, this is the OS agnostic answer…

If the printer is not a very cheap model, it will Built-in support for SNMP (Simple Network Management Protocol). SNMP queries can return current values ​​from network devices stored in its MIB (Management Information Base).

For printers, there is a standard definition called Printer MIB The Printer MIB defines the standard name and tree location for prtMarkerSuppliesLevel (OIDs == object identifier in ASN.1 notation), in the case of ink mark printers, it maps to the ink volume.

Please note , SNMP also allows special extensions to the standard MIB. Most printer vendors do hide a lot of other information in their “private MIB”, but standard information should always be provided through the query of the printer MIB OID.

In fact, every programming language has a standard library that can help you make specific SNMP queries from your own applications.

One of the implementations is Open Source, named Net-SNMP< /code>, it also comes with some powerful command-line tools to run SNMP queries.

I think the OID of all levels for querying all inks is .1.3.6.1.2.1.43.11.1.1.9( This webpage confirms what I believe) but I can’t verify now because there is no printer in my local area network at this moment. So the snmpget command of Net-SNMP to query the ink level should look like this:

snmpget \
-c public \
192.168.222.111 \
".1.3.6.1.2.1.43.11.1.1.9"

where public is the standard The community string, 192.168.222.111 is the IP address of your printer.

Leave a Comment

Your email address will not be published.