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

B Bryan Sanchez 3 years 7 months ago
497 1 0

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);
 
 

Please Register or Login to post a reply

1 Replies

E Efkan YILMAZ

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. 

CONTACT
Can’t find what you’re looking for?