2 Replies Latest reply on Nov 14, 2018 3:45 AM by bhargav venkatesh

    How to Print Png image using Javascript and PHP

    MANJUNATH GODACHAPPANAVAR

      We are Developing application where we required to print Image through Zebra Printer. The application uses Zebra Js Files from which we are able to print text. But we are facing problem in printing Image.

      1. I'm converting .png image to .grf using php (Ref image2grf)
      2. Sending Parameter using following lineselected_printer.send("^XA^FX Second section with recipient address and permit information. ^CFA,30 ^FO50,30^FD"+$("#user").val()+"^FS ^FO50,70^FD"+$("#compName").val()+"^FS ^FO50,110^"+$("#mob").val()+"^FS ^FO50,150^FD"+$("#email").val()+"^FS ^FO50,190^FDTo Meet:"+$("#toMeet").val()+"^FS ^FO50,230^FDPurpose:"+$("#reason").val()+"^FS ^FO50,260^FDAuthorise to Carry e-Device:"+mob+" "+lap+" "+other+"^FS ^FO50,220^FDAuthorise to Carry e-Device:"+mob+" "+lap+" "+other+"**^FO20,20^XGR:SAMPLE.GRF,1,1**^FS^XZ");

      Please provide the Solution

        • Re: How to Print Png image using Javascript and PHP
          Robin West

          Hi

          Working with images in Zebra printers is usually a 2 step process.  First you have to send the image to the printer to store it, then you use it in a print job.  The output from the image2grf function will store the image.

          Forgive me if the PHP is wrong, it's not a language I use.

          $outputOfimage2grf = image2grf($filename, 'R:SAMPLE.GRF');

          selected_printer.send($outputOfimage2grf);

          selected_printer.send("^XA^FX Second section with recipient address and permit information. ^CFA,30 ^FO50,30^FD"+$("#user").val()+"^FS ^FO50,70^FD"+$("#compName").val()+"^FS ^FO50,110^"+$("#mob").val()+"^FS ^FO50,150^FD"+$("#email").val()+"^FS ^FO50,190^FDTo Meet:"+$("#toMeet").val()+"^FS ^FO50,230^FDPurpose:"+$("#reason").val()+"^FS ^FO50,260^FDAuthorise to Carry e-Device:"+mob+" "+lap+" "+other+"^FS ^FO50,220^FDAuthorise to Carry e-Device:"+mob+" "+lap+" "+other+"**^FO20,20^XGR:SAMPLE.GRF,1,1^FS^XZ");