我搜索了很多,我在这里找到了 Posexplorer 的例子,但我的打印机是 USB 的,我读过 PosExplorer 是并行的。我不知道如何用打印机打印以及如何将代码发送到打印机以打开抽屉。
我正在使用以下代码向打印机发送转义序列:
string ESC = Convert.ToString((char)27);
string logo=Convert.ToString(ESC+"|tL");
_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);
_oposPrinter.PrintNormal(PrinterStation.Receipt, "Print example\n");
_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));
当调试到达线路时:
_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);
或
_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));
打印机不打印任何东西。
最佳答案
如果您正在寻找一个非常轻量级的解决方案无需第 3 方安装软件,例如 Microsoft POS for .NET。
您需要包含函数RawPrinterHelper(可以从https://support.microsoft.com/en-us/help/322091/how-to-send-raw-data-to-a-printer-by-using-visual-c-.net 下载)
然后将特定的现金抽屉代码发送到它所连接的打印机上打开它。
例如,在 Epson TM88 上,此函数将打开它。
SendStringToPrinter(printerName, System.Text.ASCIIEncoding.ASCII.GetString(new byte[] { 27, 112, 48, 55, 121 }));
其他打印机可能需要其他代码序列。
Citizen
27,112,0,50,250
Epson
27,112,48,55,121
27,112,0,25,250
27,112,48,25,250
IBM
7
...(在 http://keyhut.com/popopen.htm 查看更多代码,包括自动切纸器或第二个抽屉)
关于c# - 使用 Epson T20(热敏打印机)打印和打开抽屉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8525045/