Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim CustomPrinter As Socket
Dim AStreams As AsyncStreams
Private btnPrint As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
CustomPrinter.Initialize("CustomPrinter")
CustomPrinter.Connect("192.168.1.81", 9100, 0) '192.168.1.81=Printer address, 9100=Port number (please look up port number)
End Sub
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub btnPrint_MouseClicked (EventData As MouseEvent)
Dim SendMsg As String
SendMsg = "Hello World !!!" 'Send this line to the EPSON printer
AStreams.Write(SendMsg.GetBytes("UTF8"))
AStreams.Write(("" & Chr(10)).GetBytes("UTF8"))
End Sub
Sub CustomPrinter_Connected (Successful As Boolean)
Log("Connecterd : " & Successful)
If Successful Then
AStreams.Initialize(CustomPrinter.InputStream, CustomPrinter.OutputStream, "AStreams")
End If
End Sub