Android Example Downloading and Printing 1 Bit BMP to ESC/POS Printer

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.

    Dim imagem As Bitmap, x As Int, y As Int
    imagem = LoadBitmap(File.DirAssets, "testebmp3.bmp")

    Dim out As OutputStream
    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
    Astream.Write(Array As Byte(0x1D, 0x2A, 0, 0))       
    Astream.Write(Array As Byte(0x1D, Asc("/"), 0))
End Sub


    337.2 KB · Views: 1,352


Well-Known Member
Licensed User
Longtime User
If you have to print a logo everytime the same, i made it in such way with windows: Prepare your printer driver to use a file, print your logo and you have the file, which you can later send to the printer. Maybe it can be that you have to remove some commands at the end of the print job like cutting or transport commands.


Licensed User
Longtime User
This print doesn´t have driver, it´s bluetooth direct. It use resident imagens, you send 1 time to the printer and prints anytime you want.


Licensed User
Longtime User
When I try to print an image I get the following error:
Illegal division by zero at /Zebra/APL/APL-E.NRD line 5135, <SYSIN> line 16.

Any idea what it could be?

my printer is a Zebra iMZ320