B4A Library SD EscPos Printer (Lan,USB, Bluetooth SPP, BLE)

MR Kai

Member
Licensed User
Longtime User
hi star
when print image get this
plz check attached images
 

Attachments

  • 1.png
    234.9 KB · Views: 176
  • 2.png
    242.8 KB · Views: 166

Star-Dust

Expert
Licensed User
Longtime User
hi star
when print image get this
plz check attached images
Image looks too big. You have to shrink it to 330 dots wide and it has to be B/W, shades of gray are not good
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update rel. 1.05
  • Added conversions of color images to black and white for printing
 

MarcoRj

New Member
Hi, I need to print a webview on a thermal printer.. can I print a webview with this library?...Have any example pls..
 

aeric

Expert
Licensed User
Longtime User
Hi, I need to print a webview on a thermal printer.. can I print a webview with this library?...Have any example pls..
Maybe you need to convert the content to an image. Put the webview on a Panel (Pane) and take a snapshot. Then print the image using this library. I never try it.
 

Star-Dust

Expert
Licensed User
Longtime User
Hi, I need to print a webview on a thermal printer.. can I print a webview with this library?...Have any example pls..
as @aeric correctly said you need to get a picture. webView has a function to export page to image. You must bear in mind that the image must be reduced in size to be printed on a thermal printer
 

Star-Dust

Expert
Licensed User
Longtime User
in the first post it is explained how to do it
 

Star-Dust

Expert
Licensed User
Longtime User
WISH to be added if possible:
B4X:
PrintPDF(dir as string,filename as string)
Use this
 

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Yes, I'm using that method, but I am wishing to be integrated inside your great lib in your next update.
 

Star-Dust

Expert
Licensed User
Longtime User
HaH thank you for your clarification, I understood what your wish was.

This function in version b4a and b4j require external libraries that I do not own and cannot integrate into my own library.

Studying another system of mine to integrate the PDF inside would take a lot of time and increase costs. I prefer to suggest an external method and keep the cost low
 

RonkyOne

Member
Licensed User
Longtime User
Hi ,
when using the network printer,
and for some reason the connection with it is lost, any call returns this error and closes the app.
what do you recommend as a solution, like a call before writing?

or a way to trap the error...
Thank you



error:

java.lang.RuntimeException: java.net.SocketException: Socket is not connected
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:258)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.net.SocketException: Socket is not connected
at java.net.Socket.checkOpenAndCreate(Socket.java:671)
at java.net.Socket.getInputStream(Socket.java:361)
at anywheresoftware.b4a.objects.SocketWrapper.getInputStream(SocketWrapper.java:239)
at b4a.example.ble.lan_printer._lanconnection_connected(lan_printer.java:149)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
... 8 more
 

Star-Dust

Expert
Licensed User
Longtime User
I imagine you lose the connection after sending and then hang around exceeding the timeout.

If so, every time you send something to the printer, if the next send takes longer than 10 seconds (in some cases even less) you should open the connection [eg. Printer.Connect(Host,Port) ] again and perhaps close it after printing [eg. Printer.Disconnect]
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…