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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步