Android Question BT-PRINTER (BLUETOOTH) VERSION 0.15 STAR-DUST

manuelsalazar

Member
Licensed User
Hi, I have been using your library, and sometimes prints perfect the things that I put in the buffer and sometime does not print with the same android machine (its random issue) , routine, and printer , is there anything that I am doing wrong ?????
 

Star-Dust

Expert
Licensed User
Hi, I have been using your library, and sometimes prints perfect the things that I put in the buffer and sometime does not print with the same android machine (its random issue) , routine, and printer , is there anything that I am doing wrong ?????
Sometimes if the buffer has been overfilled (for example with large images or more images) the bluetooth is not able to transmit correctly.

So it could be the case to send the buffer in print immediately after each image
 
Upvote 0

Star-Dust

Expert
Licensed User
Each image SendBufferToPrinter
 
Upvote 0

manuelsalazar

Member
Licensed User
I use the following code ........

B4X:
Sub Printer_ConnectedToPrint (Success As Boolean)
    Dim borrado As String
'    When is connect
    If Success Then
        Printer.ClearBuffer
        Printer.AddBuffer_WriteLine(Main.RComercio)
        Printer.AddBuffer_WriteLine(Main.RTienda)
        Printer.AddBuffer_WriteLine(Main.RUbica)
        Printer.SendBufferToPrinter
        Printer.ClearBuffer
        Printer.AddBuffer_WriteLine(" ")
        Printer.AddBuffer_WriteLine(RFecha)
        Printer.SendBufferToPrinter
        Printer.ClearBuffer
        Printer.AddBuffer_BarCode(Right("000000"&NumberFormat(FOLIOPEDIDO,0,0),7))
        Printer.SendBufferToPrinter
        Printer.ClearBuffer
        Printer.AddBuffer_WriteLine("NOTA : "&Right("000000"&NumberFormat(FOLIOPEDIDO,0,0),7))
        Printer.AddBuffer_WriteLine("TOTAL  :  $ "&NumberFormat2(ptotal, 0, 2, 2, True))
        Printer.SendBufferToPrinter
        Printer.ClearBuffer
        Printer.AddBuffer_WriteLine(" ")
        Printer.AddBuffer_WriteLine(" ")
        Printer.SendBufferToPrinter
        Printer.ClearBuffer
        Printer.Close
    end if


the problem is that the last two Printer.AddBuffer_WriteLine(" "), doesn´t print space lines (like feed) , I don´t know whats wrong!!!!!
 
Upvote 0

Star-Dust

Expert
Licensed User
Printer.ClearBuffer not necessary, but you could put sleep (200) to allow the printer buffer to receive and execute commands.

B4X:
 If Success Then
        Printer.ClearBuffer
        Printer.AddBuffer_WriteLine(Main.RComercio)
        Printer.AddBuffer_WriteLine(Main.RTienda)
        Printer.AddBuffer_WriteLine(Main.RUbica)
        Printer.SendBufferToPrinter
        Printer.AddBuffer_WriteLine(" ")
        Printer.AddBuffer_WriteLine(RFecha)
        Printer.SendBufferToPrinter
        Printer.AddBuffer_BarCode(Right("000000"&NumberFormat(FOLIOPEDIDO,0,0),7))
        Printer.SendBufferToPrinter
        Sleep(100)
        Printer.AddBuffer_WriteLine("NOTA : "&Right("000000"&NumberFormat(FOLIOPEDIDO,0,0),7))
        Printer.AddBuffer_WriteLine("TOTAL  :  $ "&NumberFormat2(ptotal, 0, 2, 2, True))
        Printer.SendBufferToPrinter
        Sleep(100)
        Printer.AddBuffer_WriteLine(" ")
        Printer.AddBuffer_WriteLine(" ")
        Printer.FlushAndClose
      
    end if

It could be the ClearBuffer that eliminates the print before it is sent, while it is still in the queue
 
Upvote 0

manuelsalazar

Member
Licensed User
Hi :

when I use Printer.FlushAndClose , and I want to print another ticket, the program sends me that CANNOT CONNECT TO BT PRINTER.

Also sometimes with writeline center the text into the line , and sometime to the left of the line.


is there anything I can do about it ????

thanks in advanced ...
 
Upvote 0

Star-Dust

Expert
Licensed User
it is strange, however it uses SendBufferToPrint, Sleep (500) and Close
 
Upvote 0

manuelsalazar

Member
Licensed User
Hi :

How can I use the BluetoothIsDisabled event, for checking the status , because if it`s OFF when the program tries to connect to printer sends error java.io.IOException?

also , is there any field in ESC_POS that change to small font instead of the normal (standard) font ?


thanks in advanced.
 
Upvote 0

Star-Dust

Expert
Licensed User
Hi :

How can I use the BluetoothIsDisabled event, for checking the status , because if it`s OFF when the program tries to connect to printer sends error java.io.IOException?
No, you cannot use to check the status.

This event is raised by checking a BluetoothAdmin type variable. If the BluetoothAdmin.IsEnabled variable has the value true, but the bluetooth is disabled it elevates this event.

But sometimes other exceptions are needed, which generate runtime errors. Make sure you have the necessary permissions to turn on the bluetooth

also , is there any field in ESC_POS that change to small font instead of the normal (standard) font ?


thanks in advanced.
There are many ESC_POS commands, I have included only a few, of which I was sure they were compatible on all models.

But you can add new ones
B4X:
Dim SampleNewCommand as String = Chr (27) & "!" & Chr (8)
 
Upvote 0

cesarcm

Member
Licensed User
Longtime User
Hi,

I was testing your SD BT Printer and it works very well.

I already sent you a donation (EUR25) on June,17th,

Today I got the info that "evaluation is expired". Please, coul you send me the functional library? Thanks a lot!

Regards,
Cesar

1625517801657.png
 
Upvote 0

Star-Dust

Expert
Licensed User
Dear friend,

Thank you for your donation. I would like to specify two aspects that will be useful to you.
  1. You shouldn't be writing on a two year old thread. Open a new thread.
  2. When you donate, as specified in the library thread, you must indicate which library you are donating to, finally you must indicate your Nickname so I can submit the library privately. All this was not done, when I did not know what to send and to whom.
I sent you the complete library in a private message. Replace the demonstration one with the one I sent you.
 
Last edited:
Upvote 0
Top