Can't print images to iMZ320 Printer

// Expert user has replied.
K Kieron Brady 3 years 7 months ago
110 4 0

Hi,
 
Bit of a weird one, I'm in the middle of converting a native android app to use xamarin forms instead (so we can support IOS) and I decided to use a dependency service to do all the zebra printing functionality - mainly because I couldn't work out how to create an insecure connection (no pairing) to the Bluetooth printers in Xamarin Forms and whilst I could create an insecure connection outside of LinkOS to the printer and I could print out basic CPCL commands - I had massive issues when it came to printing images.  Anyway that's by-the-by, I'm using the LinkOS plugin and I re-created the code we had in our android app very quickly as it was pretty much all the same - I started testing on an MZ220 printer - everything worked perfectly, I can print out text, lines and images and its an exact replica.
 
However when I came to test on the iMZ320 printer which we also support - when it tries to print out images, nothing prints out at all - everything else prints out just fine, the images are just blank space though.  We typically have two images in our print-outs, a logo and a signature and this is the example code I am using to print the logo image at the top of the print-out (logoImage is the Bitmap and printer is the IZebraPrinter) :
 
  printer.PrintImage(new ZebraImageAndroid(logoImage), pageWidth / 6, 0, (pageWidth / 3) * 2, 175, true);   
 
So running with the same bitmap on both printers results in the MZ220 printing out the image and the iMZ320 not printing out anything.  Everything else comes out just fine on the iMZ320 - it just doesn't print any of the images though (this is not the case in our old native android app which just references the ZSDK jar file - both printers work fine).  Any suggestions on what's going on and anything else I could try ?

Please Register or Login to post a reply

4 Replies

A Abhishek kumar

I'm having an issue printing png image to a zebra ZQ310 printer, its going to be used to print receipts from an android device and a logo is required to be printed at the top of the printout. when printing the image and receipt lots of white images are getting print.

This is my code:
BLuetoothPrintActivity.CONNECTION.open();Bitmap bitmapToPrint = BitmapFactory.decodeResource(context.getResources(), R.drawable.dummylogo);   ZebraPrinter printer = ZebraPrinterFactory.getInstance(BLuetoothPrintActivity.CONNECTION);ZebraImageAndroid zebraImageToPrint = new ZebraImageAndroid(bitmapToPrint);byte[] configLabel = createZplReceipt().getBytes();BLuetoothPrintActivity.CONNECTION.write(configLabel);BLuetoothPrintActivity.CONNECTION.write("! U1 JOURNAL\r\n! U1 SETFF 100 2\r\n".getBytes());printer.printImage(zebraImageToPrint, 0, 0, 100, 100, false);BLuetoothPrintActivity.CONNECTION.close();

private static String createZplReceipt() {
   /*  This routine is provided to you as an example of how to create a variable length label with user specified data.  The basic flow of the example is as follows  Header of the label with some variable data  Body of the label  Loops thru user content and creates small line items of printed material  Footer of the label  As you can see, there are some variables that the user provides in the header, body and footer, and this routine uses that to build up a proper ZPL string for printing.  Using this same concept, you can create one label for your receipt header, one for the body and one for the footer. The body receipt will be duplicated as many items as there are in your variable data  */   String tmpHeader =
   /*  Some basics of ZPL. Find more information here : http://www.zebra.com/content/dam/zebra/manuals/en-us/printer/zplii-pm-v…; ^XA indicates the beginning of a label  ^PW sets the width of the label (in dots)  ^MNN sets the printer in continuous mode (variable length receipts only make sense with variably sized labels)  ^LL sets the length of the label (we calculate this value at the end of the routine)  ^LH sets the reference axis for printing.  You will notice we change this positioning of the 'Y' axis (length) as we build up the label. Once the positioning is changed, all new fields drawn on the label are rendered as if '0' is the new home position  ^FO sets the origin of the field relative to Label Home ^LH  ^A sets font information  ^FD is a field description  ^GB is graphic boxes (or lines)  ^B sets barcode information  ^XZ indicates the end of a label  */   "^XA" +

   "^PON^PW400^MNN^LL%d^LH0,0" + "\r\n" +

   "^FO20,50" + "\r\n" + "^A0,N,50,50" + "\r\n" + "^FDBagScanner^FS" + "\r\n" +

   "^FO20,130" + "\r\n" + "^A0,N,35,35" + "\r\n" + "^FDOFFICIAL RECEIPT^FS" + "\r\n" +

   "^FO20,180" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDDriver ID :^FS" + "\r\n" +

   "^FO225,180" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDAcme Industries^FS" + "\r\n" +

   "^FO20,220" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDDelivery Date:^FS" + "\r\n" +

   "^FO225,220" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FD%s^FS" + "\r\n" +

   "^FO20,273" + "\r\n" + "^A0,N,30,30" + "\r\n" + "^FDItem^FS" + "\r\n" +

   "^FO280,273" + "\r\n" + "^A0,N,25,25" + "\r\n" + "^FDPrice^FS" + "\r\n" +

   "^FO20,300" + "\r\n" + "^GB350,5,5,B,0^FS";  int headerHeight = 325;   String body = String.format("^LH0,%d", headerHeight);  int heightOfOneLine = 40;  float totalPrice = 0;   Map itemsToPrint = createListOfItems();  int i = 0;  for (String productName : itemsToPrint.keySet()) {
  String price = itemsToPrint.get(productName);   String lineItem = "^FO20,%d" + "\r\n" + "^A0,N,28,28" + "\r\n" + "^FD%s^FS" + "\r\n" + "^FO280,%d" + "\r\n" + "^A0,N,28,28" + "\r\n" + "^FD$%s^FS";   totalPrice += Float.parseFloat(price);  int totalHeight = i++ * heightOfOneLine;   body += String.format(lineItem, totalHeight, productName, totalHeight, price);   }

   long totalBodyHeight = (itemsToPrint.size() + 1) * heightOfOneLine;  long footerStartPosition = headerHeight + totalBodyHeight;   String footer = String.format("^LH0,%d" + "\r\n" +

   "^FO20,1" + "\r\n" + "^GB350,5,5,B,0^FS" + "\r\n" +

   "^FO20,15" + "\r\n" + "^A0,N,40,40" + "\r\n" + "^FDTotal^FS" + "\r\n" +

   "^FO175,15" + "\r\n" + "^A0,N,40,40" + "\r\n" + "^FD$%.2f^FS" + "\r\n" +

   "^FO20,130" + "\r\n" + "^A0,N,45,45" + "\r\n" + "^FDPlease Sign Below^FS" + "\r\n" +

   "^FO20,190" + "\r\n" + "^GB350,200,2,B^FS" + "\r\n" +

   "^FO20,400" + "\r\n" + "^GB350,5,5,B,0^FS" + "\r\n" +

   "^FO20,420" + "\r\n" + "^A0,N,30,30" + "\r\n" + "^FDThanks for choosing us!^FS" + "\r\n" +

   "^FO20,470" + "\r\n" + "^B3N,N,45,Y,N" + "\r\n" + "^FD0123456^FS" + "\r\n" + "^XZ", footerStartPosition, totalPrice);  long footerHeight = 600;  long labelLength = headerHeight + totalBodyHeight + footerHeight;   Date date = new Date();   SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");   String dateString = sdf.format(date);   String header = String.format(tmpHeader, labelLength, dateString);   String wholeZplLabel = String.format("%s%s%s", header, body, footer);  return wholeZplLabel;}

private static Map createListOfItems() {
  String[] names = { "Microwave Oven", "Sneakers (Size 7)", "XL T-Shirt", "Socks (3-pack)", "Blender", "DVD Movie" };   String[] prices = { "79.99", "69.99", "39.99", "12.99", "34.99", "16.99" };   Map retVal = new HashMap();  for (int ix = 0; ix < names.length; ix++) {
  retVal.put(names[ix], prices[ix]);   }
   return retVal;}

M Manuel Caicedo-Rivera

Hi Kieron,

Yes, please, send me the information to this email : ISV_NALA_Support@zebra.com.

I will follow up with you internally.

MC

M Manuel Caicedo-Rivera

Hi Kieron,

MZ Series is a discontinued printer, so it does not have support for MFI.

iMZ is the replacement printer for MZ series, so the issues that you are experiencing are very weird, please, could you send me an email with the source code to analyze the information in detail to this email: ISV_NALA_Support@zebra.com.

We provide more dedicated support to our ISV partners to complete the development, I would invite you to complete your ISV registration on the link below. The registration is a free fee process.

Become a Partner

Thanks,

MC,

M Manuel Caicedo-Rivera

Hi Kieron,

Theoretically, both printers should print fine, but if that is not happening, it is possible that the IMZ320 has a configuration issue.

Please, could you share the code that you are sending to the printers, and the "allcv" report of each printer to compare configurations.

If you are not familiar with "allcv" report please, follow the link below to learn how to get this report from the printer.

Zebra Technologies - Using the SGD Allcv Command to return the Super Host Status

Thanks,

MC

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