16 Replies Latest reply on May 5, 2017 7:03 AM by Kieron Brady

    Can't print images to iMZ320 Printer

    Kieron Brady

      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 ?

        • Re: Can't print images to iMZ320 Printer
          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

            • Re: Can't print images to iMZ320 Printer
              Kieron Brady

              Hi Manuel,

               

              Thanks for your reply, I've been away for a while so only just catching up with things and I still cant seem to get the iMZ320 to work.  I've cut our code down to as much as possible to print a simple image - I've tested this code and it prints out the logo on the MZ220 but not the iMZ320.  Could it be a problem with the LinkOS package?    I've attached the "allcv" report of the iMZ320 at the bottom.

               

                public class ZebraPrinterService : IZebraPrinterService
                {
                  private BluetoothConnection printerConnection;
                  private IZebraPrinter printer;
                  private int sectionCurrentHeight;
                  private string sectionText;
                  private int pageWidth;
                  private IZebraPrinterLinkOs linkOsPrinter;

                  public void Print(string macAddress, string logoPath, bool useTwoInch, out string errorMessage)
                  {
                    Bitmap logoImage = null;
                    int printHeight = 500;
                    errorMessage = "";
                    pageWidth = useTwoInch ? 400 : 600;

                    try
                    {
                      if (!SxUtils.IsNullOrEmpty(logoPath) && new File(logoPath).Exists())
                        logoImage = BitmapFactory.DecodeFile(logoPath);

                      string printerConnectionError = openPrinterConnection(macAddress);

                      if (!SxUtils.IsNullOrEmpty(printerConnectionError))
                      {
                        errorMessage = printerConnectionError;
                        return;
                      }

                      // Initialise the print - this needs to be done at the start of all prints
                      printer.SendCommand("! UTILITIES\r\n" + "JOURNAL\r\n" + "SETFF 0 0\r\n" + "PRINT\r\n");
                      printer.SendCommand("! 0 200 200 500 1\r\n" + "PW " + pageWidth.ToString() + " 1\r\n");

                      //Logo section
                      if (logoImage != null)
                      {
                        logoImage = getResizedBitmap(logoImage, 175, (pageWidth / 3) * 2);
                        printer.PrintImage(new ZebraImageAndroid(logoImage), pageWidth / 6, 0, (pageWidth / 3) * 2, 175, true);
                      }

                      printer.SendCommand("FORM\r\n" + "PRINT\r\n");
                      Thread.Sleep(500);
                    }
                    catch (Exception e)
                    {
                      errorMessage = e.Message;
                    }
                    finally
                    {
                      if (printerConnection != null)
                      {
                        try
                        {
                          printerConnection.Close();
                        }
                        catch { }
                      }
                    }
                  }

                  #region Printer Setup / Utils

                  private string openPrinterConnection(string macAddress)
                  {
                    // Check we have macAddress
                    if (SxUtils.IsNullOrEmpty(macAddress))
                      return "Please use the Settings page to set up the bluetooth device to print to first.";

                    // Instantiate insecure connection for given Bluetooth MAC SxAddress.
                    printerConnection = new BluetoothConnectionInsecure(macAddress);
                    try
                    {
                      string connectionErrorMessage = isPrinterReady();

                      // if printer is ready to print
                      if (SxUtils.IsNullOrEmpty(connectionErrorMessage))
                      {
                        printerConnection.Open();
                        printer = ZebraPrinterFactory.GetInstance(printerConnection);
                        return null;
                      }
                      else
                        return connectionErrorMessage;
                    }
                    catch (ConnectionException e)
                    {
                      return e.Message;
                    }
                    catch (ZebraPrinterLanguageUnknownException e)
                    {
                      return e.Message;
                    }
                  }

                  private string isPrinterReady()
                  {
                    string ErrMessage = "";
                    try
                    {
                      printerConnection.Open();
                      printer = ZebraPrinterFactory.GetInstance(printerConnection);
                      Thread.Sleep(500);

                      linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(printer);
                      PrinterStatus printerStatus = (linkOsPrinter != null) ? linkOsPrinter.CurrentStatus : printer.CurrentStatus;

                      if (printerStatus.IsReadyToPrint)
                        ErrMessage = "";
                      else if (printerStatus.IsPaused)
                        return "Cannot print because the printer is paused.";
                      else if (printerStatus.IsHeadOpen)
                        return "Cannot print because the printer media door is open.";
                      else if (printerStatus.IsPaperOut)
                        return "Cannot print because the printer has run out of paper.";
                      else
                        return "Cannot print because of an unknown error.";
                    }
                    catch (ConnectionException e)
                    {
                      return "Could not establish connection to printer \n Please check your settings and ensure" +
                              " that the printer is switched on.";
                    }
                    catch (ZebraPrinterLanguageUnknownException e)
                    {
                      return "Cannot print because of an unknown error.";
                    }
                    return ErrMessage;
                  }

                  private Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth)
                  {
                    int width = bm.Width;
                    int height = bm.Height;
                    float scaleWidth = ((float)newWidth) / width;
                    float scaleHeight = ((float)newHeight) / height;
                    // CREATE A MATRIX FOR THE MANIPULATION
                    Matrix matrix = new Matrix();
                    // RESIZE THE BITMAP
                    matrix.PostScale(scaleWidth, scaleHeight);

                    // "RECREATE" THE NEW BITMAP
                    Bitmap resizedBitmap = Bitmap.CreateBitmap(bm, 0, 0, width, height, matrix, false);
                    return resizedBitmap;
                  }
                }

               

               

              allcv report :

              print.

              print.contrast : 0 , Choices: 0-3

              print.tone : 0 , Choices: -100..200

              print.tone_format : cpcl , Choices: cpcl,zpl

              print.tone_zpl : 10.0 , Choices: 0.0-30.0

              print.print_adj : 0 , Choices: -127-128

              print.troubleshooting_label_choices :

              print.troubleshooting_label_print

              mcr.

              rtc.

              rtc.time : 00:08:19

              rtc.date : 10-07-2016

              rtc.timezone : UTC00

              rtc.exists : no

              usb.

              usb.device.

              usb.device.vendor_id : 0x0A5F

              usb.device.product_id : 0x00F3

              usb.device.device_version : 1.1

              usb.device.product_string : ZTC iMZ320-203dpi CPCL

              usb.device.manufacturer_string : Zebra Technologies

              usb.device.serial_string : iMZ320

              usb.device.device_id_string : MANUFACTURER:Zebra Technologies ;COMMAND SET:CPCL;MODEL:ZTC iMZ320;CLASS:PRINTER;OPTIONS:XML;

              usb.device.device_unique_id : off , Choices: on,off

              usb.connected : yes

              usb.halt : no , Choices: yes,no

              log.

              log.reboot.

              log.reboot.code : 11

              log.reboot.reason : Off key

              log.reboot.codes : bbbbbb8bbbbb000bbbbbb4b444bbbbbb

              log.reboot.report : Off key

              Off key

              Off key

              Off key

              Off key

              Off key

              New OS reprogramming

              Off key

              Off key

              Off key

              Off key

              Off key

              Other

              Other

              Other

              Off key

              Off key

              Off key

              Off key

              Off key

              Off key

              Low battery timeout

              Off key

              Low battery timeout

              Low battery timeout

              Low battery timeout

              Off key

              Off key

              Off key

              Off key

              Off key

              Off key

               

              netmanage.

              netmanage.type : none , Choices: none,avalanche

              netmanage.status_code : 0

              netmanage.state_code : 0

              netmanage.error_code : 0

              netmanage.avalanche.

              netmanage.avalanche.model_name :

              netmanage.avalanche.interval : 60000 , Choices: 0-4294967295

              netmanage.avalanche.startup_update : off , Choices: on,off

              netmanage.avalanche.interval_update : off , Choices: on,off

              netmanage.avalanche.agent_addr : 0.0.0.0

              netmanage.avalanche.available_agent : 0.0.0.0

              netmanage.avalanche.available_port : 1 , Choices: 1-65535

              netmanage.avalanche.encryption_type : 0 , Choices: 0-255

              netmanage.avalanche.udp_timeout : 3000 , Choices: 0-4294967295

              netmanage.avalanche.tcp_connection_timeout : 3000 , Choices: 0-4294967295

              netmanage.avalanche.terminal_id : 0 , Choices: 0-65535

              netmanage.avalanche.realtime_update_int : 300 , Choices: 0-4294967295

              netmanage.avalanche.text_msg.

              netmanage.avalanche.text_msg.print : off , Choices: on,off

              netmanage.avalanche.text_msg.display : off , Choices: on,off

              netmanage.avalanche.text_msg.beep : off , Choices: on,off

              netmanage.avalanche.set_property

              zbi.

              zbi.revision : ZBI Version 2.1

              zbi.state : off

              zbi.last_error :

              zbi.program_list, Choices: fill,execute

              zbi.start_info.

              zbi.start_info.file_name : *:\.BAZ

              zbi.start_info.memory_alloc : 0

              zbi.start_info.execute

              zbi.control.

              zbi.control.terminate

              zbi.control.run

              zbi.control.break

              zbi.control.restart

              zbi.control.step

              zbi.control.variable_name :

              zbi.control.variable_value :

              zbi.control.add_breakpoint

              zbi.control.delete_breakpoint

              zbi.control.clear_breakpoints

              zbi.control.line_number : 0

              zbi.reseller_key

              zbi.key : DISABLED

              zbi.running_program_name :

              zbi.key_version : 1.1

              zpl.

              zpl.calibrate

              zpl.relative_darkness : 0 , Choices: -300-300

              zpl.save

              zpl.label_length : 2030 , Choices: 1-32000

              zpl.left_position : 0 , Choices: -9999-9999

              zpl.format_prefix : ^ (5E) , Choices: 00-FF,00-ff

              zpl.command_prefix : ~ (7E) , Choices: 00-FF,00-ff

              zpl.delimiter : , (2C) , Choices: 00-FF,00-ff

              zpl.zpl_mode : zpl II , Choices: zpl II,zpl

              zpl.system_status : 0,0,00000000,00000000,0,00000000,00000000

              zpl.system_error : 0,0,00000000,00000000

              zpl.no_errors_boot_done : yes

              zpl.print_orientation : nor , Choices: nor,inv

              zpl.label_top : 0 , Choices: -60-60

              internal_wired.

              rfid.

              interface.

              interface.network.

              interface.network.settings_require_reset : no

              interface.network.active.

              interface.network.active.printserver : unknown

              interface.network.active.ip_addr : 0.0.0.0

              interface.network.active.netmask : 0.0.0.0

              interface.network.active.gateway : 0.0.0.0

              interface.network.active.protocol : all

              interface.network.active.default_addr_enable : on

              interface.network.active.wins_addr : 0.0.0.0

              interface.network.active.arp_interval : 0

              interface.network.active.mac_addr : 00:00:00:00:00:00

              interface.network.active.mac_raw : 000000000000

              interface.network.active.server_protocol :

              interface.network.active.server_address : 0.0.0.0

              interface.network.active.dhcp_received_host_name :

              interface.network.active.cable_type : unknown

              interface.network.active.speed : 0

              interface.network.active.rx_packets :

              interface.network.active.rx_errors :

              interface.network.active.tx_packets :

              interface.network.active.tx_errors :

              interface.network.active.protocol_error : None

              cutter.

              cutter.clean_cutter

              line_print.

              line_print.buffer_height : 2400 , Choices: 412-2400

              apl.

              apl.enable : none , Choices: none

              apl.framework_version : 1.2

              apl.version : none

              apl.o.

              apl.o.graphics_byte_width : 72 , Choices: 0-255

              formats.

              formats.cancel_all :

            • Re: Can't print images to iMZ320 Printer
              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,

              • Re: Can't print images to iMZ320 Printer
                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