简体   繁体   中英

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 :

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

2- After installer i started the Setup : Startup -> All Programs -> OPOS -> SetupPOS .

3- A went to Device -> POSPrinter

4- Right Click : Add New Device and Fill details

5- In Add New LDN enter a Logical Name ( my example : T20PRINTER )

6- In Visual Studio use the same code, but replace :

_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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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