How to prevent an iMZ320 print whitespaces before and after print an image?

Hi!. i am be able to print an image but i have huge whitespaces before and after printing the image, i am using Xamarin.Android in a iMZ 320, how can i prevent the printer to send this whitespaces? Heeeeeeeeellllpppp D:

Samantha Corn
Hi Bryan,Could you send the

Hi Bryan,

Could you send the code you're using for printing the image? Are you setting the length of the label?

If you are only printing the image, try sending this command to the printer through Zebra Setup Utilities or in your app to lessen the label length:

! U1 setvar "zpl.label_length" "value"

where value is a number between 1 and 32,000 (in dots). More information on this command can be found in the ZPL Programming Guide on page 938. An alternative ZPL command can be found on page 261

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bryan Sanchez
Hi Samantha i am using this


Hi Samantha i am using this code. No i dont set the lenght of the label. I am printing just an image nothing else.

One question Samantha the label length is the amount of paper printed?

Can i set a kind of auto length just to use an amount of paper that i need?

Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.qr);

ZebraPrinter printer = ZebraPrinterFactory.getInstance(PrinterLanguage.ZPL, printerConnection);

String setLanguage = "\r\n! U1 setvar \"device.languages\" \"zpl\"\r\n";

String zpl  = "^XA^FO0,0^XGR:IMAGE.GRF^XZ";

printerConnection.write (setLanguage.getBytes());
printer.storeImage("R:IMAGE.GRF", ZebraImageFactory.getImage(bitmap), 300, 300);

printerConnection.write (zpl.getBytes());

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bryan Sanchez
Ok i use your command and

Ok i use your command and work fine, just a problem the printer print a whitespace at the top of the label, a kind of default top margin, i dont know how to disable that margin . Here is the code i use.

     var view = this.Window.DecorView;

     view.DrawingCacheEnabled = true;

     Bitmap bitmap = view.GetDrawingCache(true);

     Bitmap resizeBitMap = Bitmap.CreateScaledBitmap(bitmap, 896, 672, true);

     // ZPL Commands

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

     string printerCommand = "^XA^FO0,0^XGR:IMAGE.GRF^XZ";

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

     // 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", resizeBitMap, 580, 1000);

     // Print image stored with ZPL Command

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

     // Response of printer

     string response1string = Encoding.ASCII.GetString(responseSetLenguage);

     string response2string = Encoding.ASCII.GetString(responsePrinterCommand);

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Samantha Corn
Hi Bryan, I'm glad you can

Hi Bryan,

I'm glad you can now control the size of the label. Are you using continuous or non-continuous media? It could be a calibration issue with the printer. Could you please send me an allcv report of the printer you're using? Here's a walkthrough if you've never retrieved one before.

If it's not the settings of the printer, you can try shifting the top of the label with the ^LT ZPL command, found on page 264 of the ZPL Programming Manual. However, be aware that if it is an issue with your test printer's settings, this will goof up printing on any other printers.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments