POS打印机自动识别

发布于 2024-10-21 17:23:32 字数 76 浏览 1 评论 0原文

我有多台POS打印机,需要自动识别打印机的类型。我需要在不使用 POS.NET 或打印机驱动程序的情况下完成此操作。我怎样才能做到这一点?

I have a number of POS printers and need to automatically recognize the type of the printer. I need do it without using POS.NET or printer drivers. How can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小姐丶请自重 2024-10-28 17:23:32

没有标准的方法来识别这样的打印机。

在一般情况下这是困难或不可能的(打印机可能使用不同的 COM 端口配置 - 波特率等 - 以及不同的协议)。由于许多打印机可以通过 DIP 开关或发送命令以不同的方式进行配置,因此情况变得更加复杂。

如果要识别的打印机数量相当少,并且您知道所有打印机的正确 COM 端口配置,则可以尝试发送命令/读取响应,以找到允许您在支持的打印机中唯一标识打印机的组合。

许多 POS 打印机支持 ESC/POS 协议的变体,并且对状态请求的响应(查看每台打印机的手册)可能存在差异,使您能够做出区分。

当然,您将面临持续的维护难题 - 每次您想要支持新的打印机型号时,您将不得不再次尝试找到一些显着特征并更新您的识别软件。

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). It's complicated further by the fact that many printers can be configured in different ways by DIP switches or by sending commands.

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.

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.

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.

春夜浅 2024-10-28 17:23:32

看一下这个项目的源代码,它支持很多POS打印机:

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

在每台打印机的实现中,您可以找到识别子程序,用于自动搜索连接的打印机。

Take a look at this project which supports a lot of POS printers in the source codes:

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.

百善笑为先 2024-10-28 17:23:32

刚刚进行了一次快速的谷歌搜索,也许您可​​以列出可用的打印机,例如: http://www.c-sharpcorner.com/UploadFile/mahesh/printerslisting06072007092859AM/printerslisting.aspx

和此处:

如何在 .NET 中获取打印机信息?

不确定这只是列出已安装的打印机还是在线的打印机?

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

and here:

How to get Printer Info in .NET?

Not sure if this just lists the installed printers or the ones online?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文