4

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

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

在此处输入图像描述

4

1 回答 1

3

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

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

于 2014-03-20T21:36:41.813 回答