printFinal用法示例

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!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='width: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

posted @   有梦就能实现  阅读(286)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示