[英]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.