繁体   English   中英

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

[英]C# POS code for Printer executing on Simulator instead of The Printer

我有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");

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

在此输入图像描述

1-在爱普生系列中,我使用了OPOS ADK

2-安装完成后,我启动了安装程序: 启动 - >所有程序 - > OPOS - > SetupPOS

3- A去了Device - > POSPrinter

4-右键单击: 添加新设备和填充详细信息

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

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

_device = explorer.GetDevice(DeviceType.PosPrinter);

用:

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

通过这种方式,您确定使用其逻辑名称调用打印机

暂无
暂无

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

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