var printState = 0,LODOP = perCerPrintUtil.getLodop();
        LODOP.PRINT_INITA("0mm", 0, "210mm", "297mm", "陕西保安员证书打印");
        LODOP.SET_PRINT_MODE("BKIMG_IN_PREVIEW", 1);
        LODOP.ADD_PRINT_SETUP_BKIMG("<img border='0' src='" + restHost +  securityPic + "'+>");
        LODOP.SET_SHOW_MODE("BKIMG_LEFT", 0);
        LODOP.SET_SHOW_MODE("BKIMG_TOP", 0);
        LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "210mm");
        LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "297mm");
        LODOP.SET_SHOW_MODE("BKIMG_IN_PREVIEW", true);
        LODOP.SET_SHOW_MODE("BKIMG_PRINT", true);
        for (i = 0; i < detail.length; i += 2) {
            if(detail[i] != null && typeof(detail[i] != 'undefined')) {
                LODOP.NewPage();
                LODOP.ADD_PRINT_TEXT(260 + 36, 517, 133, 20, detail[i].xm);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(370, 518, 171, 56, detail[i].address == null ? '' : detail[i].address.substring(0, 9) + "\r\n" + detail[i].address.substring(9, detail[i].address.length));
                LODOP.SET_PRINT_STYLEA(2,"ReadOnly",0);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LineSpacing", 3);
                LODOP.ADD_PRINT_TEXT(334, 517, 163, 20, changeBirthFormat(getBirthdayFromIDNo(detail[i].idnum)));
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -1);
                LODOP.ADD_PRINT_TEXT(462, 541, 239, 20, detail[i].idnum);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -1);
                LODOP.ADD_PRINT_TEXT(360, 223, 200, 20, (detail[i].fzrq == null ? "" : changeBirthFormat(detail[i].fzrq.substring(0, 10))));
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -1);
                LODOP.ADD_PRINT_TEXT(462, 207, 186, 20, detail[i].zsbh);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -2);
                LODOP.ADD_PRINT_TEXT(145, 168, 111, 20, detail[i].xm);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                //照片
                if(detail[i].photo != null && detail[i].photo !="") {
                    LODOP.ADD_PRINT_IMAGE(138, 488, "26.00mm", "32.00mm", detail[i].photo);//+1
                }

                LODOP.SET_PRINT_STYLEA(0, "Stretch", 2);
                //二维码50
                LODOP.ADD_PRINT_IMAGE(182, 282, 99, 99,detail[i].qrcode);
                LODOP.SET_PRINT_STYLEA(0, "Stretch", 2);
            }
            if (detail[i + 1] != null && typeof(detail[i + 1] != 'undefined')) {
                LODOP.ADD_PRINT_TEXT(778, 517, 133, 20, detail[i + 1].xm);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(816, 518, 163, 20, changeBirthFormat(getBirthdayFromIDNo(detail[i + 1].idnum)));
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -1);
                LODOP.ADD_PRINT_TEXT(852, 518, 171, 56, detail[i + 1].address == null ? '' : detail[i + 1].address.substring(0, 9) + "\r\n" + detail[i + 1].address.substring(9, detail[i + 1].address.length));
                LODOP.SET_PRINT_STYLEA(12,"ReadOnly",0);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LineSpacing", 3);
                LODOP.ADD_PRINT_TEXT(945, 541, 239, 20, detail[i + 1].idnum);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -1);
                LODOP.ADD_PRINT_TEXT(627, 168, 111, 20, detail[i + 1].xm);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(842, 223, 200, 20, (detail[i + 1].fzrq == null ? "" : changeBirthFormat(detail[i + 1].fzrq.substring(0, 10))));
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -1);
                LODOP.ADD_PRINT_TEXT(945, 204, 186, 20, detail[i + 1].zsbh);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.SET_PRINT_STYLEA(0, "LetterSpacing", -2);
                //照片
                if(detail[i+1].photo != null && detail[i+1].photo !="") {
                    LODOP.ADD_PRINT_IMAGE(617, 488, "26.00mm", "32.00mm",detail[i + 1].photo);
                }
                LODOP.SET_PRINT_STYLEA(0, "Stretch", 2);//二维码
                //二维码50
                LODOP.ADD_PRINT_IMAGE(666, 282, 99, 99,detail[i + 1].qrcode);
                LODOP.SET_PRINT_STYLEA(0, "Stretch", 2);
            }
        }

        //直接打印返回逻辑真假结果（1或true代表真，false或0代表假），表示是否成功（关于进一步捕获打印状态参考样例45）；
        //打印维护和打印预览返回打印次数，大于0表示打印成功的次数；
        //谷歌浏览器
        if (LODOP.CVERSION) {
            CLODOP.On_Return = function (TaskID, Value) {
                //打印状态
                printState = Value;
                if(printState >= 1){
                    var snapshotIdArr=[];
                    var idArr=[];
                    for (i = 0; i < detail.length; i++) {
                        idArr.push(detail[i].securitypersonid);
                        snapshotIdArr.push(detail[i].snapshotId);
                    }
                    perCerPrintUtil.updatePrinted(idArr,snapshotIdArr);
                    $('#dataTable').datagrid('clearChecked');
                    //查询刷新
                    setTimeout("refresh();",1000);
                    setTimeout("layer.closeAll();",1500);
                }
            };
        }
        printState = LODOP.PRINT_SETUP();



				//非谷歌
        if (!LODOP.CVERSION) {
					if(printState >= 1){
            var snapshotIdArr=[];
                    var idArr=[];
                    for (i = 0; i < detail.length; i++) {
                        idArr.push(detail[i].securitypersonid);
                        snapshotIdArr.push(detail[i].snapshotId);
                    }
                    perCerPrintUtil.updatePrinted(idArr,snapshotIdArr);
                    $('#dataTable').datagrid('clearChecked');
                    //查询刷新
                    setTimeout("refresh();",1000);
                    setTimeout("layer.closeAll();",1500);
					}
        }