//调试logger
function logger(msg) {
    document.getElementById("logger").innerHTML = msg;
}

//小票打印
function printInfo() {
    logger('打印信息');


    var poem = [{"info": "将进酒", "cutPaperType": 0, "alignType": 1, "textSize": 0},
        {"info": "君不见，黄河之水天上来，奔流到海不复回。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "君不见，高堂明镜悲白发，朝如青丝暮成雪。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "人生得意须尽欢，莫使金樽空对月。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "天生我材必有用，千金散尽还复来。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "烹羊宰牛且为乐，会须一饮三百杯。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "岑夫子，丹丘生，将进酒，杯莫停。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "与君歌一曲，请君为我倾耳听。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "钟鼓馔玉不足贵，但愿长醉不复醒。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "古来圣贤皆寂寞，惟有饮者留其名。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "陈王昔时宴平乐，斗酒十千恣欢谑。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "主人何为言少钱，径须沽取对君酌。", "cutPaperType": 0, "alignType": 0, "textSize": 0},
        {"info": "五花马，千金裘，呼儿将出换美酒，与尔同销万古愁。", "cutPaperType": 1, "alignType": 0, "textSize": 0}];


    var data = JSON.stringify(poem);
    send_command(
        "printerPrintInfo",
        data,
        function (receivedData) {
            logger(receivedData);
        });
}


//打印二维码
function printQr() {
    logger('打印二维码');

    var ewm = document.getElementById('ewm').value;
    // var ewm=$('#ewm').val();

    var qr = {"qrString": ewm, "cutPaperType": 1, "alignType": 1};

    var data = JSON.stringify(qr);
    send_command(
        "printerPrintQr",
        data,
        function (receivedData) {
            logger(receivedData);
        });
}

//打印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qUdLGBDMJjK0RJY185H5SZaFcb0Ed00w0IGDEp8jS3H2VxeausyB/U4YIXYZQXXd98zvm R8/nYsqFnYXQ5b+sdZiMLYupeWx0k829MvP2mqpFZIGX1TAxJU/s1S19GWmonovnBFupK8rS49OU FsT1wowISdbQnDkclm1AtAmWYmaUaH+p02ZzG1DMkhg3SSrtcjQln55WrQdaW94q9ABovQWB3dRq vSsDTKoqbOUFcH1diMMik5Dl9LXOMwra5pJGxwxyQpaAdpJG0IjZmXmvi/xC1OYLND/fnsz7eUBU apyMXl0QYej4CTmCn8goaJxMsUzrtrzZW+/CrRD0AxmSxsm5g7tAsp+YZYhfr4r6n7IZItaychml isaQbHSMGOFVvtScaNA6azRilp+N22Ly/Fjh6zA3GEiWiKUdNUuMxsvpQScoM1W0jtY8GMKXq2Nb u6z6XSEA0WAZPCxhD8L2ebW9LXwiGzng94tsrvzZ2UdyUOWDE6g59wurvY78pIY4WJpTv+zt9R+J n3GYUUG+0AAAAABJRU5ErkJggg==" };

function printbitma() {
    logger('打印图片');
    var data = JSON.stringify(photo);
    send_command(
        "printBitmap",
        data,
        function (receivedData) {
            logger(receivedData);
        });
}

//打图片列表
photos =[{"Num": 1,"Imgstr": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAHpUlEQVR4Xu1bTVYbRxCuGhjBxsTZ 5b0YApsgVoETBJ/A8gkCJzA+gfEJjE8QfAKLE1g+gcUKko1lyXkvuwixiafRVF71/HX39PwyI3ix 2fgl6umu/rqquqr6K4SSf3/+6O7SEj4hon35CWLwL8AIiEYIMCLw+93J/KzklLWG/bG+1ANwnhDA JiBuAv/Lf0SDQCwc4JzOfv5LDMssgEWDLtbdA0R8ES9U9AELQXTauRbPt6YwLTG8cMjFD7DpuO4L QjwoHJwMGCHQ8fZYvMn7JhOAi0fL++g4v1fZuL4QTRHwZHvsvawgdGroxUbnGIGeAeDDmvOMyPcP dz7fSA0x/6wAhKfOm9f+COAT+tQnhCGrffyj4+wjw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A0WAZPCxhD8L2ebW9LXwiGzng94tsrvzZ2UdyUOWDE6g59wurvY78pIY4WJpTv+zt9R+J n3GYUUG+0AAAAABJRU5ErkJggg==" },
    {"Num": 1,"Imgstr": "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAB+klEQVRYR8WWjTEEQRSEeyNwIkAE yOBkQARkgAgIgQiQwYmADBABIkAE1Dc1b2t2zO7O/r+qrbuqm3nd06979gotXMXC+FqawGopAmtJ V5IO5iZgwHuSNnMSOJV0Jgnga0n3ki7mIAAwgChtwOb7G0nfU43AgH8kAcSJ43qG1NgEDPjTnxiQ uvqSdDgWgS7AEFpJgkAxhABNzr2Z3jJOHCpBGvDEug+BIcBGwiWAZHQhEAI/enO9tlzlKPSA26N1 LgG5JoyBke4j4x1C7lnLSWMCmBMSmyYFdv11eSyJE+cCww1QQJh1SiUMeMRvKQIGzAmQrwsw4Ox/ kXRZk/8yASwOCRjwib+nuwJbvJ4CxVKTQhXkRyVHIATmBzNIxpj/LbmTtC2JsdUVCYCEWwMBDLLl 5bqtmVkOGRozNprHpgv3oyzlPm0EsDFWv95AvC4xX06xn/seWdsSUiYg9oAB0YSGPDveD2yCTOpk rGfueKfp7rf+736tS0fbRYQ/jAzfecLC0YCTFryTUyhc4rYRaGuI7Ps+001ztz6VBOQo0EYAyVEB EnjGfFNHBpOaoq73UAXcnwqfHBqTBPNNysSVBIxJIDSf+YbTxmQqCZiKQDg2I4MymI9xVdIy1ghy 4mfxtjGM6oEcAklDz6nAJARwPm7vXUMV6A1sG/8Au2B/YByuHAIAAAAASUVORK5CYII=" }];

function printbitmas() {
    logger('打印图片列表');
    var data = JSON.stringify(photos);
    send_command(
        "printBitmap_list",
        data,
        function (receivedData) {
            logger(receivedData);
        });
}

//打印文件


function printfile() {
    // var filenum = document.getElementById('FileNum').value;
    // var filepages = document.getElementById('FilePages').value;
    //
    // if (filenum === ''){
    //     filenum=1;
    // }
    // if (filepages === ''){
    //     filepages=1;
    // }

    var testfile=[{"FileNum": 1,"FileInfo": "D:\\testdoc.doc" ,"FilePages":1},{"FileNum": 1,"FileInfo": "D:\\testpdf.pdf" ,"FilePages":1}];

    logger('打印文件');
    var data = JSON.stringify(testfile);
    send_command(
        "printFile_list",
        data,
        function (receivedData) {
            logger(receivedData);
        });
}


//清空打印列表
function clears() {
    logger('清空打印列表');
    send_command
    (
        "printerClear",
        "",
        ""
    );
}
