i wanted to know if it is possible to print on ethernet POS printer .
How to ?
Thanks
How to ?
Thanks
i wanted to know if it is possible to print on ethernet POS printer .
Sub Process_Globals
Dim TMT20II As Socket 'Network library
Dim AStreams As AsyncStreams 'RandomAccessFile library
End Sub
Sub Activity_Create(FirstTime As Boolean)
TMT20II.Initialize("TMT20II")
TMT20II.Connect("192.168.0.100", 9100, 0) '100=Printer address, 9100=Port number (please look up port number)
End Sub
Sub TMT20II_Connected (Successful As Boolean)
Log(Successful)
If Successful Then
AStreams.Initialize(TMT20II.InputStream, TMT20II.OutputStream, "AStreams")
CallSub(Null, SendToPrinter)
End If
End Sub
Sub SendToPrinter
Dim SendMsg As String
SendMsg = Chr(27) & Chr(61) & Chr(1) 'Select EPSON printer
AStreams.Write(SendMsg.GetBytes("UTF8"))
SendMsg = "Hello, this is a test print" 'Send this line to the EPSON printer
AStreams.Write(SendMsg.GetBytes("UTF8"))
SendMsg = Chr(27) & Chr(100) & Chr(2) 'Line feed
AStreams.Write(SendMsg.GetBytes("UTF8"))
SendMsg = Chr(27) & Chr(109) 'Partial cut receipt paper
AStreams.Write(SendMsg.GetBytes("UTF8"))
End Sub
The code in B4A that you must use is the following: