uoa*_*oah 3 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"));
Run Code Online (Sandbox Code Playgroud)
在调试并到达行时:
_oposPrinter.PrintNormal(PrinterStation.Receipt, logo);
Run Code Online (Sandbox Code Playgroud)
要么
_oposPrinter.PrintNormal(PrinterStation.Receipt, Convert.ToString((char)27 + "|#fP"));
Run Code Online (Sandbox Code Playgroud)
打印机不打印任何内容.
如果您正在寻找一种非常轻量级的解决方案,而无需安装第三方软件,例如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 }));
Run Code Online (Sandbox Code Playgroud)
其他打印机可能需要其他代码序列.
Citizen
27,112,0,50,250
Epson
27,112,48,55,121
27,112,0,25,250
27,112,48,25,250
IBM
7
Run Code Online (Sandbox Code Playgroud)
...(查看更多代码,包括自动切割机或第二个抽屉,网址为http://keyhut.com/popopen.htm)
| 归档时间: |
|
| 查看次数: |
13117 次 |
| 最近记录: |