JavaWeb开发,使用WebBrowser控件调用打印机打印页面

  1. <!--media=print 这个属性说明可以在打印时有效-->  
  2. <!--打印时不显示的内容,class="Noprint"-->  
  3. <!--人为设置分页的位置,class="PageNext"-->  
  4.     <style media="print">  
  5.     .Noprint{display:none;}  
  6.     .PageNext{page-break-after:always;}  
  7.     </style> 
  1. <!--IE内置打印控件IEWebBrowser-->                
  2. <OBJECT id="WebBrowser" height="0" width="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">   
  3. </OBJECT>   
  4. <input onclick="document.all.WebBrowser.ExecWB(7,1)" class="Noprint" type="button" value="打印预览">  
  5. <input onclick="document.all.WebBrowser.ExecWB(8,1)" class="Noprint"  type="button" value="页面设置">   
  6. <input onclick="document.all.WebBrowser.ExecWB(6,6)" class="Noprint" type="button" value="直接打印"

猜你喜欢

转载自blog.csdn.net/javawutuobang/article/details/79076855