在 Delphi 中使用 OPOS 驱动程序检查打印机消息
我正在尝试使用 Delphi (BDS2006) 中的 OPOS 驱动程序打开销售点 (POS) 打印机,但不知道如何检查打印机状态。
如何检查打印机中是否有诸如 Check Paper
和 Paper Jam
之类的消息?
I'm trying to open a Point of Sale (POS) printer using the OPOS Drivers in Delphi (BDS2006), but don't have a clue on how to check the printer status.
How would I check for messages like Check Paper
and Paper Jam
from the printer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我还没有使用过 OPOS 驱动程序,但我已经使用连接到现金抽屉的 Epson 收据打印机的 POS 驱动程序进行了一些工作。 我发现,如果打印机安装在 Windows 中,您就可以打开与它的直接连接并让它执行您想要的操作。
打印机速度如此之慢的原因是它使用了Windows的图形字体功能。 当你直接打开打印机时,你将模式设置为RAW,它只会像老式点阵一样发送文本。 要打开钱箱,您只需向其发送特定的控制代码,就像要打印它们一样。 打印机在打印之前拦截代码并踢开抽屉。
顺便说一句,我不知道这如何与 Unicode 一起使用。 我所使用的打印机只能处理 ASCII 数据。 可能会有专为国际市场设计的变体,其工作方式会有所不同。
这是我用来让它工作的代码(VxMsgBox 只是 MessageBox 的一个封面):
I haven't used OPOS Drivers but I have done some work with POS Drivers for an Epson receipt printer connected to a cash drawer. What I discovered was that, if the printer is installed in Windows, you can then open a direct connection to it and make it do whatever you want.
The reason the printer is so slow is that it's using the graphical font functions of Windows. When you open the printer directly, you will set the mode to RAW and it will just send text out like an old-style dot-matrix. To kick the cash drawer open, you just send it the specific control codes as if you were going to print them. The printer intercepts the codes before it prints and kicks the drawer open.
BTW, I have no idea how this would work with Unicode. The printer I had only really worked with ASCII data. There might be variants designed for international markets that would work differently.
Here's the code I've used to make it work (VxMsgBox is just a cover to MessageBox):
您是否使用此处的 ActiveX 控件:http://monroecs.com/oposccos.htm? 它有一个错误状态事件。
Are you using the ActiveX control from here: http://monroecs.com/oposccos.htm? It has an event for error status.
首先,您必须为您的设备安装正确的支持软件,您可能需要从制造商的网站下载该软件。 请记住,有时,许多设备(如收据打印机)包含标准硬件(例如 EPSON TX-88III),尽管品牌名称可能有所不同。
支持软件通常包含驱动程序、配置工具以及可能的如何使用驱动程序的编程示例。 确保正确完成以下步骤:
驱动程序安装、配置工具已完成
设备已使用正确的电缆正确连接(我在查找时遇到问题)正确的串行电缆,因为它们有许多不同类型)
您的设备被配置软件(通过驱动程序)识别并且通信良好,至少它响应一些功能
使用与驱动程序一起安装的 ActiveX 控件。 它应该与驱动程序具有相似的名称。
完成上述步骤后,您的应用程序中将拥有一个控件,它为您提供所有可用的功能、状态属性和事件(对于纸张或其他任何内容)。
First of all you have to install the right support software for your device, which you probably have to download from the manufacturer's website. Keep in mind that sometimes, many devices (like receipt printers) contain standard hardware (ex EPSON TX-88III) although the brand name might differ.
The support software usually contains the driver, configuration tools, and possibly programming examples of how to use the driver. Make sure that the following steps are correctly completed:
Installation of driver, config tools is done
The device is correctly connected using the right cables (I had problems finding the correct serial cable, since there are many different types of them)
Your device is recognised by the configuration software (through the driver) and communicates well, at least it responds to some functions
Use the ActiveX control that was installed with the driver. It should have similar name with the driver.
After the above steps you will have a control in your application that provides you with all available functions, status properties and events (for paper, or anything other).