Using ^XG to print a Graphic print the graphic and a whitespace of the same length

Hi, i have a iMZ320 printer and i am trying to print a graphic with a barcode, i manage to print both fine, but i am having a white space of the same size of the label format even when i configure the label size to a specific length. No matter what length of the label i configure i always have a white space of the same length. Why i am having such white space?

 

This is the code i am using:

 

     // ZPL Commands, configure as zpl language

     string setLanguageCommand = "\r\n! U1 setvar \"device.languages\" \"zpl\"\r\n";

 

     // Configure label length

     string labelLenghtCommand = "\r\n! U1 setvar \"zpl.label_length\" \"1790\"\r\n";

 

     // Print the label and the barcode

     string printerCommand = @"^XA^FO0,0^XGR:IMAGE.GRF^FS^FO80,1625^BY3^BCN,120,Y,N,N^FDCode123^FS^XZ";

 

     // Send command to printer to configure it

     byte[] responseSetLenguage = printer.Connection.SendAndWaitForResponse(Encoding.ASCII.GetBytes(setLanguageCommand), 500, 500);

     byte[] responseLabelLenghtCommand = printer.Connection.SendAndWaitForResponse(Encoding.ASCII.GetBytes(labelLenghtCommand), 500, 500);

 

     // Store image to print

     printer.StoreImage("R:IMAGE.GRF", resizedBitmap, 580, 1600);

 

     // Print image stored with ZPL Command

     byte[] responsePrinterCommand = printer.Connection.SendAndWaitForResponse(Encoding.ASCII.GetBytes(printerCommand), 500, 500);

 

 

Archivo 8-13-17 8 52 33 PM.jpeg

Anonymous (not verified)
Hi Bryan,I tried your code

Hi Bryan,

I tried your code and did not have the same issue.  Is the white space printing before or after your label?  Are you communicating with the printer at any other time in your code? There are several commands that may make your printer think you want to print a blank label. 

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bryan Sanchez
The whitespace is printing

The whitespace is printing after the label, the next code is doing this:

discoveredPrinter.Connection.Close();

                        if (connection != null)

                        {

                            connection.Close();

                        }

                        if (printer != null)

                        {

                            printer.Connection.Close();

                        }

                        if (thePrinterConn != null)

                        {

                            thePrinterConn.Close();

                            thePrinterConn.Dispose();

                        }

Maybe close connection make the label print a whitespace or i have to send some special command to my printer to configure correctly?

Can you share the code you tried and work fine? I attach to you the entire method that do the print task.

i just search some printer with BluetoothDiscovery and if i found one i call that method Heeeelp

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Bryan, I'll try your file

Hi Bryan, I'll try your file when I get back in tomorrow.  For now attached is the code I tested.  It's based on the I posted a while ago.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bryan Sanchez
Really thanks Robin i will

Really thanks Robin i will waiting for your response and try with your code DDDD.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Bryan, I took your code

Hi Bryan, I took your code for the most part and did not see the issue come up.  You are doing some interesting things with the connection initially that may be causing the system to think it needs to have multiple connections open.  This 'may' be the problem.  I have this cleaned up more in my code.  See attached file.  Let me know if this is helpful.

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bryan Sanchez
Hi Robin, it doesn´t work i

Hi Robin, it doesn´t work i tried your code, i clean up my code, even i tried the zebra utilities for a test demo image but i have the same problem. I think is a misconfiguration in my printer. What can i do?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bryan Sanchez
Okey robin, i solved the

Okey robin, i solved the issue doing a hard reset in the printer with this command that i found here:

Restoring Factory default settings with Mobile Printers

//string reset = @"^XA^JUF^XZ^XA^JUN^XZ^XA^JUS^XZ"

I send this command one time and it worked like a charm

But i still curious what variable or configuration caused the problem?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
The ^JUN does a factory reset

The ^JUN does a factory reset so I'm not sure.  My guess is some internal settings having to do with label length were off.  Not sure though.  Glad you got it fixed!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments