简体   繁体   English

在POS打印机上自动识别

[英]Auto recognition on POS printer

I have a number of POS printers and need to automatically recognize the type of the printer. 我有许多POS打印机,需要自动识别打印机的类型。 I need do it without using POS.NET or printer drivers. 我需要在不使用POS.NET或打印机驱动程序的情况下执行此操作。 How can I do that? 我怎样才能做到这一点?

There is no standard way to recognize printers like this. 没有识别这种打印机的标准方法。

It's difficult or impossible in the general case (printers may use different COM port configuration - baud rate etc - and different protocols). 在一般情况下这是困难或不可能的(打印机可能使用不同的COM端口配置-波特率等-以及不同的协议)。 It's complicated further by the fact that many printers can be configured in different ways by DIP switches or by sending commands. 由于许多打印机可以通过DIP开关或发送命令以不同的方式进行配置,因此情况变得更加复杂。

If you have a reasonably small number of printers to recognize, for all of which you know the correct COM port configuration, you could experiment with sending commands / reading responses to find combinations that allow you to uniquely identify printers among the ones you support. 如果要识别的打印机数量很少,并且所有这些打印机都知道正确的COM端口配置,则可以尝试发送命令/读取响应以找到组合,以使您可以在支持的打印机中唯一地标识打印机。

Many POS printers support variants of the ESC/POS protocol, and responses to status requests (look at each printer's manual) may have differences that enable you to make the distinction. 许多POS打印机支持ESC / POS协议的变体,并且对状态请求的响应(请参阅每台打印机的手册)可能会有差异,使您能够区分。

Of course you will then have an ongoing maintenance headache - each time you want to support a new printer model, you are going to have to again try to find some distinguishing characteristic and update your recognition software. 当然,这将使您一直困扰维护工作–每次您想要支持新的打印机型号时,都将不得不再次尝试查找一些与众不同的特性并更新您的识别软件。

Take a look at this project which supports a lot of POS printers in the source codes: 看一下这个项目,该项目在源代码中支持很多POS打印机:

http://dev.cyberplat.com/redmine/repositories/browse/pt/2.0/src/Modules/Devices/Printers/Printers/Implementation1/src http://dev.cyberplat.com/redmine/repositories/browse/pt/2.0/src/Modules/Devices/Printers/Printers/Implementation1/src

In the implementation of each printer, you can find recognition subroutine for auto-searching the connected printers. 在每个打印机的实现中,您可以找到用于自动搜索连接的打印机的识别子例程。

Just did a quick google search, maybe you can just list the printers available, an example here: http://www.c-sharpcorner.com/UploadFile/mahesh/printerslisting06072007092859AM/printerslisting.aspx 只是做了一个快速的谷歌搜索,也许你可以只列出可用的打印机,这里有一个例子: http : //www.c-sharpcorner.com/UploadFile/mahesh/printerslisting06072007092859AM/printerslisting.aspx

and here: 和这里:

How to get Printer Info in .NET? 如何在.NET中获取打印机信息?

Not sure if this just lists the installed printers or the ones online? 不确定这只是列出已安装的打印机还是在线打印机?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM