Using the feature of resident images of Datecs dpp250. This is the way I found with Erel help to convert a 1 Bit BMP to ESC format, download to the printer, clean printer memory, write printer memory and print.
It´s quite slow to convert, but you can save a file with the ESC format, and dont need convert anymore.
If you have a better or faster way to do this, please change the code and share.
It´s quite slow to convert, but you can save a file with the ESC format, and dont need convert anymore.
If you have a better or faster way to do this, please change the code and share.
B4X:
Dim imagem As Bitmap, x As Int, y As Int
imagem = LoadBitmap(File.DirAssets, "testebmp3.bmp")
Dim out As OutputStream
out.InitializeToBytesArray(0)
out.WriteBytes(Array As Byte(0x1D),0,1) 'GS
out.WriteBytes(Array As Byte(0x2A),0,1) '*
out.WriteBytes(Array As Byte(imagem.Width/8),0,1)
out.WriteBytes(Array As Byte(imagem.Height),0,1)
Dim bits As String
Dim p() As Int
p = getPixels(imagem, 0, imagem.Width, 0, 0, imagem.Width, imagem.Height)
For x = 0 To p.Length-1
If p(x) = -1 Then bits = bits & "0" Else bits = bits & "1"
If bits.Length = 8 Then
out.WriteBytes(Array As Byte(RetBytePOS(bits)),0,1)
bits = ""
End If
Next
Astream.Write(Array As Byte(0x1D, 0x2A, 0, 0))
Astream.Write(out.ToBytesArray)
Astream.Write(Array As Byte(0x1D, Asc("/"), 0))
End Sub