B4A Library SD_BT_PRINTER

Ho un PDA con una stampante su cui sto facendo alcuni studi, dal momento che la stampante sarà solo la mia, vorrei impostarlo come predefinito e stampare del testo e un codice a barre (etichette) è possibile? So che è possibile, ma non posso farlo sulla base dell'esempio. Grazie
 

lelelor

Member
Licensed User
I have a PDA with a printer on which I am doing some studies, since the printer will only be my own, I would like to set it as default and print some text and a barcode (labels) is it possible? i know it's possible but i can't do it based on example. Thanks
 

Star-Dust

Expert
Licensed User
Longtime User
You should write in the question section or in the BT_PRINTER library thread.

You can skip the search using the Printer.SelectFromMac (Mac) command.
Where Mac is your printer's MacAddres value. It will connect you directly to your Printer if it is on and available
 

lelelor

Member
Licensed User
in Activity_Create (is this correct?) I put Printer.SelectFromMac (001122334455), in this printer, being internal, you can set the MAC you want, sometimes it works and many don't, I would basically like to select and activate the "Ready to Print" ".
 

Star-Dust

Expert
Licensed User
Longtime User
in Activity_Create (is this correct?) I put Printer.SelectFromMac (001122334455), in this printer, being internal, you can set the MAC you want, sometimes it works and many don't, I would basically like to select and activate the "Ready to Print" ".

You can set it both in Activity and in other modules. Provided the BT_Printer class is declared within the same module.

Make sure the MaccAddr is correct, the format is as follows: 02:2D:77:1E:3F:9C
B4X:
Printer.Initialize(Me,"Printer","UTF8")
sleep(500)
Printer.SelectFromMac("02:2D:77:1E:3F:9C")
This always works, if the printer is ready and has free Bluetooth (SPP) connection and can accept connections.
If they are not accepted, the printer is not ready at that moment. You have to reset it.
 
Last edited:

lelelor

Member
Licensed User
Ciao, ho messo quell'istruzione nell'esempio originale e viene stampata all'avvio dell'app, se metto le stesse linee sotto un pulsante non funziona, quindi il debug mi dice che si sta connettendo al MAC ma poi chiude la trasmissione. la stampante è integrata e sempre disponibile. Grazie
 

Attachments

  • stampa su iper.PNG
    stampa su iper.PNG
    55.7 KB · Views: 186

Star-Dust

Expert
Licensed User
Longtime User
Ciao, ho messo quell'istruzione nell'esempio originale e viene stampata all'avvio dell'app, se metto le stesse linee sotto un pulsante non funziona, quindi il debug mi dice che si sta connettendo al MAC ma poi chiude la trasmissione. la stampante è integrata e sempre disponibile. Grazie
Qui devi scrivere in inglese.
Here you have to write in English.

Attach the code you are using so I can see if you make any mistakes.
A small print of one sentence only
 

lelelor

Member
Licensed User
Hello, I put that instruction in the original example and it prints when the app starts, if I place the same lines under a button it doesn't work, so debug tells me that it is connecting to the MAC but then closes the transmission. the printer is integrated and always available. Thanks
B4X:
Printer.Initialize(Me,"Printer",Encoding.Windows1252)
    
    Sleep(1000)
    Printer.SelectFromMac("00:11:22:33:44:55")
    Printer.ClearBuffer
    Printer.AddBuffer_Writeline(ESC_POS.BoldOn & "Ciao " & ESC_POS.DoubleOff)
    Printer.AddBuffer_Writeline("Come stai?")
    Printer.AddBuffer_Writeline("Bene grazie")
    Printer.AddBuffer_Writeline("012345678901234567890123456789")
    Printer.AddBuffer_Writeline("")
    Printer.AddBuffer_Writeline("")
    
    Sleep(500)
    Printer.flushAllAndClose
 

Star-Dust

Expert
Licensed User
Longtime User
Hello, I put that instruction in the original example and it prints when the app starts, if I place the same lines under a button it doesn't work, so debug tells me that it is connecting to the MAC but then closes the transmission. the printer is integrated and always available. Thanks
B4X:
Printer.Initialize(Me,"Printer",Encoding.Windows1252)
   
    Sleep(1000)
    Printer.SelectFromMac("00:11:22:33:44:55")
    Printer.ClearBuffer
    Printer.AddBuffer_Writeline(ESC_POS.BoldOn & "Ciao " & ESC_POS.DoubleOff)
    Printer.AddBuffer_Writeline("Come stai?")
    Printer.AddBuffer_Writeline("Bene grazie")
    Printer.AddBuffer_Writeline("012345678901234567890123456789")
    Printer.AddBuffer_Writeline("")
    Printer.AddBuffer_Writeline("")
   
    Sleep(500)
    Printer.flushAllAndClose
I was asking you to insert me an example of the code that doesn't work. Then I buy it in zip format so I try it on my bluetooth printer
 
Top