1

I have a script like the one below, This script is used to print data and QR code, I have succeeded with the data, and now I am still looking for how to display the QR code in print. I have tried using an html script but only the string appears, and also uses the java function, but it is still considered undefined. Please help me, how to generate qr code to display in print.

function print(o) {
    if (jspmWSStatus()) {
        //Create a ClientPrintJob
        var cpj = new JSPM.ClientPrintJob();
        //Set Printer type (Refer to the help, there many of them!)
        if ($('#useDefaultPrinter').prop('checked')) {
            cpj.clientPrinter = new JSPM.DefaultPrinter();
        } else {
            cpj.clientPrinter = new JSPM.InstalledPrinter($('#installedPrinterName').val());
        }
        //Set content to print...
        //Create ESP/POS commands for sample label
        var esc = '\x1B'; //ESC byte in hex notation
        var newLine = '\x0A'; //LF byte in hex 

        var cmds = esc + "@"; //Initializes the printer (ESC @)
        cmds += esc + '!' + '\x38'; //Emphasized + Double-height + Double-width mode selected (ESC ! (8 + 16 + 32)) 56 dec => 38 hex
        cmds += 'PRUDENTIAL'; //text to print
        cmds += newLine + newLine;
        cmds += esc + '!' + '\x00'; //Character font A selected (ESC ! 0)
        cmds += '<?=$qrcode?>';
        cmds += newLine + newLine;
        cmds += esc + '!' + '\x00'; //Character font A selected (ESC ! 0)
        cmds += 'ID : ' + '<?=$id?>';
        cmds += newLine;
        cmds += 'AGENT CODE : ' + '<?=$agent_code?>';
        cmds += newLine;
        cmds += 'NAME : ' + '<?=$agent_name?>';
        cmds += newLine;
        cmds += 'ACHIEVEMENT : ' + '<?=$achievement?>';
        cmds += newLine + newLine;
        cmds += esc + '!' + '\x18'; //Emphasized + Double-height mode selected (ESC ! (16 + 8)) 24 dec => 18 hex
        cmds += '# ITEMS SOLD 2';
        cmds += esc + '!' + '\x00'; //Character font A selected (ESC ! 0)
        cmds += newLine + newLine;
        cmds += '11/03/13  19:53:17';

        cpj.printerCommands = cmds;
        //Send print job to printer!
        cpj.sendToClient();
    }
} 

0 Answers0