Spanish Impresión Bluetooth

Manuel Eras Larios

Member
Licensed User
Longtime User
Saludos, NECESITO Ayuda al enviar a imprimir via bluetooth, en ocaciones la impresion sale en desorden, por ejemplo, si quiero imprimir asI
linea 1
linea 2
linea 3
a veces sale
linea 3
linea 2
linea 1
ó
linea 2
linea 1
linea 3
 

Manuel Eras Larios

Member
Licensed User
Longtime User
Tengo una impresora Zebra M7Z320. tablet Samsung Galaxy Tab3, el código es así:
Pero sale en desorden, en ocaciones.

Sub Process_Globals
PrintBuffer AsString
Dim btAdmin AsBluetoothAdmin
Dim cmp20 AsSerial
Dim printer AsTextWriter
End Sub


Sub Globals
Dim Toggla AsToggle
Dim btnImprimir AsButton
End Sub

Sub btnImprimir_Click
Imprimir
End Sub

Sub Imprimir
Toggla.TurnBluetoothOn

btAdmin.Initialize("BlueTooth")
cmp20.Initialize("Printer")

StartPrinter
End Sub


Sub Printer_Connected (Success AsBoolean)
If Success Then
ImprimirDatos
Else
If Msgbox2("", "Error de Impresora ","ReImprimir","Cancelar","",Null) = DialogResponse.POSITIVE Then
StartPrinter
EndIf
EndIf
EndSub

Sub StartPrinter
Dim PairedDevices AsMap
Dim L AsList
Dim Res AsInt

ToastMessageShow("Imprimiendo ...",True)

PairedDevices.Initialize

Try
PairedDevices = cmp20.GetPairedDevices
Catch
Msgbox("Emparejando con la impresora ...","Error de Impresora")
printer.Close
cmp20.Disconnect
EndTry


If PairedDevices.Size = 0Then
Msgbox("Error Conectando con la impresora - No encontrada ...","")
Return
EndIf

If PairedDevices.Size = 1Then
Try
cmp20.ConnectInsecure(btAdmin,PairedDevices.Get(PairedDevices.GetKeyAt(0)),1)
Catch
Msgbox("Conectando ...","Error de Impresora")
printer.Close
cmp20.Disconnect
EndTry

Else

L.Initialize

For i = 0To PairedDevices.Size - 1
L.Add(PairedDevices.GetKeyAt(i))
Next

Res = InputList(L, "Seleccione un Dispositivo", -1)
If Res <> DialogResponse.CANCEL Then

cmp20.Connect(PairedDevices.Get(L.Get(Res)))

EndIf

EndIf

EndSub


Sub ImprimirDatos
printer.Initialize(cmp20.OutputStream)

PrintBuffer = Chr(13) & Chr(10)
printer.Write(PrintBuffer)
printer.Flush

PrintBuffer = Chr(13) & Chr(10)
printer.Write(PrintBuffer)
printer.Flush

PrintBuffer = “line 1” & Chr(13) & Chr(10)
printer.Write(PrintBuffer)
printer.Flush
PrintBuffer = “line 2” & Chr(13) & Chr(10)
printer.Write(PrintBuffer)
printer.Flush
PrintBuffer = “line 3” & Chr(13) & Chr(10)
printer.Write(PrintBuffer)
printer.Flush

printBuffer = ""

Msgbox("Impresión finalizada!","")

printer.Close
cmp20.Disconnect
End Sub
 

benji

Active Member
Licensed User
Longtime User
la unica diferencia que veo, con lo que yo hago, es que yo imprimo con WriteBytes en vez de Write, pero no debería influir
 

Manuel Eras Larios

Member
Licensed User
Longtime User
AYUDA me saje este error al compilar la aplicación.

upload_2015-7-21_23-12-51.png


upload_2015-7-21_23-12-35.png
 
Top