zoukankan      html  css  js  c++  java
  • printFinal用法示例

    printFinal是一个基于jQuery的打印插件,支持打印预览,使用很简单,废话不多多说,直接上代码。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>printFinal 实现打印功能</title>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="../jquery.printFinal.js"></script>
    <link rel="Stylesheet" type="text/css" href="css.css" />
    
    
    <script language="javascript" type="text/javascript"> 
        $(function(){ 
    	  function print(preview){
    	     $("#content").printFinal({
    							preview: preview,//打印预览
    							impcss: true//引入css文件						 
                               });
    	  
    	  }
    
          $("#printbtn").click(function(){//打印按钮
    	            print(false);   
    	  });
    
    	  $("#previewbtn").click(function(){//预览按钮
    	            print(true);   
    	  });
    
    }); 
    </script> 
    
    
    
    </head>
    
    <body>
    <div >
    <div class='content'  id='content' style='400px;height:200px;overflow:hidden;border:2px solid blue;'>
              要打印的内容
    
    </div>
    
    <input type='button' name='previewbtn' id='previewbtn' value='预览' />
    <input type='button' name='printbtn' id='printbtn' value='打印' />
     
    <br>
     printFinal是一款基于jQuery的打印插件。支持打印预览。目前版本1.0,作者JsonZou。
     <br>下载地址:
        <br/>github:<a href='https://github.com/jsonzou/jquery-printFinal'     target='_blank'>https://github.com/jsonzou/jquery-printFinal</a>
    	<br/>oschina:<a href='http://www.oschina.net/p/printfinal'     target='_blank'>http://www.oschina.net/p/printfinal</a>
    
    
     </div>
    </body>
    </html>

    预览界面截图:

    以上就是示例所有,打印就是这么简单。

    软件下载:

    github:https://github.com/jsonzou/jquery-printFinal oschina:http://www.oschina.net/p/printfinal

  • 相关阅读:
    Nodejs Express4.x学习笔记
    OSG学习 错误与心得
    Qt Visual Studio Add-in安装
    OSG安装配置
    钩子
    不要去追一匹马,用追马的时间种草
    intellij Idea 报jdk错误
    flex 安全沙箱问题
    webuploader
    文件上传下载
  • 原文地址:https://www.cnblogs.com/firstdream/p/7660963.html
Copyright © 2011-2022 走看看