2 Replies Latest reply on Jan 15, 2019 11:45 AM by Dmitry Prokhorov

    System.ArgumentException: 'Builder not correctly implemented'

    Bret Pelkey

      Just stared getting this error after updating to Zebra.Printer.SDK v2.15.2634 from 2.14.1989

       

      C# sample code

       

         string conn = null;

       

         foreach (DiscoveredPrinterDriver zPrinter in UsbDiscoverer.GetZebraDriverPrinters())
         {
          conn = zPrinter.GetConnection().ToString();
         }

       

         if ( Sys.PartNumberModel.CompanyName == "Hi")
         {
          PrinterUtil.SendContents(conn, "^XA"); <== get error here
          PrinterUtil.SendContents(conn, "^FO40,40^BY2^B3N,N,75,N,N^FD" + Sys.SerialNumber + "^FS");
          PrinterUtil.SendContents(conn, "^FO40,130^ASN,28,15^FD" + "SN:" + Sys.SerialNumber + "^FS");
          PrinterUtil.SendContents(conn, "^FO300,130^ASN,28,15^FD" + "WO:" + Sys.WorkOrder + "^FS");
          PrinterUtil.SendContents(conn, "^FO40,175^A2,28,15^FD" + "PN:" + Sys.PartNumberModel.PartNumber + "^FS");
          PrinterUtil.SendContents(conn, "^FO300,175^A2,28,15^FD" + "TS:" + Sys.PartNumberModel.SpecNumber + "^FS");
          PrinterUtil.SendContents(conn, "^FO40,205^A2,28,15^FD" + "FW:" + Sys.HearingAid.Algorithm_Version + "^FS");
          PrinterUtil.SendContents(conn, "^FO300,205^A2,28,15^FD" + "Test: " + Global.SoftWareVersion + " " + Global.SoftWareRevision + "^FS");
          PrinterUtil.SendContents(conn, "^FO40,235^A2,28,15^FD" + "Mfg Id:" + Sys.PartNumberModel.ManufactureID + "^FS");
          PrinterUtil.SendContents(conn, "^FO300,235^A2,28,15^FD" + "Mod Id:" + Sys.PartNumberModel.ModelID + "^FS");
          PrinterUtil.SendContents(conn, "^FO40,265^A2,28,15^FD" + Global.End.ToShortDateString() + "^FS");
          PrinterUtil.SendContents(conn, "^FO300,265^A2,28,15^FD" + Global.End.ToLongTimeString() + "^FS");
          PrinterUtil.SendContents(conn, "^XZ");
         }

        • Re: System.ArgumentException: 'Builder not correctly implemented'
          Dmitry Prokhorov

          Hello Bret,

           

          Could you pls to perform a check if it will work in case you will  join all your strings into one string and send this string to PrinterUtil.SendContents method in a single call?

           

          In case it will continue suffering from issue then seems you'll need to submit your problem to Zebra Technical Support.

           

          Dmitry Prokhorov

          Software Engineer, Kutir Mobility

          Posted on behalf of Zebra Technologies

          • Re: System.ArgumentException: 'Builder not correctly implemented'
            Dmitry Prokhorov

            Hello Bret,

             

            Seems you are using a wrong method to print your label. As you can see in PrinterUtil Class usage example the SendContents is intended to store some data on printer as a file. It is not intended to be used to print ZPL content.

            Instead of that, you need to use UsbConnection.Write method. Please, use code from TcpConnection Class as an example. You will need to use UsbConnection instead of TcpConnection. In a nutshell you will need to perform following steps:

             

            1) UsbConnection conn = zPrinter.GetConnection();
            2) conn.Open();
            3) conn.Write(Encoding.UTF8.GetBytes("..your ZPL code goes here.."));

            4) conn.Close();


            Don't forget to use try-catch statements to handle possible exceptions.

            Hope it help.

             

            Dmitry Prokhorov

            Software Engineer, Kutir Mobility

            Posted on behalf of Zebra Technologies

            1 of 1 people found this helpful