...
Sub Printer_Connected (Success As Boolean)
If Success Then
Printer.Initialize2(BTConnection.OutputStream,"windows-1252") 'important to print f.e. German/French chars
PrintBuffer=Chr(27)&"t"&Chr(16)&"Hello" 'Set codepage 1252
Printer.WriteLine(PrintBuffer)
PrintBuffer=Chr(29) & Chr(86) & Chr(48)
Printer.WriteLine(PrintBuffer) '<-------- YOU FORGET THIS
Printer.Flush 'limpia la impresora
Msgbox("Printed!","")
Printer.Close
BTConnection.Disconnect 'disable this if you like
Else
.....
Sub POS_onBind()
' You can now use the BDxxx Methods. The Service is connected.
Log($"POS_onBind()"$)
'pos.BDconnectBtPort("00:00:00:00:00","BDconnectBtPort")
pos.BDconnectBtPort("DC:0D:30:06:98:71","BDconnectBtPort")
End Sub
private void printBarcode(){
MainActivity.binder.writeDataByYouself(new UiExecute() {
@Override
public void onsucess() {
}
@Override
public void onfailed() {
}
}, new ProcessData() {
@Override
public List<byte[]> processDataBeforeSend() {
ArrayList<byte[]> list=new ArrayList<byte[]>();
//first you have to set the width and heigt ,
// you can also use dot or inch as a unit method, specific conversion reference programming manual
list.add(DataForSendToPrinterTSC.sizeBymm(60,30));
//set the gap
list.add(DataForSendToPrinterTSC.gapBymm(0,0));
//clear cach
list.add(DataForSendToPrinterTSC.cls());
//print barcode
list.add(DataForSendToPrinterTSC.barCode(60,50,"128",100,1,0,2,2,"abcdef12345"));
//print
list.add(DataForSendToPrinterTSC.print(1));
return list;
}
});
}
POS_onBind()
//first you have to set the width and heigt ,
// you can also use dot or inch as a unit method, specific conversion reference programming manual
list.add(DataForSendToPrinterTSC.sizeBymm(60,30));
//set the gap
list.add(DataForSendToPrinterTSC.gapBymm(0,0));
//clear cach
list.add(DataForSendToPrinterTSC.cls());
//print barcode
list.add(DataForSendToPrinterTSC.barCode(60,50,"128",100,1,0,2,2,"abcdef12345"));
//print
list.add(DataForSendToPrinterTSC.print(1));
Dim list As List
list.Initialize
list.add(pos.sizeBymm(60,30))
'//set the gap
list.add(pos.gapBymm(0,0))
'//clear cach
list.add(pos.cls())
'//print barcode
list.add(pos.barCode(60,50,"128",100,1,0,2,2,"abcdef12345"))
'//print
list.add(pos.print(1))
pos.writeDataByYouself(list,"Barcode")
private void printContent() {
MainActivity.binder.writeDataByYouself(new UiExecute() {
@Override
public void onsucess() {
showSnackbar("print ok !");
}
@Override
public void onfailed() {
showSnackbar("print not ok !");
}
}, new ProcessData() {
@Override
public List<byte[]> processDataBeforeSend() {
ArrayList<byte[]> list=new ArrayList<byte[]>();
//default is gbk,if you don't set the charset
DataForSendToPrinterTSC.setCharsetName("gbk");
byte[] data= DataForSendToPrinterTSC.sizeBymm(60,30);
list.add(data);
//set the gap
list.add(DataForSendToPrinterTSC.gapBymm(0,0));
// clear the cache
list.add(DataForSendToPrinterTSC.cls());
//barcode command,parama:int x: x print start point;int y:y print start point;
//string font,text font type ;int rotation,angle of rotation ;
//int x_multiplication,Font x directional magnification
//int y_multiplication,Font y directional magnification
//string content,print cont
byte[] data1 = DataForSendToPrinterTSC
.text(10, 10, "1", 0, 1, 1,
"abc123");
list.add(data1);
//print line,int x;int y;int width,width of the line ;int height,height of the line
list.add(DataForSendToPrinterTSC.bar(20,
40, 200, 3));
//print barcode
list.add(DataForSendToPrinterTSC.barCode(
60, 50, "128", 100, 1, 0, 2, 2,
"abcdef12345"));
//print
list.add(DataForSendToPrinterTSC.print(1));
showSnackbar("content");
return list;
}
});
}
Dim list As List
list.Initialize
'//default Is gbk,If you don't set the charset
pos.CharsetName = "gbk"
list.Add(pos.sizeBymm(60,30))
list.add(pos.gapBymm(0,0))
'// clear the cache
list.add(pos.cls())
'//barcode command,parama:int x: x print start point;int y:y print start point;
'//string font,text font Type ;int rotation,angle of rotation ;
'//int x_multiplication,Font x directional magnification
'//int y_multiplication,Font y directional magnification
'//string content,print cont
list.Add(pos.text(10, 10, "1", 0, 1, 1,"abc123"))
'//print line,int x;int y;int width,width of the line ;int height,height of the line
list.add(pos.bar(20,40, 200, 3))
'//print barcode
list.add(pos.barCode(60, 50, "128", 100, 1, 0, 2, 2,"abcdef12345"))
'//print
list.add(pos.print(1))
pos.writeDataByYouself(list,"Text")
Dim list As List
list.Initialize
'//default Is gbk,If you don't set the charset
pos.CharsetName = "gbk"
list.Add(pos.sizeBymm(60,30))
list.add(pos.gapBymm(0,0))
'// clear the cache
list.add(pos.cls())
'//barcode command,parama:int x: x print start point;int y:y print start point;
'//string font,text font Type ;int rotation,angle of rotation ;
'//int x_multiplication,Font x directional magnification
'//int y_multiplication,Font y directional magnification
'//string content,print cont
list.Add(pos.text(10, 10, "1", 0, 1, 1,"abc123"))
'//print line,int x;int y;int width,width of the line ;int height,height of the line
list.add(pos.bar(20,40, 200, 3))
'//print barcode
list.add(pos.barCode(60, 50, "128", 100, 1, 0, 2, 2,"abcdef12345"))
list.add(pos.feed(20)) ' Added feed
list.add(pos.cut) ' Added CUT
'//print
list.add(pos.print(1))
pos.writeDataByYouself(list,"Text")
Logger connected to: BMXC K107
--------- beginning of system
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 55)
pos.writeDataByYouself(list,"Text")
java.lang.NullPointerException: Attempt to invoke interface method 'void net.posprinter.posprinterface.IMyBinder.writeDataByYouself(net.posprinter.posprinterface.UiExecute, net.posprinter.posprinterface.ProcessData)' on a null object reference
at de.donmanfred.POSPrinterwrapper.writeDataByYouself(POSPrinterwrapper.java:443)
at b4a.example.main._activity_create(main.java:400)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
Logger connected to: BMXC K107
--------- beginning of system
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
binder connected
POS_onBind()
POS_onSuccess(BDconnectBtPort)
POS_onSuccess(Text)
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
binder connected
POS_onBind()
POS_onFailed(BDconnectBtPort)
POS_onFailed(Text)
** Activity (main) Pause, UserClosed = false **
lol. I did not expect this. Not really...printing..
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim pos As POSPrinter
Dim tsc As TSChelper
Dim pos80 As POS80helper
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
pos.Initialize("POS")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub POS_onBind()
' You can now use the BDxxx Methods. The Service is connected.
Log($"POS_onBind()"$)
pos.BDconnectBtPort("DC:0D:30:06:98:71","BDconnectBtPort")
End Sub
Sub POS_onFailed(tag As Object)
Log($"POS_onFailed(${tag})"$)
End Sub
Sub POS_onSuccess(tag As Object)
Log($"POS_onSuccess(${tag})"$)
Dim list As List
list.Initialize
list.add(tsc.sizeBymm(60,30))
'//set the gap
list.add(tsc.gapBymm(0,0))
'//clear cach
list.add(tsc.cls())
'//print barcode
list.add(tsc.barCode(60,50,"128",100,1,0,2,2,"abcdef12345"))
'//print
list.add(tsc.print(1))
pos.writeDataByYouself(list,"Barcode")
Dim list As List
list.Initialize
'//default Is gbk,If you don't set the charset
tsc.CharsetName = "gbk"
list.Add(tsc.sizeBymm(60,30))
list.add(tsc.gapBymm(0,0))
'// clear the cache
list.add(tsc.cls())
'//barcode command,parama:int x: x print start point;int y:y print start point;
'//string font,text font Type ;int rotation,angle of rotation ;
'//int x_multiplication,Font x directional magnification
'//int y_multiplication,Font y directional magnification
'//string content,print cont
list.Add(tsc.text(10, 10, "1", 0, 1, 1,"abc123"))
'//print line,int x;int y;int width,width of the line ;int height,height of the line
list.add(tsc.bar(20,40, 200, 3))
'//print barcode
list.add(tsc.barCode(60, 50, "128", 100, 1, 0, 2, 2,"abcdef12345"))
list.add(tsc.feed(20))
list.add(tsc.cut)
'//print
list.add(tsc.print(1))
pos.writeDataByYouself(list,"Text")
End Sub
Sub POS_onUnBind()
' Service Disconnected....
' DO NOT use the DBxxx-Methods....
Log($"POS_onUnBind()"$)
End Sub
Logger connected to: BMXC K107
--------- beginning of system
--------- beginning of main
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
binder connected
POS_onBind()
POS_onSuccess(BDconnectBtPort)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
POS_onSuccess(Text)
POS_onSuccess(Barcode)
** Activity (main) Pause, UserClosed = false **
selectPrintModel (n As Int)
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: Bluetooth POS Printing
#VersionCode: 1
#VersionName:
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
Sub Process_Globals
Dim PrintBuffer As String
Dim BtAdmin As BluetoothAdmin
Dim BTConnection As Serial
Dim Printer As TextWriter
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
BtAdmin.Initialize("BlueTooth")
BTConnection.Initialize("Printer")
Dim PairedDevices As Map
PairedDevices = BTConnection.GetPairedDevices
Dim l As List
Dim DeviceName, MacAddress As String
l.Initialize
For i = 0 To PairedDevices.Size - 1 'Check all devices
l.Add(PairedDevices.GetKeyAt(i))
DeviceName=PairedDevices.Getkeyat(i)
MacAddress=PairedDevices.GetValueAt(i)
Log(DeviceName & " -> " & MacAddress)
If DeviceName.Contains("Printer001") Then 'Insert the BT-Name of the printer or use the MAC address
Exit
End If
Next
BTConnection.Connect(MacAddress)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause
End Sub
Sub Printer_Connected (Success As Boolean)
If Success Then
Printer.Initialize2(BTConnection.OutputStream,"windows-1252") 'important to print f.e. German/French chars
PrintBuffer=Chr(27)&"t"&Chr(16)&"Hello" 'Set codepage 1252
Printer.WriteLine(PrintBuffer)
PrintBuffer=Chr(29) & Chr(86) & Chr(48)
Printer.Flush 'limpia la impresora
Msgbox("Printed!","")
Printer.Close
BTConnection.Disconnect 'disable this if you like
Else
Msgbox("No printer found...","Print error")
End If
End Sub
do you tried ?
...
Sub Printer_Connected (Success As Boolean)
If Success Then
Printer.Initialize2(BTConnection.OutputStream,"windows-1252") 'important to print f.e. German/French chars
PrintBuffer=Chr(27)&"t"&Chr(16)&"Hello" 'Set codepage 1252
Printer.WriteLine(PrintBuffer)
PrintBuffer=Chr(29) & Chr(86) & Chr(48)
Printer.WriteLine(PrintBuffer) '<-------- YOU FORGET THIS
Printer.Flush 'limpia la impresora
Msgbox("Printed!","")
Printer.Close
BTConnection.Disconnect 'disable this if you like
Else
.....
B4X:... Sub Printer_Connected (Success As Boolean) If Success Then Printer.Initialize2(BTConnection.OutputStream,"windows-1252") 'important to print f.e. German/French chars PrintBuffer=Chr(27)&"t"&Chr(16)&"Hello" 'Set codepage 1252 Printer.WriteLine(PrintBuffer) PrintBuffer=Chr(29) & Chr(86) & Chr(48) Printer.WriteLine(PrintBuffer) '<-------- YOU FORGET THIS Printer.Flush 'limpia la impresora Msgbox("Printed!","") Printer.Close BTConnection.Disconnect 'disable this if you like Else .....