Android Question Bluetooth printer

Jausa

Member
Licensed User
Longtime User
Dear members,

I ask for your cooperation, I am doing a job where I require print an invoice on the site using a portable printer via bluetooth and let me know if anyone is aware of a bookstore where I can do this. Besides what is the best brand of this type of printer.

Sorry because my english is bad and I had to use google translator.

regards
 

jahswant

Well-Known Member
Licensed User
Longtime User
I ask for your cooperation, I am doing a job where I require print an invoice on the site using a portable printer via bluetooth and let me know if anyone is aware of a bookstore where I can do this. Besides what is the best brand of this type of printer.
Me i use cheap chineese printer warranty one year.
AliExpress
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
I've tested and use a cheap $50 58mm mini wireless Chinese bluetooth printer, I print directly using the serial library and also the RandomAccessFile library.
 
Upvote 0

Jausa

Member
Licensed User
Longtime User
Sorry for the inconvenience, but have an example or guide to start, I'm new to these issues.
 
Upvote 0

edgar_ortiz

Active Member
Licensed User
Longtime User
Hi,

It is recommended that you use a printer that supports "ESC/POS" commands.

Thanks To DonManfred, You can check:

https://www.google.de/?gws_rd=ssl#q=esc/pos+standard+command


And You need:
  • a Serial Object
  • Connect the printer
  • Write data to the printer

Serial Object:


B4X:
Dim o_Serial                     As Serial        ' Objeto que contiene la comunicacion con los dispositivos
Dim o_Printer                    As TextWriter    ' Objeto que contiene la informacion a imprimir
Dim o_Printer_Conected      As Boolean        ' Indica si la impresora está conectada


Connect the printer


B4X:
Sub cibutConectar_Click
    Dim PairedDevices        As Map
    '
    PairedDevices = Main.o_Serial.GetPairedDevices
    Dim l As List
    l.Initialize
    For i = 0 To PairedDevices.Size - 1
        lcPrinterName    = PairedDevices.GetKeyAt(i)
        l.Add(lcPrinterName)
    Next
    '
    Dim res As Int
    res = InputList(l, "Seleccione la Impresora", -1) 'show list with paired devices
    If res <> DialogResponse.CANCEL Then
        lcPrinterAddress    = PairedDevices.Get(l.Get(res))
        lcPrinterName        = l.Get(res)
        Msgbox("Conectarse a: " & l.Get(res), lcPrinterAddress)
        Main.o_Serial.Connect(lcPrinterAddress) 'convert the name to mac address
    End If

End Sub

Write data to the printer
B4X:
    '
    ' NOTE: Main.ParPrinterDD and Main.ParPrinterDH contains the ESC/POS values.
    '
    Main.o_Printer.WriteLine(" ")
    Main.o_Printer.WriteLine(Main.ParPrinterDD & "TOTAL GENERAL")
    Main.o_Printer.WriteLine(Main.ParPrinterDH & "--------------------------")
    Main.o_Printer.WriteLine(Main.ParPrinterDH & "Registros: " & NumberFormat2(TotalNumRegistros,1,0,0,True))
    '
    Main.o_Printer.WriteLine(Main.ParPrinterDH & "--------------------------")
    Main.o_Printer.WriteLine(" ")
    Main.o_Printer.WriteLine(" ")
    Main.o_Printer.WriteLine(" ")
    Main.o_Printer.Flush


Regards,

Edgar
 
Upvote 0
Top