第一步 导入lodopfuncs.js
第二步 导入js头 <script language="javascript" type="text/javascript" src="${ctxStatic}/common/LodopFuncs.js"></script>
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop64.exe"></embed>
</object>
第三部 js方法
function myPreview() {
LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
LODOP.PRINT_INIT("");
var strStyle_title='<style> span{font-family:"微软雅黑"}</style>';
var strStyle='<style> span{font-family:"微软雅黑"} p.txt{font-size:10.5pt;text-align:center}</style>';
LODOP.ADD_PRINT_HTM(30,"0%","100%",300,strStyle_title+document.getElementById("div1").innerHTML);
LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
LODOP.PRINT_INIT("");
var strStyle_title='<style> span{font-family:"微软雅黑"}</style>';
var strStyle='<style> span{font-family:"微软雅黑"} p.txt{font-size:10.5pt;text-align:center}</style>';
LODOP.ADD_PRINT_HTM(30,"0%","100%",300,strStyle_title+document.getElementById("div1").innerHTML);
LODOP.PREVIEW();
};
};
具体js 方法的使用 参考官方API