B4A Library SD: BT Printer Bluetooth

zenlab

Member
Licensed User
Longtime User
Hi, the demo app when i press on "Scan Print Bluetooth" return this error:
java.lang.RuntimeException: Field: LastDiscoveredDevice not found in: anywheresoftware.b4a.objects.Serial$BluetoothAdmin
 

Star-Dust

Expert
Licensed User
Longtime User
Have you updated the Serial library?
 

Star-Dust

Expert
Licensed User
Longtime User
yes! Version 1.26
Serial 1.30 is last version
I had given you the link in private when I sent you the library.

It is also written in the first post. Please follow the instructions that are indicated carefully.
 

zenlab

Member
Licensed User
Longtime User
Hallo, there is any function to check if the printer is realy connected to device? My printer after a few seccond autoclose the connection and if I send another print I can't check if i may do
 

Star-Dust

Expert
Licensed User
Longtime User
The connection to the BT printer is different from a classic printer and does not return information about the status of the printer.

If an associated printer could not be reached, the library after a few attempts generates an error MessageBox. In the next update it will raise a ConnectedToPrint(Success As Boolean) event.
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
BT_Printer 0.13 update

The event has been modified ConnectToPrint now returns a Boolean parameter so as to check if the device has connected to the printer,
B4X:
ConnectToPrint (Success As Boolean)

Also you can change the Width size of the PreView with
B4X:
ResetPreViewWidth (NewWidth as int)
By default, the value is 320dip, but you can change it for different paper sizes.

The examples have been updated
 

Star-Dust

Expert
Licensed User
Longtime User
I answer a question that has been proposed to me in private.
How can I use other ESC commands with my library?
The library is already equipped with a series of ESC commands, you can use them by listening to ESC_POS.

For example, if you would like to reset the printer:
B4X:
Printer.AddBuffer_ArrayByte(ESC_POS.InitializePrinter.GetBytes("UTF8"))
'or
Printer.AddBuffer_Write(ESC_POS.InitializePrinter)

Other commands are qiesti (you can find them also in the first post in the description of the library)
ESC_POS
Code module
Subs in this code module will be accessible from all modules.

  • Fields:
    • BoldOff As String
    • BoldOn As String
    • DoubleOff As String
    • DoubleOn As String
    • FontA_Bold As String
    • FontA_DoubleHight As String
    • FontA_DoubleWide As String
    • FontA_DoubleWideHight As String
    • FontA_Normal As String
    • FontB_Bold As String
    • FontB_DoubleHight As String
    • FontB_DoubleWide As String
    • FontB_DoubleWideHight As String
    • FontB_Normal As String
    • InitializePrinter As String
 
Last edited:

infow

Member
Licensed User
Longtime User
Keep the good work!

__________________________________
You sent R$ 100,00 to Salvatore Montoro



Transaction Details

Transaction ID: 3PU7342970565931T

19 de novembro de 2018



Money sent

R$ 100,00
 

Star-Dust

Expert
Licensed User
Longtime User
Thank you for the suggestion. I had already considered this possibility, but I did not consider it necessary.

But if you need to insert it.
 

infow

Member
Licensed User
Longtime User
It´s very userful. I have a header in any print I did, with the header in memory I can send only text... Becames a lot faster print.
 

virpalacios

Active Member
Licensed User
Longtime User
Hi Star-Dust, I tried your library but I got a toastmessage Demo Library - Sorry Not Available. Thanks very much for your help
 

Star-Dust

Expert
Licensed User
Longtime User
Hello @virpalacios, as you read in post#1, I attached a demo version to try the library, several methods are disabled except FlushAndClose that allows you to print.

You can keep the full version by making a donation, if you are interested you can get information by contacting me in private
 

vvg

Member
Licensed User
Longtime User
I hv sent donation. Kindly send me bt printer library
 

vvg

Member
Licensed User
Longtime User
sir, i hv sent donation for bt library.
When and hpw u r sending it? If demo is to be downloaded, then how to register it?
My paypal tr id is

ID: 1E889382M39306932 3 February
 

kurniahenki

Member
Licensed User
Sorry sir,
when using your sample i did try run on my b4x ver 8.5 and when running on debug it's normal can show the form and printing with Printer.flushAllAndClose and it work. but when i release it to .apk and install on my samsung tab 7.0 and LG Stylus2 Dual2 and try running , it keep showing apps doesn't work and keep closing.

the message is "Unfortunately, Bluetooth Printer Sample has stopped"

any solution ?

i didn't change anything,
and my manifest editor is :
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.


and i'm using only library
Core Version 8.5
RuntimePermission version 1.10
SD_BT_Printer version 0.13




thx
 

Star-Dust

Expert
Licensed User
Longtime User
What version of Android use these devices.

Does it generate any kind of error or does the app just stop?

Try setting the target SDK to 19 in the manifest. It could be a matter of runtime permissions
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…