我尝试过用静态值和ASCII值打印英镑符号,但它显示(?)签收回执,那么有其他方法打印英镑签收回执吗?
最后,在谷歌上搜索后,我在收据打印机中找到了打印英镑符号(£)的代码。我发布了这个解决方案,这可能对未来的其他开发人员有用。
适用于ESC/POS型打印机(与串行端口相关)
Dim bCOM(0) As Byte
bCOM(0) = &H9C
com1.Write(bCOM, 0, 1) 'where com1 is IO.Ports.SerialPort
对于OPOS类型的打印机
EpsonOposPrinter.CharacterSet = 1252
EpsonOposPrinter.PrintNormal(PrinterStation.Receipt, Chr(&H1B) + "|N" + "£12.30" + vbCrLf)
在VB.NET中可以按如下方式进行测试和工作!
'initially set printer to use codepage 1252 with ESC, t,16
Prnstr = Chr(&H1B) + "t" + Chr(16) _
& "Message to print including UK £" _
& Chr(&H1B)+ "t" + Chr(0) ' set printer back to default codepage
'IMPORTANT requires matching encoding type for string to byte array
conversion.
Dim data As [Byte]() = Encoding.GetEncoding("windows-1252").GetBytes(Prnstr)
Port.write (data,0,data.length)
epson esc pos vb.net