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]);
}
$(".warning").remove();
var printaaa = $(".printtable");
for (var i = 0; i < printaaa.length; i++) {
for (var j = 0; j < printaaa.length; j++) {
if (i == j) {
$(".printtable" + (j + 1)).show();
} else {
$(".printtable" + (j + 1)).hide();
}
}
LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", $(document.documentElement).html()); /*$(this).html()*/
LODOP.PRINT();
}
for (var j = 0; j < printaaa.length; j++) {
$(".printtable" + (j + 1)).show();
}
//alert($(document.documentElement).html());
} catch (e) {
//alertMsg('异常信息:' + e.message);
}
OnPrintOver();
}