jquery打印


<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <%@ include file="../yuriy.jsp" %> <title>Packaged Composite System</title> <link href="<%=basePath%>static/print/printShou.css" rel="stylesheet" type="text/css" media="print"/> <script src="<%=basePath%>static/js/jquery-1.4.4.min.js"></script> <script src="<%=basePath%>static/print/jquery-migrate-1.2.1.min.js"></script> <script language="javascript" src="<%=basePath%>static/print/jquery.jqprint-0.3.js"></script> <script type="text/javascript"> function printBarcode() { $("#printDiv").jqprint({ debug: false, //如果是true则可以显示iframe查看效果(iframe默认高和宽都很小,可以再源码中调大),默认是false importCSS: true, //true表示引进原来的页面的css,默认是true。(如果是true,先会找$("link[media=print]"),若没有会去找$("link")中的css文件) printContainer: true, //表示如果原来选择的对象必须被纳入打印(注意:设置为false可能会打破你的CSS规则)。 operaSupport: false //表示如果插件也必须支持歌opera浏览器,在这种情况下,它提供了建立一个临时的打印选项卡。默认是true }); // blackPrint(); // closewin(); } function blackPrint(){ if(window.opener){ console.log(1); console.log(window.opener); var id=${empId}; if(id != null && id != "" && id != undefined){ window.opener.callback(id); } } } function closewin(){ self.opener=null; self.close(); } </script> </head> <body> <input type="button" value="print" onclick="printBarcode()"> <div id="printDiv" class="printDivClass" style="width: 600px;height: 400px;"> <img src="<%=basePath%>${barcodeUrl}" style="width: 600px;height: 246px; padding-top: 20px;"/> <p style="font-size: 24px;width: 600px;height: 50px;">${empName}_${companyName}</p> </div> </body> </html>

jquery打印

posted @ 2017-11-29 13:55  浅安  阅读(1168)  评论(0编辑  收藏  举报