请问JAVA里如何实现打印功能

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:32:16
就是有一个文件,点这个按钮就打印到纸上

简单点就调用window.print()

你也可以把下面代码放到你JSP中:
<html>
<head>
<title>M</title>
<style type="text/css">

.table{
text-align:center;
}

</style>

<style media="print">
.Noprint{display:none;}
.PageNext{page-break-after: always;}
</style>
</head>
<body>
<center class="Noprint">
<p>
<object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
width="0">
</object>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)">
<input type="button" value="直接打印" onclick="