2 Replies Latest reply on Jan 22, 2018 9:24 AM by Saul Miranda

    when i  send print only get TEST  (iMZ320)

    Saul Miranda

      We are using plugin phonegap: When i send print only get TEST label, but if change language in app PRINTER SETUP (zebra app) to ZPL print OK if print second ticket i get try again TEST label.

       

      cordova.plugins.zbtprinter.print("AC:3F:A4:1F:1B:FA", "! U1 setvar \"device.languages\" \"line_print\"\r\nTEXT ***Print test***\r\nPRINT\r\n",

             function(success) {

                  alert("Print ok");

             }, function(fail) {

                  alert(fail);

             }

        );

        • Re: when i  send print only get TEST  (iMZ320)
          Manuel Caicedo-Rivera

          Hi Saul,

           

          Please, could you let me know which sample code you are using for this integration?

           

          Based on the script you are sharing. I assume it is connecting through Bluetooth "AC:3F:A4:1D:7A:5C"

          The second portion the command is basically what you are sending to the printer to either, set up the printer with a command, or for printing a receipt/label or both:

           

          The first portion of the string: ! U1 setvar "device.languages" "line_print" is telling to the printer to set up the printer language to line_print with an SGD, so once the printer is in this status you can send any "text" to the printer, and it should print the same text.

           

          You do not need to send every time that you want to print something the command  ! U1 setvar "device.languages" "line_print", once the printer is in line_print ,  it will be a permanent until you send another SGD command to change the language.

           

          What you should need is to separate these commands. For example, use the first portion for set up the printer:

           

          cordova.plugins.zbtprinter.print("AC:3F:A4:1F:1B:FA", "! U1 setvar \"device.languages\" \"line_print\"\r\n",

                 function(success) {

                      alert("Print ok");

                 }, function(fail) {

                      alert(fail);

                 }

            );

           

          And the second portion for printing in line_print:

           

          cordova.plugins.zbtprinter.print("AC:3F:A4:1F:1B:FA", "This is a test in line print you can print anything you write here.\r\n",

                 function(success) {

                      alert("Print ok");

                 }, function(fail) {

                      alert(fail);

                 }

            );

           

          Now, if you want to do the same but in ZPL, so you can do the following:

           

          cordova.plugins.zbtprinter.print("AC:3F:A4:1F:1B:FA", "! U1 setvar \"device.languages\" \"hybrid_xml_zpl\"\r\n",

                 function(success) {

                      alert("Print ok");

                 }, function(fail) {

                      alert(fail);

                 }

            );

           

          Then, you can send the portion only for printing

           

          cordova.plugins.zbtprinter.print("AC:3F:A4:1F:1B:FA", "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ" ,

                 function(success) {

                      alert("Print ok");

                 }, function(fail) {

                      alert(fail);

                 }

            );

           

          Please, let me know if that worked.

          MC