B4J Question [ Jet Direct ] is there how to print directly on Wifi printers?

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
I have 2 thermal printers connected to the network via wifi on port 9100, does anyone know how I print directly on them via the IP and the PORT?

I requested the following link
xxx.xxx.xxx.xxx:9100
through the browser, printed a sheet with information from my browser. is there a way to send text or files?
 

tchart

Well-Known Member
Licensed User
Longtime User
What is the model of the printer?

A long time ago we used to create print files via software and then just copy them to the printer across the network using DOS. If the printer supports PCL this could be an option.
 
Upvote 0

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
What is the model of the printer?

A long time ago we used to create print files via software and then just copy them to the printer across the network using DOS. If the printer supports PCL this could be an option.
i am trying to print directly using IP:9100 using Socket TCP.
Model printer is : Epson L365 and 2 tanca - TP-650 . all connected on my Wi-fi . i am trying to use ESC . but apparently dont works ...
 
Upvote 0

Unobtainius

Active Member
Licensed User
Longtime User
I nabbed this the other day thinking it would be useful in the future
written by one the gurus here unfortunately I didn't save the name

B4X:
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
 
Upvote 1

TILogistic

Expert
Licensed User
Longtime User
see:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…