简体   繁体   English

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

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

I have T-20 Espon printer, I'm beginner, I wanted to print Hello printer string (Nothing is working and I'm just getting started so I just want something printed), I started with that code : 我有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");

But when I execute the code I have this popping up : 但是当我执行代码时,我会弹出这个:

在此输入图像描述

1- In the Epson series i used the OPOS ADK 1-在爱普生系列中,我使用了OPOS ADK

2- After installer i started the Setup : Startup -> All Programs -> OPOS -> SetupPOS . 2-安装完成后,我启动了安装程序: 启动 - >所有程序 - > OPOS - > SetupPOS

3- A went to Device -> POSPrinter 3- A去了Device - > POSPrinter

4- Right Click : Add New Device and Fill details 4-右键单击: 添加新设备和填充详细信息

5- In Add New LDN enter a Logical Name ( my example : T20PRINTER ) 5-在“ 添加新LDN”中输入逻辑名称( 我的示例:T20PRINTER

6- In Visual Studio use the same code, but replace : 6-在Visual Studio中使用相同的代码,但替换为:

_device = explorer.GetDevice(DeviceType.PosPrinter);

with : 用:

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

with way you are sure that you are calling your Printer with its Logical Name 通过这种方式,您确定使用其逻辑名称调用打印机

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

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