I personally use 2 lines as I don't always use UTF8. Actually for a customers Bluetooth printer app I used ISO-8859-1 because of currency symbols I think, or was it 2 dots. Anyway I'm more than sure @Erel knows of an easier way to switch between UTF8 and ISO=8859-1 but only using 1 one instead of 2.
But hey, what can one say except that it's now time for a cycle ride, then a game of snooker, then I'll do some coding
Back again after a few years out of this but now back in action - and should be taking into a new role at work in coming weeks (and new subscriptions for Erel!)
Anyway, doing some testing in advanced and found this helpful for printing over a network.
What I have found though it needs some form of test to make sure a printer is connected (or if network is a wee bit slow to respond)
With the new (to me on returning) Wait For function and Resumable Subs the below works to confirm a connection - maybe this could help others out.
Thanks for above!
Sub NetworkPrinter_Connected (Successful As Boolean) As ResumableSub
If Successful Then
AStreams.Initialize(NetworkPrinter.InputStream, NetworkPrinter.OutputStream, "AStreams")
Sub ConnectPrinters(ipAddress As String, portNo As Int, timeOut As Int, timeToConnect As Int)As ResumableSub
NetworkPrinter.Connect(ipAddress, portNo, timeOut)
Dim timeCounter As Int = 0
Dim connected As Boolean = False
Do Until timeCounter = timeToConnect Or connected = True
connected = NetworkPrinter.Connected
timeCounter = timeCounter + 1
Sub SendToPrinter (printerOutput As String)
Wait For (ConnectPrinters("192.168.0.2", 9100, 0, 5)) Complete (connectedResult As Boolean)
If connectedResult Then
Log("Printer not initialised")
What I personally do is ping the IP addresses of the printer before making the connection.
I have an Epson TM T20II connected to a LAN network via Ethernet port.
ProgressDialogShow("Conectado a Impresora. Favor Espere...")
Dim p As Phone
Wait For (p.ShellAsync("ping", Array As String("-c", "1",Principal.DirIpImpLANBodega))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
If Success And ExitValue=0 Then
TMT20II.Connect(Principal.DirIpImpLANBodega, 9100, 0) '100=Printer address, 9100=Port number (please look up port number)
Msgbox("Impresora NO Conectada a la Red. Vuelva a Intentarlo","Mensaje!!!")
Testing is done by connecting the printer to the wireless network but the process is slow
For info, I've seen members posting up regarding printing to Zebra printers. As I'm testing to use in an industrial environment with labels, I have been able to print to a network based Honeywell successfully. The only thing to note is again network speed related. I amended my code about to wait for the stream to complete with another Wait For, otherwise the printer would flash away receiving data while the code completed and closed the steam. Hope that's of use for people
Wait For (AStreams.OutputQueueSize = 0) Completed