printing an image using PHP or Javascript

I am capturing an image of a person through my laptop camera and wanted to print that image in a dot matrix image by converting. I am using the printer Zebra GC420t. I want to print those details including image on 70x100 sized ticket through that printer. I am able to print the images on the 100x50 labels but when I try to print the image on tickets it doesn't consider the whole ticket

var available_printers = null;

var selected_category = null;

var default_printer = null;

var selected_printer = null;

var format_start = "^XA^LL200^FO80,50^A0N36,36^FD";

var format_end = "^FS^XZ";

var default_mode = true;

function setup_web_print()

{

$('#printer_select').on('change', onPrinterSelected);

showLoading("Loading Printer Information...");

default_mode = true;

selected_printer = null;

available_printers = null;

selected_category = null;

default_printer = null;

BrowserPrint.getDefaultDevice('printer', function(printer)

{

default_printer = printer

if((printer != null) && (printer.connection != undefined))

{

selected_printer = printer;

var printer_details = $('#printer_details');

var selected_printer_div = $('#selected_printer');

selected_printer_div.text("Using Default Printer: " + printer.name);

hideLoading();

printer_details.show();

$('#print_form').show();

}

BrowserPrint.getLocalDevices(function(printers)

{

available_printers = printers;

var sel = document.getElementById("printers");

var printers_available = false;

sel.innerHTML = "";

if (printers != undefined)

{

for(var i = 0; i < printers.length; i++)

{

if (printers[i].connection == 'usb')

{

var opt = document.createElement("option");

opt.innerHTML = printers[i].connection + ": " + printers[i].uid;

opt.value = printers[i].uid;

sel.appendChild(opt);

printers_available = true;

}

}

}

if(!printers_available)

{

showErrorMessage("No Zebra Printers could be found!");

hideLoading();

$('#print_form').hide();

return;

}

else if(selected_printer == null)

{

default_mode = false;

changePrinter();

$('#print_form').show();

hideLoading();

}

}, undefined, 'printer');

},

function(error_response)

{

showBrowserPrintNotFound();

});

};

function showBrowserPrintNotFound()

{

showErrorMessage("An error occured while attempting to connect to your Zebra Printer. You may not have Zebra Browser Print installed, or it may not be running. Install Zebra Browser Print, or start the Zebra Browser Print Service, and try again.");

};

  // new Date().toLocaleTimeString('en-US', { hour12: false,

  //                                            hour: "numeric",

  //                                            minute: "numeric"});

function sendData(photoURL)

