Android Question Print ethernet


Well-Known Member
Licensed User
All above replies from Experts are right, but in my case I complaining a lot of pain because each printer manufacturers has different sdk & approach! and it is painful to your app to support all world printers types. So take another way & avoid pain by the following:
  1. Create your print data as pdf from html script using this great lib
  2. Install any third parity printer service on client device, in wihch it will print your generated pdf doc on any printer: thermal, wifi, bluetooth or direct usb
  3. In my projects I used this printer service it cover all printers possibilities & types

Bladimir Silva Toro

Active Member
Licensed User
Hello @Simo_L_Uk

Personally I could do it with a POS Epson TMII printer which connects via ethernet to your LAN network (Not USB)


The smartphone must connect it via WIFI to the same LAN where the printer is connected.

The code in B4A that you must use is the following:

Sub Process_Globals
    Dim TMT20II As Socket 'Network library
    Dim AStreams As AsyncStreams 'RandomAccessFile library
End Sub

Sub Activity_Create(FirstTime As Boolean)
    TMT20II.Connect("", 9100, 0) '100=Printer address, 9100=Port number (please look up port number)
End Sub

Sub TMT20II_Connected (Successful As Boolean)
    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

    SendMsg = "Hello, this is a test print" 'Send this line to the EPSON printer

    SendMsg = Chr(27) & Chr(100) & Chr(2) 'Line feed

    SendMsg = Chr(27) & Chr(109) 'Partial cut receipt paper
End Sub
You confirm to me if it works well for you.