c# - 使用 Epson T20(热敏打印机)打印和打开抽屉

标签 c# thermal-printer pos-for-.net

我搜索了很多,我在这里找到了 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/

相关文章:

reactjs - ElectronJS打印HTML文档的高度问题

java - 发送十六进制命令到 ESC/POS 打印机 Android

c# - StackExchange.Redis 简单 C# 示例

c# - 如何根据需要指定 OperationContract 的参数

c# - 如何验证集合类型?

c# - OPOS PosExplorer.GetDevice() 在 Windows 服务中执行时返回 null

c# - Sql DataReader 有行但返回空数据

linux - 需要拔出/插入才能访问 USB 端口 Chrome 应用程序

c# - 无法领取 PosPrinter