<html>
<head>
<script>
function doPrint() {
myDoc = {
documents : 'getpages.jsp', // 取得被打印页面,里面有 page1,page2...,参照楼下
copyrights : '杰创软件拥有版权 www.jatools.com'
};
getJatoolsPrinter().print(myDoc, false); // 直接打印,不弹出打印机设置对话框
}
function getJatoolsPrinter(){
return navigator.userAgent.match(/(msie\s|trident.*rv:)([\w.]+)/i)?document.getElementById('ojatoolsPrinter'): document.getElementById('ejatoolsPrinter');
}
</script>
</head>
<body>
<input type="button" value="打印" onClick='doPrint()'>
<!-- 插入打印控件 -->
<object id="ojatoolsPrinter" codebase="jatoolsPrinter.cab#version=5,4,0,0"
classid="clsid:B43D3361-D075-4BE2-87FE-057188254255" width="0" height="0">
<embed id="ejatoolsPrinter" type="application/x-vnd.jatoolsPrinter"
pluginspage="http://print.jatools.com/jatoolsPrinter.xpi" width="0" height="0"
/>
</object>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<html>
<body bgcolor="#E5E5F2">
<div id=page1>第一页</div>
<div id=page2>第一页</div>
</body>
</html>
欢迎光临 杰表技术论坛 (http://jatools.com/) | Powered by Discuz! 6.1.0 |