{

var test;

$.ajax({

            url: 'db/zpl.php?photo='+photoURL,

            cache: false,

            contentType: false,

            processData: false,

            type: 'GET',

            success: function(data) {

            test=data;

            console.log("From ZPL:"+data);

            }

        });

var mob="",lap="",other="";

if($("#emobile").val()==="on"){

mob="Mobile";

}

if($("#elaptop").val()==="on"){

lap="Laptop";

}

    if($("#eother").val()==="on"){

other="Other";

}

showLoading("Printing...");

checkPrinterStatus( function (text){

if (text == "Ready to Print")

{

selected_printer.send("^XA N ^XZ");

// selected_printer.send("^XA~DGE:ZLOGO.GRF,2580,030,"+test+"^XZ");

selected_printer.send("~DYE:SAMPLE.GRF,A,GRF,5000,030"+test+",A");

// selected_printer.send("^XA^FO0,5^GFA,3500,3500,38,M07IFJ0LFEJ01FFEI03LF9FFEK0IFC01LFC,L01JFJ0MFEI03FFE003MF9IFJ01IF81MFC,L03JFJ0NFI03FFE00NF8IFJ03IF07MFC,L07JFI01NF8003FFC03NF0IFJ07FFE0NF8,L0KFI01NFC007FFC07NF07FF8I07FFC3NF8,K01KFI01NFE007FFC0OF07FF8I0IF87NF8,K03KFI03NFE007FFC1OF07FF8001IF0OF8,K07KFI03OF007FF83NFE03FFC003FFE0OF8,K07KFI03FFE003IF00IF83NFE03FFC007FFC1OF,K0LFI03FFC001IF00IF87NFE01FFC00IF83OF,K0LFI07FFCI0IF00IF0JFEL01FFE01IF03JF,J01FFEIFI07FFCI0IF01IF0JFN0FFE03FFE07IF8,J03FFEIFI07FF8I0IF01IF1EFFEN0FFE07FF80F7FF,J03FFCIFI0IF8I0FFE01IF18FFEN0IF0IF00C7FF,J07FFCIFI0IF8001FFE03FFE31FFCN07FF1FFE018FFE,J07FF8IFI0IF8001FFE03FFE21FFEN07FF3FFC010IF,J0IF0IFI0IFI01FFE03FFE01FFEN03KF8I0IF,I01IF0IF001IFI01FFE07FFC01KFCK03KFJ0KFE,I01FFE0IF001IFI03FFC07FFC00LFCJ03JFEJ07LF,I03FFE0IF001FFEI03FFC07FFC00MFJ01JFCJ07LF8,I03FFC0IF003FFEI03FFC0IF800MF8I01JF8J07LFC,I07FFC0IF003FFEI03FFC0IF800MFCJ0JFK07LFE,I0IF80IF003FFCI07FF80IF8007LFCJ0IFEK03LFE,I0IF80IF007FFCI07FF80IF8007LFEJ0IFCK03MF,001IF00IF007FFCI07FF81IFI03LFEJ0IF8K01MF,001FFE00IF007FFCI0IF81IFJ0LFEJ0IF8L07LF,003NF007FF8I0IF01IFK0KFEJ0IFN07KF,007NF00IF8001IF03FFEM03FFEJ0IFQ0IF,007NF00IF8001IF03FFEM01FFCI01IFQ0FFE,00OF00IFI01FFE03FFEM01FFCI01IFQ0FFE,00OF01IFI03FFE07FFCM01FFCI01FFEQ0FFE,01OF01IFI03FFE07FFCM03FF8I03FFEP01FFE,03OF01IFI07FFC07FFCM0IF8I03FFEP07FFC,03OF03FFEI0IFC0IF803NF8I03FFCK0NFC,07FFCI0IF03OF80IF803NFJ07FFCJ01NF8,07FFCI0IF03OF00IF803NFJ07FFCJ01NF8,0IF8I0IF03OF00IF803MFEJ07FF8J01NF,1IF8I0IF07NFE01IF007MFCJ07FF8J01MFE,1IFJ0IF07NFC01IF007MFCJ0IF8J03MFE,3IFJ0IF07NF801IF007MFK0IF8J03MFC,3FFEJ0IF07NF003FFE007LFEK0IFK03MF,7FFCJ0IF0NFC003FFE007LF8J01IFK03LFC,IFCJ0IF0NFI03FFE00LFCK01IFK07KFE,,:::::::::::::T07018V0EM03CI018O01K01C001C,S01FC18T020EM03F80018O038J01C001C008,S03DE38T0E04M077CS03L080018018,S070E38T0CO071CS03O018018,S0E063F03E0F86EC1C3E1F9C0F0DE0060E2679830784F00I381E383F1B87E1E,S0C063FC7E1FC7EC18FF1F9E3F8FF0060E7E79871FCFF8073FC7E387F3FC7E3F,R01C0631C6638CF0E38C61C0C71CE30060E70398638E6380738E6218E738E3072,R01C0630CE070CE067186180C61CC300E0E6031CE30CE380730E6019C738E307,R01C0670C787F8C066186180CE1CC300E0C6030CC7FCC380630C7819C730E7038,R01C0E60C3C7F0C06638E181CC1DC300E1CE030DC7F8C300630C3C39CE30C701E,R01C0C60C0E600C03C38E181CC19C700C1CE070F8600C300630C0E38FC30C600E,S0C1C61C0E601C03838E3818E398700C78C07070700C300E71C0E307870C6006,S0FF8F78DC7B1C0383FE3F18F718601FF0C060703B1C700E61CDE307C71C7CEE,S07F0FF1F83F180301FE1F187E18601FC0C060603F18700C61CFC303E61C7CFC,S01800802008L04gH04O02J06I0103,iK010E,iK01FC,iK01F8,,:::::M03hYFC,,::V01L02M01I02002K0C32I0801,P018I067C7807870F0C03C3878F00F8J0C52I0C07C,P018I0660CC0CCD990C0066CC89818I0180EJ0C0C02,P02C7C0660860CC8998C30I4CCF0101E79CCE23C780C0F9FE3E78F99,P0242406398606C8998C00C44CC70101A218C4324CC08098923208C89,P03E24060C8602C8998C01044CC98101A218C4338CC0C089923278C8E,P04624064IC008D990C2306CC8981818218C4320DC0C0D9923248D86,P04I606787807870F0E33C3878F00F8E70CCE31C7C07C71933E7CDC4,gG0202M01I02002S01K03K04,hX03K0C,,::^FS^FS^FX^CFA,30^FO10,120^FDVisitorName:"+$("#user").val()+"^FS^FO10,170^FDCompany:"+$("#compName").val()+"^FS ^FO10,220^FDTo Meet:"+$("#toMeet").val()+"^FS ^FO10,270^FDPurpose:"+$("#reason").val()+"^FS ^FO10,320^FDAuthorise^FS ^FO10,370^FDto Carry:"+mob+" "+lap+"^FS^FO500,70^XG R:SAMPLE.GRF,1,1^FS^XZ");

// selected_printer.send("^XA^FO20,20^GFA,315,315,15,I07F807FFE01F81IFBF003F0IFCI0FF80JF01F87IF9F007E3IFC001FF80JF83F8JF9F80FCJF8003FF80JFC3F1JF1F81F8JF8003FF80FC0FC3F3JF0F83F1JF8007FF81F80FC7F7FCI0FC7E3FC,007CF81F80FC7E5FJ07CFC6F8,00FDF81F80FC7E1FJ07DF80F8,01F9F83F80F87E1FF8007FF00FFC,01F9F83F01F8FC1IF803FE00IFC,03F1F83F01F8FC0IFC03FC00IFE,03F1F83F01F8FC0IFC01F8007FFE,07E1F87E03F1FC03FFC01FI03FFE,0JF87E03F1F8I0FC03FK07E,0JF87E03F1F8I07C03FK07E,1JF8FC07E3F8I0F803FK07C,1JF8FE0FE3F07IF807E003IFC,3F01F8JFC3F0JF007E007IF8,7F01F8JF83F0JF007E007IF8,7E01F9JF07E0IFE00FC007FFE,FE01F9IFE07E0IFI0FC007FF8,^FS^FX^CFA,30^FO10,70^FDVisitorName:"+$("#user").val()+"^FS^FO10,120^FDCompany:"+$("#compName").val()+"^FS ^FO10,170^FDTo Meet:"+$("#toMeet").val()+"^FS ^FO10,220^FDPurpose:"+$("#reason").val()+"^FS ^FO10,270^FDAuthorise^FS ^FO10,320^FDto Carry:"+mob+" "+lap+"^FS^FO250,70^XG R:SAMPLE.GRF,1,1^FS^XZ");

// selected_printer.send("^XA^FO50,50^IME:RES.PNG^XZ");

selected_printer.send("^XA^FO50,50^GFA,6325,6325,23,gS08892L5B6CI54921W022492JA252949I5ADB6L0424421N0I12N049085252AAB55A552549J0801J2449J08892924A12554KAD5ACM08I04P04002J01144I2494JAD652A8I209Q01204201092841149524A9556BA04028M04M04I08084002084120952K5450400802012104488K0100400920922A4AA9K5AE0210212P0I4004I02200801009224952AAB248448I01R010I100242A8AA249252IADA01I04044004O08J010808020112494LA4811004I08O04J040208090A88925292I54024021L011002L089040224040450924KAC20040404M020044M08I091428524A494IA09108I044R0400100812041022491252IA404I01I022O01008I0140208A9424LAC0802108T0402082440084200142449I54221002gJ081105541492492AA00804001X080822405002A24954IA4804I04R02J020408004025014952I540040081008I04J04K02L011200AA12252A541208808V088010412800AA00A148A554402gL08008800540A2552AA00801gG081I02024902A4922A4A080101gI01202I050494949542104J0201Q020040824048925051024A52A00100804004gK020854A14A40800201gG0802024948A28915294408gG0402001048I020822495520201004g0208I04A50A29124894100801g08I0I1I04084A4A54AgP0400112122012122800401gI022004400808A89495424004g08K0400482A2050A48AI09W0101J08I02102I0A85126401Y08K040041040892A028491224X02A484J0404002J0A8294A8002V0174F42M021024A40284294Y05FABFCA1I02004080015052922I0102S03ED7FACJ08080409280508494240408R01FF71F67C02202I0200250A2922008J08P0BF5AC7D7F4J012102480411248W02FFAA9168AF4K040801528A124W03FFD3C856F9EL040920040A52241T0IFA87113IF20924102004A2A108V01FFDE97808DFFC2I0810490101452J04Q05FFB741542JFK041005454288004S07FF8BD4C297IFA0I20414010284408S02F7FD2E66943IFD480010412450528U03FDFA1F194B9JFJ08I0410A084U0FDAFB57DEAE8JFE848022508415281002Q0F6EFD57EFB7E7JFI0208022140420108P05F9ABE95IFBF7JFE0204088081514T03DC6FDABKFBKF484020145408,T0BF557ED5KFEKFI010481014541R027ED5FF697OFE901I02424288T0FF6ABFEE9OFE8102490089022004P09FFB6AFFBAOFE8008002420A8801Q01IFD57RFD8440248104052S07FFDF5BSF4I080085150408Q07IFDA4BQFE80040I20405,R017IFEEA97PFB4890108090A0AS0IFDF742BPFD8I08208020A,R01KF9B817PF5J082248A0AR01FFBFFEESF01I2I0100A,R05FFEIFDAAQF9J012485214R03IF57IF7QFCI084002048,R05JF5D7IFDEB7LFE20810490905402P07KF7EAC84B54BJFEE8L040502I04N07LFBB52A40ADAKF08242241505,R0BLFD5I022056KFA08I010040AR0MF6A440084295JF8I08904914,R0LF5K02008A6JF800400200414R0KFEAA4L0213JFC4202204A14,04P0JFEA8O084JFC08080400814Q01JFB4O0402BIFA0020812424,R0JF41P012JFC00801001094R0IFE8R013IF8100204944,Q01IFAS0ABIFC80084I0154R0IFDT0BIFC024012494,R0IFT04BIFDI01J012AQ01FFEAR0115IFC0808089484,04O01FFEU0BIFC00804I0214Q03FFDT027IFCI02049288,Q01FFCT015IFC42202J024Q03FFAU0BIFD08040249288Q01FFCT057IFCJ09J02,Q03FF9T017IFC00400124A04002O0FF8T01BIFC010844I0A,04O01FFCT02JFD1001004A80AR0FFU015IFCI04110029,R0FFCS0117IF8004I011004R0FFJ091J0156DA4JFC0400I8425,R0FF400B6DJ057FE92BIF910120210802R0FF00AIF50027IFEDJF800802I0128004O0FF0817FFA5115IFBEBIF88K0924,08P0FE21485FF045KF7DIF40409120014AR0FE97FFEABA16E92BDKF1202I0494,R0IFD003FE882BKFB7FF8008048I052R0IF4ABIFE3FEIF7KF5020201249,I01N077D75WF048002J028R0FBD5JFBRFEAI088492A82084O077D6JFEPFEFE5404L01,R0BFD3KFE0NFEFF02402I12244R0FDCB75EFCC07FEJF7IF540084I08,Q01FCC544105C07DB7DFDIFEA12400448128R0FEC8900A4807E48B7KF54L02402R07CC022B498072B2AD7JF4A804912009,108O0EC401DA0100355D5FAF7FF5024J09208I01N07E6K0100310BFEAJF568080920042R05D6K03003022A95EIFA9220800491,R05E2K020018I02AEBFED48802240044R03C3K0E002CI041BIFB640200125,04P07E8CI05CI0EJ0BAIFD921009I0281Q03C016FF48004DE004EB7FF6D4808025482I08N01E8N0241IF05IFD5I411I01,R03CK01I012J02AJFD5104024484S0E8N015K05IF6B481048102,004O0251J01I01D4I02BJFDA44I0828801Q06L08I0EK0B7FFEEA90I210041R048J06J0F240157JFBA4088044A,R012K08J0180241BJFED12009I08J04N068I014J02A400ALF6C00202484S0A4I04K0150825EJF6D28504802,08Q069I0AK0A22112LFE8201012880042O0244024J02D1I4BDKF6D4081I04S072929A16003C1212DLFD51410492,01Q03905F80F04BE4IAB7LF4808400141K08L0B6D5588FFAFF0B4B7LFDA52012A8,S05AABF41FD7FF2BB5NF500480024S03556F20KF4BDFDLFDD5401221,I0808M01FBBF40KF2BF57MF54124088412204O0DD7E00KFADPFD2800802,T0F6FD417JFB7FBMFEAA2922508T0FB7B54NFDOF48J044S026DFFE2NFBMFEAA249291,24R07CBDB97VFEA8J044002Q0FB7FD6NF5NFB4AA94A1,J08N027EBBFB7MF7NFEA4J084008Q03D49NFEABMFEDD124922,22R0BF243MF4ABOF54820088I020108K047E900BLF177NFIA285422K04N03FCA0420IFA4DPFD48101080808O017F5I0956FF526OF6AA282442204Q03BE8I0BFF755BPFD142811,J02N04BFD50012ABDA9PFD6D101I401R02FE8I0B7DB6AOFEFB484801,04M08I015FB50I5FFED7PFDD550528420088N043FF4002BFF7ABQF6A25045,002Q0AFFA40AEFFECQF6D5884804008I08M05FD40017F7757QF755202A,24I0202K0957FA804BFDD2DPFBAD215014K08N05FFAI02D5297OFEEF5480A8,I022N025FFC80012085RFIA5402AI2Q0B7FAK0A557PFAF69029,R0225DFF4J0125PFEFIA5025408L01I0802FFEK088BQFDBA92A8,21122L04017EFFAI0I2BQF76D5402AAL022002004177F94J0AQFID6A2A8,04I02N0BIFD082I57RF7B5405542041P05EBFEA290ABRF5KA822I081N0557IFA9I5TF6D52428809R03EJFI5SFDBB6A928442K088L0AF7KF77SFEDB5485280024820044I045DKF7DTF76D6A5082048008L0112EBgFBB5AA95284S05F7YFDD6D5K41P08012BAgF7B6IA912022480110020405EBgFDDB6A92482I0108008I0496gFDEB5AA4924048Q05697YF7DJA49,201202M022D7gFD6DAA924AJ04I080808896ABYF76ADI52,4920081208020056AEQFBLFDDBD6AA894I02004J08022AABBYF66AA454424882N0896ADPFENF5DBB55428J08100204I0I56DOFBOF6D56AB44I2004040200224D55F6LFDFFDLFDBB6DAA9320804001K0802AI5PF7MFEDKA88409090408002049I5EDLF7DBFBLFB6DDJ5402M08080054A55F6DIFDFFEDEBF7FFEFF6BB54A4280404J040120A556BBLFEFBFEB8BFFD5BJ52A009090I8K0A1255DEB5BF7EFAEB7DD57FFEDAD554844M02I040A956ABEFFDF7DFBFIA0FF6B6F5IA41044002010024I052AF6BDF7IF56D76A01DF6D56AA54020092020020100A8IADEF7FDDBFDFAB4007BDB5AB54A4848J04M054AB775FF7FEAB56D4I0D75EBI5,0101089002K0A92ADADFB7F6FFDEB29I02DEADI56501020020824J04A5576AFDBFAAB5D54J02AB5B55,048082002L05252AABFDFEDFDDIA8J01756D556200A00488M090AB5D5757F56AEA9L016DI540A401K08J0A26956BFDFDBFB75548L0B76D544010848404L0914AAD57B7D55AB55M01J54248200108L0A4AI56FDFD7EEAD49N05F5AA082022001M025256B5757EBBI54N0256AA42890842M0511I5DEDFEDD56AA2O02IA280020104K010A48IABF6BB7B5514O015AA02548204N01252AF6BDEFAD52AQ02B45J084N02894AB5BD7BAEAA914Q0AA0A92401O054JAD7DEF5544AR02C502005O010244AD7AEBAED2A4R0140509504O0292AB7AF7DF54911S02504001O0102AI575D6AB544,251524P0489I5AF7FB5221,404S01254AEDBD55A908,1512AR0125537D7AE4422,404S014I5DAFAD5208,2A148R0108A575D5A94,814U052ABAEB49001,2A14U0A54DB52A51,494U0212B6IA4,24W048A9544908,91X020549204,4AX08A92489,5g010822,08g04288,A,4,,::::::::::::::hJ01,,:hJ02,,hJ01,,hJ02,hJ01,hJ02,,hJ024hJ01,hJ02,8hI01,4hI02,hJ02,2hI09,1h0122,1hI03,1hG088,08gG05FFAT02005,08Y017EAFFDT0402,08X015J0AFFR02122808X04M0BCQ08802,06gL014R0509,14gM028P02042202gN04O020A0B227gN01O0821412094gN0CM040880AA458gN06N020545612808gL05L02085212609AgN028L0210945E84C01gG017F5034N02492E8AC24Y0167IFE18J0110A928BE826S0AM02C7BIFECJ040404B25ED56R01N07FFBJFA4J020A2A93EC2B0A4O028M0FEEBKFI02002155A7EC56R024L01FE0LFC00811042B13EE2B82P054L02OFE0404452ABABCE9F08P02M03OFCCK0156A5EA4B255O095002100A97FFDJFEB42C955IAB4^FS^XZ");

// selected_printer.send("^XA^FX ^CFA,30 ^FO100,50^FDVisitor Name:"+$("#user").val()+"^FS ^FO50,80^FDCompany:"+$("#compName").val()+"^FS  ^FO50,110^FDTo Meet:"+$("#toMeet").val()+"^FS ^FO50,150^FDPurpose:"+$("#reason").val()+"^FS ^FO50,190^FDAuthorise^FS ^FO50,220^FDto Carry:"+mob+" "+lap+"^FS ^FO500,70^XG R:SAMPLE.GRF,1,1^FS^XZ");

// selected_printer.send("^XA^FO50,50^GFA,5000,5000,25,,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::K0FF8007IFCI0FE003IFE7F8001FE03JF,J03FF800KF801FE03JFE3F8003FC1KF,J07FF800KFC01FE07JFE3F8007F87JFE,J0IF800KFE01FC1KFC3FC00FF0KFE,I01IF801KFE03FC3KFC1FC01FE1KFE,I03IF801FE01FF03FC3KFC1FC03FC3KFE,I03IF801FC00FF03F87FFCJ0FE07F83FFC,I07FBF803FC00FF07F8FFEK0FE0FF07FE,I0FF3F803FC00FF07F89FCK0FE1FE0CFC,I0FF3F803FC00FE07F91F8K07F3FC01FC,001FE3F803F800FE0FF01FCK07F3F801FC,001FC3F807F800FE0FF01FEK03IF001FF,003FC3F807F801FE0FF01JFI03FFEI0JF8,007F83F807F001FC1FE01JFC003FFCI0JFC,007F83F80FF001FC1FE01JFC001FF8I0JFE,00FF03F80FF003FC1FE00JFE001FFJ07JF,00FF03F80FF003FC1FC007IFE001FEJ03JF,01FF07F81FE003F83FCI01FFE001FEK01IF,03KF81FE007F83FCK0FE001FCM0FF,03KF81FE007F83FCK0FE003FCM07E,07KF81FC00FF07F8K0FC003FCM0FE,07KF83FC00FF07F8J03FC003FCL01FE,0FF007F83FC01FE07F81KF8007F8I0KFC,1FF003F83KFE0FF01KF8007F8I0KFC,1FE003F87KFC0FF01KFI07F8I0KF8,3FE003F87KF80FF01JFEI07FI01KF,3FC003F87KF01FE03JFCI0FFI01JFE,7F8003F8KFC01FE03JFJ0FFI01JF8,,:::::::::O0784P018J078018L04I06008,O0DCCO02L06CO0CL0808,N0184CO06L046O08K01818,N0104F8E3C7233C731E7E0427B233EFC09F3CC79F3C!N030489866C2664413366042413262CC091304899108N03048DC7CC24C44123660C641167IC19138C89130CN030C8865083IC4323460C6C11C788C1910CCD91306N011998240818IC3224408CC31840881B10C8631203N01F1F3E788107C723C440F883083I81337887I39EhJ018,hI019,hJ0E,,::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::^FS^FX^CFA,30^FO50,180^FDVisitorName:"+$("#user").val()+"^FS^FO50,220^FDCompany:"+$("#compName").val()+"^FS ^FO50,260^FDTo Meet:"+$("#toMeet").val()+"^FS ^FO50,300^FDPurpose:"+$("#reason").val()+"^FS ^FO50,340^FDAuthorise^FS ^FO50,380^FDto Carry:"+mob+" "+lap+"^FS^FO450,120^GFA,9000,9000,30,hQ01LF8,hR0LF8,hR09KF8,hS0KF8,hS07JF8,hS03JF8,::hT01IF8,:hU0IF8,:hU07FF8,hU03FF8,:hU017F8,hV01F8,:hW0F8,:hW078,hW038,:hW018,,::::::::::::::::::::::gL0F0FE,gK03F0FFC,gK0FFE7FF9,gJ01LFCF,gJ07IFCFFEFC,gI01JF73FF7F8,gI07JFE1FF3FF,gH01IFDFC01E1IF,gH03IFC1F0073IFE,gH0JF80F8001JF,gG01JFE03C009JFC,gG03KF01EI0JFE,gG07FFE7F807I0KF8,g01IFE3FC038003JFC,g03JF07E098083KF,g07JF03F1CC668KF8,Y01FFDFF83F8E41707KF,Y03FFDFFC3FEFFBBD3KFC,Y07FFE7F73MF9LF,Y0FF1F7FC1MFCLFC,X01FE6BFFE0NF7LF,X03FE2E7FF8UF8,X07FF0JFC3TF8,X07FF83JF07SF,X0IFB9JFC1SF8,W01JFE7IF787RF8,W03IFEF8XF8,W03JFE7XFC,W07KF3XFC,W0LF87WFC,W0LFE00VFC,V01MF0E3UFC,V01LF7E01UFC,V03LFBFC01TF8,V03OFCUF8,V07OFCUF8,V0gLFC,V0gLFE,V0KFDgGF,U01gMF,U01RFEF1E9PFC,U01QFCI0C001NFC,U03QFN0NFC,U03PF8N03MFE,U03NFER07KFE,U03NFS03KFE,U07MFCS03LF,U07MFT01LF,U07LFCU0LF,U07KF8V07KF,U07KFW07KF,U07JFCW07KF,U07JFCW03KF,U07JFX03KF,U07IFEX03KF,U07IFCX03KF,U07IF8X03KF,U0JFY03KF,:U0IFEY03KF,U0IFEY03KF8,U0IFCY07KF8,U0IFCY07KF,::U0IF8Y07KF,U07FF8Y07KF,U07FF8Y0LF,U07FF8Y07KF,:U07FFg07KF,U07FFK01M01JF007JFE,U07FFJ07FFCK07JF8C7JFE,U07FEJ0JFK0RFE,U07FEI07JFCJ0RFE,U07FEJ03JFI07RFE,U07FEI0FF93FF800SFE,U07FE1NF803FC1PFC,U03JFI03IFI0E7QFC,U03IFE001JFC07SFC,U03FFE3E3gGFC,U03EFC7gIF8,U03EFCgJF8,:U03FFCOF0TF8,U07FFC0MFC03SF8,U07F9C3FF77IFC03SFC,U07F9C3CK0D801SFC,U07FCCM01801FC80OFC,U03F8CK0601001FEC0PF,U03F8C00707803001DD7C07NF,U03FCC001FF003I0C01QF8,U01FC6M02I0C003PFC,U01FC6M06I0CI07FEF7KFC,U01FC7M04I06M07KFE,U01FC3M0CI07M0MF,U01FC18K018I038L0ELF8,V0F80FK0FJ01CL0CLFC,V0F800KFEJ01FCJ07DLFE,V0F8S0CLF1MF,V078S0C00FFC00MF,V07CS06M0MF,V03CR036L01MF8,V01CR03EL01MFC,W0CR03CL01MFC,W0CR03EL03MFE,W0CM08J01FL03MFE,W0CM08K07L07NF,W0CS038K0OF,W0CS038K0OF8,W0CS03K01OF8,W0ER012K03OF8,W0EK04L038K03OFC,W06K0C008I07CK07OFC,W07I077C03CI0FE02I0PFC,W07I07FC03E001FE03807PFE,W077807FC03F9F7FE03E3RF,W07FEIF803LF03TF,W07KF803LF03TF,W03KF803LF07TF,W03KF003LF0UF,W01JFE003LF1UFC,X0KF003gHFC,:X0KFE03gHFE,X07KF03gHFE,X07KF8gIFE,X07gPF,X07FDgNF,X07FCTFE7RF8,X07FC7SFESF8,X07FC007QFESF8,X03FEI0OFC3TFC,X03FFI03NF81TFC,X03FFM0KF01TFC,X03FF8L07IFE01TFE,X03FF8K0KFC03TFE,X01FFEK03KFC7UF,X01FFEK07KF8VF,X01FFEK03KF9VF,X01IFK03KF9VF8,X03IFJ01LF3VF8,X03IF8I03KFE7VF8,X03IF8I01KFC7VFC,X01IF8I03KFC7VFC,X03IF8J0KF8WFE,X03IF8J03JF1WFE,X03IFCJ01FF101WFE,X03IFCO03WFE,X03IFEO03XF,X03IFEO07XF,X03JFO07XF,:X03JF8N0YF8,X03JFCN0YF8,X03JFCM03YF8,X03KF8K03gF8,X03KFCK07gFC,X03LF00707gGFC,X03OFDgHFE,X03gRFE,X01gRFE,:X01gSF,::X01gSF8,X01gSFC,:Y0gSFC,:Y0gSFE,:Y0FBgRF,Y0F9gRF,:Y0F9gRF8,Y0783gQFC,:Y0703gQFC,Y0701gQFE,Y0701gRF,gH0gRF,gH07gQF8,gH03YFE1PF8,gH03gF03OFC,gH01gF00OFC,gI0gF007NFE,gI0YFEI0NFE,gI0YFEI03NF,gI07XFEJ07MF8,gI03XFCK0MFC,gJ0XF8K01LFC,gJ0WFEM03LF8,gJ07VFEN0LF8,gJ03VFCN01KFC,gJ01VF8O07JFC,gJ01UFCP01JFE,gJ01UF8Q03IFE,gK0UF8R0IFE,gK07SFES03IF08,gK07SFET0IF08,gK07SFET01IF8,gK07SFCU07FF,gK07RFX0F3,gK07QFEX03F8,gK07QF8X01F8,gK03QFg038,gK03PFEg018,gK01PFC,gK01PF,gL0OFE,gL0OF8,gL07NF,gL07MFE,gL03MFC,gL03MF8,gL07LFE,gL03LFC,gL01JFE,gM0JFC,gM03FFE,gN01F,,:::::::::::::::::::::::::::::::::::::::::::::::::::08,:04gM01JFC,04gL0MFC,02gK03K0IFE,02gS03F8,01gT07E,01gU07,01gV08,008hT08,008gV04W088,00CgV06W088,00EgV03W088,006gV01CV098,006gW0EV098,003gW0F8U0B8,003gW068T01F8,8018gP03IF0064T01F8,8058gN0E1KF832T01F8,8058gM01E3LF98R0301F8,C03CgM07EFE7KF8R0700F8,C01CgM0IFE7KFER0700F8,C05EgL01FE7DMF8P01F01F8,E05EgL03FF03MFCP01F81F8,E07EgL07FFDNFEP03F81F8,F07FgL07RF2O03F83F8,F07FgL0SF3O07F83F8,F87FgL0SF3O07F83F8,^FS^XZ");

// selected_printer.send("");

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

// selected_printer.send(test);

//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");

}

else

{

printerError(text);

}

});

};

