Android Question How to print a file? Bluetooth

electronicajaf

Member
Licensed User
Longtime User
Try all forms that appear in the forum and I can not make an impression out. The bluetooth printer connects perfectly, and does not jump me no error in the app, but nothing comes out.

B4X:
Sub Process_Globals
    Dim Serial As Serial
    Dim printer As TextWriter
    Dim Mac As String = "00:01:90:D6:61:CC"
    Dim TxtPrueba As String = "Texto de prueba"
End Sub

Sub Globals
    Dim Imprimir As Button
    Dim btAdmin As BluetoothAdmin
    Dim btnConectar As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Impresora")
        If FirstTime Then
        btAdmin.Initialize("BlueTeeth")
    End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub BtnConectar_Click

Serial.Initialize (Serial)
If Serial.IsEnabled Then
ToastMessageShow("Serial inicializado", False)
Serial.Connect(Mac)
ToastMessageShow("Conectado a la impresora",False)
End If

End Sub
Sub Imprimir_Click
        Serial.Initialize("Printer")
        printer.Initialize(Serial.OutputStream)
        Msgbox(Serial.OutputStream , "")

        printer.WriteLine (TxtPrueba)
        printer.WriteLine("segunda linea")
        printer.Flush
        printer.Write("Soreta")
        printer.Flush
        Msgbox("Impresion desconectada","")
        printer.Close
       
End Sub
 
Last edited:

DARDENNE Marc Soveto

New Member
Licensed User
Longtime User
Try all forms that appear in the forum and I can not make an impression out. The bluetooth printer connects perfectly, and does not jump me no error in the app, but nothing comes out.

B4X:
Sub Process_Globals
    Dim Serial As Serial
    Dim printer As TextWriter
    Dim Mac As String = "00:01:90:D6:61:CC"
    Dim TxtPrueba As String = "Texto de prueba"
End Sub

Sub Globals
    Dim Imprimir As Button
    Dim btAdmin As BluetoothAdmin
    Dim btnConectar As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Impresora")
        If FirstTime Then
        btAdmin.Initialize("BlueTeeth")
    End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub BtnConectar_Click

Serial.Initialize (Serial)
If Serial.IsEnabled Then
ToastMessageShow("Serial inicializado", False)
Serial.Connect(Mac)
ToastMessageShow("Conectado a la impresora",False)
End If

End Sub
Sub Imprimir_Click
        Serial.Initialize("Printer")
        printer.Initialize(Serial.OutputStream)
        Msgbox(Serial.OutputStream , "")

        printer.WriteLine (TxtPrueba)
        printer.WriteLine("segunda linea")
        printer.Flush
        printer.Write("Soreta")
        printer.Flush
        Msgbox("Impresion desconectada","")
        printer.Close
      
End Sub

Have you found a printer that works with that code?
I would be interested to Know.
Have you tryed with MTP112 Mobile thermal Printer (look at the web site)
Web: http://www.mbp-ltd.com
 
Upvote 0

jatko

Member
Licensed User
Longtime User
Do You have any idea, how to send control codes to the printer useing that code?
 
Upvote 0
Top