当前位置:编程学习 > JAVA >>

java jsp页面启动IE浏览器打印功能

需要注意的是:(internet安全选项中自定义级别那里需要启用没有标记为安全的ActiveX控件)那里需要启用没有标记为安全的ActiveX控件)
样式:
<style media=print>
    .Noprint{display:none;}
    .PageNext{page-break-after: always;}
</style>

jsp页面:
<center class="Noprint" >
    <p>
        <OBJECT  id="WebBrowser"  classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2  height=0  width=0>
        </OBJECT>
        <br/><br/><br/>
        <input  type=button  value=打印预览  onclick=document.getElementById("WebBrowser").ExecWB(7,1)>  


        <input  type=button  value=打印     onclick=document.getElementById("WebBrowser").ExecWB(6,1)>  


        <input  type=button  value=直接打印  onclick=document.getElementById("WebBrowser").ExecWB(6,6)>  


        <input  type=button  value=页面设置  onclick=document.getElementById("WebBrowser").ExecWB(8,1)>  


        <font color="red" >(请使用IE浏览器打印操作)</font>
input   name=Button   onClick=document.all.WebBrowser.ExecWB(1,1)   type=button   value=打开>
 
<input   name=Button   onClick=document.all.WebBrowser.ExecWB(2,1)   type=button   value=关闭所有>

<input   name=Button   onClick=document.all.WebBrowser.ExecWB(4,1)   type=button   value=另存为>
<input
   name=Button   onClick=document.all.WebBrowser.ExecWB(10,1)   type=button   value=属性>

<input   name=Button   onClick=document.all.WebBrowser.ExecWB(17,1)   type=button   value=全选>

<input   name=Button   onClick=document.all.WebBrowser.ExecWB(22,1)   type=button   value=刷新>

<input   name=Button   onClick=document.all.WebBrowser.ExecWB(45,1)   type=button   value=关闭>
    </p>
    <hr align="center" width="90%" size="1" noshade>
</center>


作者:feixiangdexin123087
补充:Web开发 , Jsp ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,