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

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Sorry, I was guessing cut behaviour, But I tested the code now, it worked fine for long receipt as well, thank you
 

Star-Dust

Expert
Licensed User
Longtime User
Only for the month of August 2022
  • ESCPOS Printer library (Android) (USB, LAN, BLE, Bluetooth)
  • iSD_BLE_Printer (ios) (BLE)
  • jSD BT_Printer (Windows) (Bluetooth SPP)

Promotion Price : 30€
Contact me with a private message before making the donation
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
For whatever reason, the search for a Bluetooth printer using the sample project doesn't return anything in my case. However, I can detect the printer if I run a different project (not using this library) on the same tablet.

Any ideas?
 

Star-Dust

Expert
Licensed User
Longtime User
For whatever reason, the search for a Bluetooth printer using the sample project doesn't return anything in my case. However, I can detect the printer if I run a different project (not using this library) on the same tablet.

Any ideas?
what tablet is it and what version of Android it uses? Bluetooth or ble?

Try setting SDK target to 19 to verify that it's not a question of permissions or manifest
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
NEWS
The DEMO version will allow you to print just one minute every 2. Now you can also print images and barcodes
 

iCAB

Well-Known Member
Licensed User
Longtime User
what tablet is it and what version of Android it uses? Bluetooth or ble?

Try setting SDK target to 19 to verify that it's not a question of permissions or manifest
Using Target SDK 19 I can see the printer and it does connect (according to the toast message). But If I try to click the "Text" button, it says "Demo Library -sorry not available"
 

Star-Dust

Expert
Licensed User
Longtime User
Using Target SDK 19 I can see the printer and it does connect (according to the toast message). But If I try to click the "Text" button, it says "Demo Library -sorry not available"
Well, that means it connects and works. If you use target 19 and function and with others it doesn't work then you have to fix the Manifest and the runtime permission request.

As for the DEMO version, if you download the one that is now available (I updated a couple of hours ago) you can print one minute every 2. So if it gives you the message just wait 60 seconds and restart the print
 

iCAB

Well-Known Member
Licensed User
Longtime User
I updated to version 1.01 and still getting locked out.
I wish you can provide a bit more flexibility, perhaps lock it based on date & time or something like that (it will be difficult to break in production)
 

Star-Dust

Expert
Licensed User
Longtime User
I updated to version 1.01 and still getting locked out.
I wish you can provide a bit more flexibility, perhaps lock it based on date & time or something like that (it will be difficult to break in production)
It freezes in odd minutes, you just have to wait 30/60 seconds
 

iCAB

Well-Known Member
Licensed User
Longtime User
How do I access ESC_POS commands to change fonts etc..?
 

Star-Dust

Expert
Licensed User
Longtime User
Printer:
Printer.Write(ESC_POS.FontA_Normal)
Printer.Write(ESC_POS.FontB_Bold)
Printer.Write(ESC_POS.FontA_DoubleWideHeight)
' etc....
See also the example attached to the second post.
Or the examples attached in the above BT_Printer library
 
Last edited:

iCAB

Well-Known Member
Licensed User
Longtime User
@Star-Dust thanks for your reply.
I am getting an exception with the code below


B4X:
            If BTConnected Then
                B_Printer.ClearBuffer
                B_Printer.AddBuffer_Writeline(Chr(27) & Chr(97) & Chr(50))
                B_Printer.RightJustify
                B_Printer.AddBuffer_Writeline("TEST -RIGHT")
                B_Printer.LeftJustify
                B_Printer.AddBuffer_Writeline("TEST - LEFT")
                B_Printer.CenterJustify
                B_Printer.AddBuffer_Writeline("TEST - CENTER")
                B_Printer.AddBuffer_Writeline("PRINT Euros char on chinese printer")
                
                
                    'The line below causes an exception. if I comment it out, all is good
                    ' java.lang.RuntimeException: No device connected
                    '    at anywheresoftware.b4a.objects.BleManager2.getService(BleManager2.java:413)
                    '    at anywheresoftware.b4a.objects.BleManager2.WriteData(BleManager2.java:371)
                    
                BL_Printer.Write(ESC_POS.FontA_Normal)
            End if
 

Star-Dust

Expert
Licensed User
Longtime User
change:
BL_Printer.Write(ESC_POS.FontA_Normal)
into
B_Printer.Write(ESC_POS.FontA_Normal)

(BL_Printer is for BLE / B_Printer for Bluetooth SPP)
 

iCAB

Well-Known Member
Licensed User
Longtime User
Hi @Star-Dust

How do I verify that the image and BarCode printing actually work with my printer? and in which format is the BarCode being generated?

Thanks again!
iCAB
 

Star-Dust

Expert
Licensed User
Longtime User
Hi @Star-Dust

How do I verify that the image and BarCode printing actually work with my printer? and in which format is the BarCode being generated?

Thanks again!
iCAB
For the printing of the images see the example in post # 2. For BarCode use the Printer.WriteBarCode("1234567890").

As always, the DEMO version prints in even minutes
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Update rel. 1.04
  • Added WriteBitmap WriteByte WriteText - send to print immediately
  • Added CutPartialPaper, CutTotalPaper and feed(lines As Int) in esc_pos.
On some printers the CutPaper command does not work, so I added CutTotalPaper and CutPartialPaper for printers that use other ESC / POS codes.
Also I added the feed function to scroll through the lines
B4X:
Printer.Write(ESC_POS.feed(5)) ' feed 5 lines'
 
Last edited:

menneaduplo

Member
Licensed User
Longtime User
Hi Star-Dust,
I would like to buy the library for B4A. I need to print images on 4 inch BIXOLON. I tried the demo with the text and I trust that the full version works well with the images as well.

How can I contact you privately?
 

Star-Dust

Expert
Licensed User
Longtime User
Hi Star-Dust,
I would like to buy the library for B4A. I need to print images on 4 inch BIXOLON. I tried the demo with the text and I trust that the full version works well with the images as well.

How can I contact you privately?
I don't know this printer. You should try the demo version first. if you can print the images then it is compatible. Proof that the library has all the functions you need.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…