Image printing on Datamax printer with C#

Asked

Viewed 428 times

0

Good morning!

I have a label printing system on the Datamax printer that is made in C#. I need to generate the impression of an image (logo) on the label and was following the steps described in this forum :

https://social.msdn.microsoft.com/Forums/pt-BR/50e46bce-24a3-43eb-97a4-c65da7df39be/datamax-dpl-imprimir-imagem?forum=504

But I couldn’t make any progress. Apparently the process that needs to be done is to convert the image (.bmp) to bytes, and then to string and then send that string to print via DPL (Datamax language) commands, only at the moment I send it to print, appears on the screen that the document was sent to the printer but does not print anything. Can someone help me?

The code I’m using is this:

////Impressão logotipo

            FileStream fileImagem = new FileStream("img\\LOGO_DNV.bmp", FileMode.Open, FileAccess.Read);
            StreamReader imagemTexto = new StreamReader(fileImagem, Encoding.ASCII);
            string imagemString = imagemTexto.ReadToEnd().ToString();
            imagemTexto.Close();
            fileImagem.Close();
            String nomeArquivo = "LOGO_DNV.txt";
            StreamWriter arquivo = new StreamWriter(nomeArquivo, false, Encoding.ASCII);
            arquivo.WriteLine(imagemString);

            sb.AppendLine(soh + "D"); //Desabilita comandos imediatos
            sb.AppendLine(stx + "ICBLOGO: " + cr);
            sb.AppendLine(imagemString + cr);

            sb.AppendLine("1Y4300001500020Logo" + cr);


            qtdEtiqueta = "0001";
            sb.AppendLine("Q" + qtdEtiqueta + cr);//quantidade de etiquetas impressas
            sb.AppendLine("E" + cr);//termina a formatação da etiqueta e imprime

Thanks in advance for your attention.

  • Welcome to SOPT. Would like to [Edit] your post and add the code you are using, so we can analyze and suggest a change. Thank you

  • 1

    Thank you, David! Post edited and added the code I’m using.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.