Sí, voy a preparar una pequeña demo y la subo, porque es extraño, cuando envío a imprimir se activa la impresora si está "dormida", o sea, que la impresora detecta que se han conectado y se ha enviado algo.
Gracias, f0raster0, ahora sí que estoy perdido
A ver si consigo otra impresora y pruebo, porque esta no me da ningún error al conectar. Aunque luego no imprime.
Perfecto, es que en el ejemplo no he puesto ningún código de barras para probar, solamente texto.
Pues entonces va a ser algún problema de esta impresora.
Aunque ahora que lo pienso, el programa demo (.apk) que trae sí que imprime también.
No encuentro lógica alguna
Hello fellows, I'm a Zebra Partner, and I want to know hoy to send ZPL printing language through B4A. I usually send this with Windows Mobile using vb.net (compact framework) making an Open COM1 device subrouting, sending ZPL language by Bluetooth. How can I do it with B4A? I'll appreciate...
estimado su impresora imprime los comandos CPCL en bytes.
si usted envía a imprimir texto eso imprime y desea dar formato como tipo de letras, margenes, code de barras, debe utilizar comandos CPCL.
vea este ejemplo:
Hello fellows, I'm a Zebra Partner, and I want to know hoy to send ZPL printing language through B4A. I usually send this with Windows Mobile using vb.net (compact framework) making an Open COM1 device subrouting, sending ZPL language by Bluetooth. How can I do it with B4A? I'll appreciate...
Hola, oparra, pero el demo que he puesto es cpcl, según tus indicaciones en la ayuda que me has dado. A "f0raster0" le funciona y a mí no.
Seguramente no he entendido lo que has dicho.
Pruebo también tu enlace y comento...
Si vi lo que post "f0raster0" es una clase para impresora de comandos ESC.
puedes usarla si tu impresora emula ESC, pero los manuales que has publicado solo emula CPCL.
puedes usar esa clase el método WriteString que convierte texto a bytes y envía a la impresora.
B4X:
' Send the contents of an array of bytes to the printer
' Remember that if the printer is expecting text the bytes will be printed as characters in the current code page
Public Sub WriteBytes(data() As Byte)
If Connected Then
Astream.Write(data)
End If
End Sub
' Send the string to the printer in IBM437 encoding which is the original PC DOS codepage
' This is usually the default codepage for a printer and is CodePage = 0
' Beware of using WriteString with Chr() to send numeric values as they may be affected by Unicode to codepage translations
' Most character level operations are pre-defined as UPPERCASE string variables for easy concatenation with other string data
Public Sub WriteString(data As String)
WriteString2(data, "IBM437")
End Sub
' Send the string to the printer in the specified encoding
' You also need to set the printer to a matching encoding using the CodePage property
' Beware of using WriteString2 with Chr() to send numeric values as they may be affected by codepage substitutions
' Most character level operations are pre-defined as UPPERCASE string variables for easy concatenatipon with other string data
Public Sub WriteString2(data As String, encoding As String)
Try
If Connected Then
Astream.Write(data.GetBytes(encoding))
End If
Catch
Log("Printer error : " & LastException.Message)
AStream_Error
End Try
End Sub
For the last couple of weeks I have been playing with an 80mm Bluetooth ESC/POS thermal printer I bought off eBay, new and delivered, for the ludicrously cheap price of £20. While the print quality, particularly of images with large areas of black (they are gray due to power supply or thermal...
Vale, he probado la demo de f0raster0 y muestra texto, pero no los códigos de barras.
Oparra, entonces el ejemplo/demo que he puesto yo debería de funcionar porque usa CPCL, ¿no?, y ese es el problema, que no me funciona.
Usar método WriteString2 de clase Bluetooth ESC/POS Printer Class
B4X:
' Send the string to the printer in the specified encoding
' You also need to set the printer to a matching encoding using the CodePage property
' Beware of using WriteString2 with Chr() to send numeric values as they may be affected by codepage substitutions
' Most character level operations are pre-defined as UPPERCASE string variables for easy concatenatipon with other string data
Public Sub WriteString2(data As String, encoding As String)
Try
If Connected Then
Astream.Write(data.GetBytes(encoding))
End If
Catch
Log("Printer error : " & LastException.Message)
AStream_Error
End Try
End Sub