var LODOP; /* 注册按键 */ //var keyDownHook = new KeyBehaviorHook('keydown'); //keyDownHook.Regist(window.Keys.S, "document.getElementById('btnSetPrint').click()", window.WithKey.Alt); //Alt+S 设置(SetPrint) //keyDownHook.Regist(window.Keys.L, "document.getElementById('btnLook').click()", window.WithKey.Ctrl); //Ctrl+L 预览(Look) //keyDownHook.Regist(window.Keys.P, "document.getElementById('btnPrint').click()", window.WithKey.Ctrl); //Ctrl+P 打印(Print) //keyDownHook.Regist(window.Keys.Q, "document.getElementById('btnQuit').click()", window.WithKey.Ctrl); //Ctrl+Q 退出(Quit) /* if(!-[1,]) keyDownHook.Regist(window.Keys.S, "document.getElementById('btnSaveAs').click()", window.WithKey.Ctrl); //Alt+S 另存为(SaveAs) */ $(function () { var thehead = document.getElementsByTagName('head')[0]; var sitelocation = GetRootUrl(); var appendingObj = document.createElement('script'); appendingObj.type = 'text/javascript'; appendingObj.src = sitelocation + 'js/common/LodopFuncs.js'; thehead.appendChild(appendingObj); appendingObj = document.createElement('link'); appendingObj.type = 'text/css'; appendingObj.rel = 'stylesheet'; appendingObj.src = sitelocation + 'common/PrintSample10.css'; thehead.appendChild(appendingObj); // var titles = document.getElementsByTagName('title'); // if (titles.length > 0) thehead.removeChild(titles); //清空title // keyDownHook.Binding(); $("#div_tool").html(toolHtml); // document.getElementById('btnPrint').focus(); // window.wbb = document.getElementById('WebBrowser'); }) var toolHtml = " " + ""; function closeWindow() { if (top.Dialog) { try { top.Dialog.close(); } catch (ex) { } } else { window.close(); } } /* 开始打印方法 */ function OnPrint() { if ($("#div_tool").attr("spe") == "corOrint") { //PrintCorOrIntLetters(); } document.getElementById('div_tool').style.display = 'none'; if (window.printBeginCallBack && 'function' == typeof (window.printBeginCallBack)) try { window.printBeginCallBack(); } catch (e) { } } /* 打印结束方法 */ function OnPrintOver() { document.getElementById('div_tool').style.display = ''; if (window.printOverCallBack && 'function' == typeof (window.printOverCallBack)) try { window.printOverCallBack(); } catch (e) { } $(".warning").remove(); } /* 打印 */ var printStyle = ""; var printContent = ""; function SetPrintPar(style, content) { printStyle = style; printContent = content; } function Preview() { OnPrint(); try { LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM')); if ((LODOP == null) || (typeof (LODOP.VERSION) == "undefined")) return; var div_tool = document.getElementById('div_tool'); var printparams = div_tool.getAttribute('printparams'); if (!printparams) { // alert("1"); // LODOP.SET_PRINT_PAGESIZE(0, 1700, 1200, "A4"); } else { printparams = printparams.toString().split(','); LODOP.SET_PRINT_PAGESIZE(parseInt(printparams[0]), parseInt(printparams[1]), parseInt(printparams[2]), printparams[3]); } if ($("#div_tool").attr("issideways") == "true") { LODOP.ADD_PRINT_TABLE(30, 30, "95%", "90%", $(document.documentElement).html()); LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1); } else if ($("#div_tool").attr("issideways") == "printinfo") { var Oldhtml = ""; if (printStyle != "" && printStyle != undefined && printContent !== "") { Oldhtml = printStyle + "" + printContent + ""; LODOP.ADD_PRINT_HTM(30, 30, "95%", "90%", Oldhtml); } else { $(".warning").remove(); //alert($(document.documentElement).html()); LODOP.ADD_PRINT_HTM(30, 30, "95%", "90%", $(document.documentElement).html()); } } else{ var Oldhtml = ""; if (printStyle != "" && printStyle != undefined && printContent !== "") { Oldhtml = printStyle + "" + printContent + ""; LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", Oldhtml); } else { $(".warning").remove(); //alert($(document.documentElement).html()); LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", $(document.documentElement).html()); } } LODOP.PREVIEW(); } catch (e) { //alertMsg('异常信息:' + e.message); } OnPrintOver(); }