gpt4 book ai didi

在模拟器而不是打印机上执行的打印机的 C# POS 代码

转载 作者:太空狗 更新时间:2023-10-30 01:36:21 24 4
gpt4 key购买 nike

我有 T-20 Espon 打印机,我是初学者,我想打印 Hello printer 字符串(没有任何效果,我才刚刚开始,所以我只想打印一些东西),我从该代码开始:

PosExplorer explorer = null;
DeviceInfo _device;
PosPrinter _oposPrinter;

explorer = new PosExplorer();
_device = explorer.GetDevice(DeviceType.PosPrinter);
_oposPrinter = (PosPrinter) explorer.CreateInstance(_device);
_oposPrinter.Open();
_oposPrinter = (PosPrinter) explorer.CreateInstance(_device);
_oposPrinter.Open();
_oposPrinter.Claim(10000);
_oposPrinter.DeviceEnabled = true;
//normal print
_oposPrinter.PrintNormal(PrinterStation.Receipt, "Hello world");

但是当我执行代码时,我弹出了这个:

enter image description here

最佳答案

1- 在 Epson 系列中,我使用了 OPOS ADK

2- 安装程序后我开始安装:启动 -> 所有程序 -> OPOS -> SetupPOS

3- A 转到设备 -> POSPrinter

4- 右键单击​​:添加新设备 并填写详细信息

5- 在添加新 LDN 中输入逻辑名称(我的示例:T20PRINTER)

6- 在 Visual Studio 中使用相同的代码,但替换为:

_device = explorer.GetDevice(DeviceType.PosPrinter);

与:

_device = explorer.GetDevice(DeviceType.PosPrinter, "T20PRINTER");

通过这种方式,您确定您正在使用其逻辑名称

调用您的打印机

关于在模拟器而不是打印机上执行的打印机的 C# POS 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22428379/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com