Question

I have a barcode printed webpage, which i have created using javascript library. its printing properly in normal A4 printer, but when im trying to pring its in zebra GD420 (direct thermal) barcode printer, its printing blank page, In zebra user guide they instruct to send zpl commands like," ^XA^FO50,50^B3N,N,100,Y,N^FD123456^FS^XZ " and not getting that, how can use it in my code ? One more think that my client is testing it(printing barcode in barcode printer) remotely. So is there any configuration settings needed for this?

Please find attached screen shot my barcode printing preview.

enter image description here

i have writte a javascript function for printing.

<script type="text/javascript">
  function printprocess(numid) {


    for(var i=0;i<numid;i++){
      $("#barcodeTarget").html("");
      var productbarcode=document.getElementById("productbarcode"+i).value;
      var productbarcodevariant=document.getElementById("productbarcodevariant"+i).value;
      var productvariantvalue=document.getElementById("productvariantvalue"+i).value;
      var productprice=document.getElementById("productprice"+i).value;
      var productquantity=document.getElementById("productquantity"+i).value;

      var alstuf=productbarcode+"---"+productbarcodevariant+"------"+productvariantvalue+"---"+productprice+"------"+productquantity;

      if(productquantity!="0"){
    var par1=productbarcodevariant;
    var par2=productvariantvalue;
    var par3=productprice;
    var timu= productquantity;
    var value =productbarcode;
    var renderer ="bmp";
    var btype = "code128";
    var quietZone = false;
    var settings = {
      output:renderer,
      bgColor: "#FFFFFF",
      color: "#000000",
      barWidth: "1",
      barHeight: "40",
      moduleSize: "1",
      posX: "1",
      posY: "1",
      addQuietZone: "1"
    };
    $("#barcodeTarget").html("").show().barcode(value, btype, settings);
    for(var x=0;x<productquantity;x++){
      var Mybarcode = document.getElementById('barcodeTarget').innerHTML;
      console.log(Mybarcode);
      var adtext='<div  style="background-color: #FFFFFF;width: 250px;font-size:10px;font-weight:normal;margin: 200px 0px 200px -70px; -webkit-transform: rotate(90deg);-moz-transform: rotate(90deg);-o-transform: rotate(90deg);-ms-transform: rotate(90deg);transform: rotate(90deg);">     '+par1+': '+par2+'<br/>Price : '+par3+' '+Mybarcode+'   </div>';
      $("#barcodelist").append(adtext);
    }
      }
    }
    var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
    disp_setting+="scrollbars=yes,width=200, height=600, left=100, top=25"; 
    var content_vlue = document.getElementById("barcodelist").innerHTML; 
    var docprint=window.open("","",disp_setting); 
    docprint.document.open();
    docprint.document.write('<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml">');
    docprint.document.write('<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><style type="text/css"> @media (max-width: 4in) {    @page {      size: A4;    }  }</style></head>');
    docprint.document.write('<body onLoad="self.print()">');
    docprint.document.write(content_vlue);          
    docprint.document.write('</html>'); 
    docprint.document.close(); 
    docprint.focus(); 
    docprint.print(); 
    $("#barcodeTarget").hide()
    return false;
  }

</script>
Was it helpful?

Solution

You have to use zebra programming language to send data on barcode printer, as @douglas ,mentioned you have to make zpl string like ^XA^FO50,50^B3N,N,100,Y,N^FD123456^FS^XZ
to convert the instruction . check this link for write code in zpl

OTHER TIPS

create an object of barcode printer class in zebra programming language. like

BarCodeField barcode = new BarCodeField("barcode",
                                         10, // X Position in dots 
                                         10, // Y Position in dots 
                                         Printer.ALIGN_BOTTOM_LEFT, // Alignment
                                         Printer.DIR_LEFT_TO_RIGHT,// Direction
                                         BarCodeField.TYPE_EAN_13,// barcode type
                                         56, //barcode height
                                         1, // wideRatio
                                         3, // narrowRatio
                                         1,//Magnification
                                        "3442648507010"); // barcode expression
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top