function checkPrinterStatus(finishedFunction)

{

selected_printer.sendThenRead("~HQES",

function(text){

var that = this;

var statuses = new Array();

var ok = false;

var is_error = text.charAt(70);

var media = text.charAt(88);

var head = text.charAt(87);

var pause = text.charAt(84);

// check each flag that prevents printing

if (is_error == '0')

{

ok = true;

statuses.push("Ready to Print");

}

if (media == '1')

statuses.push("Paper out");

if (media == '2')

statuses.push("Ribbon Out");

if (media == '4')

statuses.push("Media Door Open");

if (media == '8')

statuses.push("Cutter Fault");

if (head == '1')

statuses.push("Printhead Overheating");

if (head == '2')

statuses.push("Motor Overheating");

if (head == '4')

statuses.push("Printhead Fault");

if (head == '8')

statuses.push("Incorrect Printhead");

if (pause == '1')

statuses.push("Printer Paused");

if ((!ok) && (statuses.Count == 0))

statuses.push("Error: Unknown Error");

finishedFunction(statuses.join());

}, printerError);

};

function hidePrintForm()

{

$('#print_form').hide();

};

function showPrintForm()

{

$('#print_form').show();

};

function showLoading(text)

{

$('#loading_message').text(text);

$('#printer_data_loading').show();

hidePrintForm();

$('#printer_details').hide();

$('#printer_select').hide();

};

function printComplete()

{

hideLoading();

alert ("Printing complete");

}

function hideLoading()

{

$('#printer_data_loading').hide();

if(default_mode == true)

{

showPrintForm();

$('#printer_details').show();

}

else

{

$('#printer_select').show();

showPrintForm();

}

};

function changePrinter()

{

default_mode = false;

selected_printer = null;

$('#printer_details').hide();

if(available_printers == null)

{

showLoading("Finding Printers...");

$('#print_form').hide();

setTimeout(changePrinter, 200);

return;

}

$('#printer_select').show();

onPrinterSelected();

}

function onPrinterSelected()

{

selected_printer = available_printers[$('#printers')[0].selectedIndex];

}

function showErrorMessage(text)

{

$('#main').hide();

$('#error_div').show();

$('#error_message').html(text);

}

function printerError(text)

{

showErrorMessage("An error occurred while printing. Please try again." + text);

}

function trySetupAgain()

{

$('#main').show();

$('#error_div').hide();

setup_web_print();

//hideLoading();

}

In the line number 146 I am passing the image that is converted on the http://labelary.com/viewer.html but the printer doesn't show up any image

please help me in resolving this