web print
2018-06-24 00:01:43来源:未知 阅读 ()
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="description" content="Responsive HTML5 and CSS3 site templates designed by @ajlkn." />
<meta name="keywords" content="html5, css3, responsive, site template, website template" />
<meta name="apple-mobile-web-app-title" content="HTML5 UP" />
<style type="text/css" media="screen">
#divPrint
{
background-color:#ffffff;
font-size:20px;
}
#tab
{
height:100px;
width:400px;
border:5px solid #000000;
}
.style1
{
height: 50px;
border:5px solid #000000;
}
</style>
<script type="text/javascript">
function CallPrint(strid) {
var prtContent = document.getElementById(strid);
var WinPrint = window.open('', '', 'letf=0,top=0,width=850,height=800,toolbar=0,scrollbars=1,status=0');
WinPrint.document.write('<html><head><title>Popup 涂聚文</title>') //自定义标题
WinPrint.document.write('</head><body>');
WinPrint.document.write('</body></html>');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print(); //没有网址内容
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="btnPrint" type="button" value="Print" runat="server" onclick="javascript:CallPrint('divPrint')"/>
<div id="divPrint">
<table id="tab">
<tr id="tcss">
<td class="style1">Your controls </td>
<td class="style1"> 打印的内容</td>
</tr>
<tr id="tcss">
<td class="style1">涂聚文<br /></td>
<td class="style1">天下为公</td>
</tr>
</table>
</div>
</form>
</body>
</html>
function print1()
{
if (navigator.appname == "microsoft internet explore")
{
var printcommand = '<object id="printcommandobject" width=0 height=0 classid="clsid:8856f961-340a-11d0-a96b-00c04fd705a2"></object>';
document.body.insertadjacenthtml('beforeend', printcommand);
document.all.printcommandobject.execwb(6,-1);
printcommandobject.outerhtml = "";
}
else {
window.print();
}
}
</script>
<button onclick=print1()>Try it</button>
2-this is second code which i tried
<script>
function btn_print_onclick() {
factory.printing.header = "This is MeadCo";
factory.printing.footer = "Printing by ScriptX";
factory.printing.portrait = false;
factory.printing.leftMargin = 1.0;
factory.printing.topMargin = 1.0;
factory.printing.rightMargin = 1.0;
factory.printing.bottomMargin = 1.0;
factory.printing.Print(false);
}
</script>
</head>
<body>
<button onclick="btn_print_onclick()">Print report</button>
</body>
https://www.codeproject.com/questions/1013399/silent-print-from-client-side-ie
https://www.codeproject.com/articles/24089/create-activex-in-net-step-by-step
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:vue插件编写与实战
- 高效Web开发的10个jQuery代码片段 2020-02-15
- web如何实现页面分页打印 2020-02-14
- 详解Webstorm 新建.vue文件支持高亮vue语法和es6语法 2020-02-07
- JSP session配置对web应用的影响 2019-12-27
- 详解node.js进行web开发的操作方法 2019-12-14
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
