Need Java Script Action for Printing a QR code image into local Printer

0
Hi There,          I’m trying to develop  one POS application, in that i need to print a Generated  QR code into a XPrinter. My QR code generation is fine and stored in a Entity which is inherited from the system.image . i need to pass that QR code image to the printer to print it. How its achievable kindly let men know. Thanks in Advance. 
asked
1 answers
1

Hi Dinesh,

Give this a shot and see if it suits your purpose ?

Create a nanoflow and a javascript action (with 2 parameters – image (object of System.Image) & width (int)) and the following code.

var imageSrc = mx.appUrl + 'file?guid=' + image.getGuid();

var imgHtml = "<img style='display:block;margin-left:auto;margin-right:auto;width:" + width + ";height:auto;' src='" + imageSrc + "'></img>";

var WindowObject = window.open('', 'PrintWindow', 'width=1200,height=800,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');

var strHtml = "<html><head></head><body onload='window.print();window.close()'><div>\n" + imgHtml + "\n</div>\n</body>\n</html>";

WindowObject.document.writeln(strHtml);
WindowObject.document.close();
WindowObject.focus();

 

answered