web print
<!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
web print的更多相关文章
- 遭遇Web print
一直都知道Web打印还不太成熟,以前IE横行时,普遍都是采用打印相关的ActiveX控件,有些国产厂家做得不错,只是那时还没有付费能力,没有太多关注.而纯粹基于Web标准的打印,浏览器对CSS pri ...
- 多页面打印--web print
背景:项目中要求做在一个页面中通过选择网址来打印多个页面的内容的功能 原理:通过iframe把各网址的页面内容加载进来,通过iframe.contentWindow拿到iframe的window对象, ...
- 纯手撸web框架
纯手撸web框架 一.Web应用的组成 接下来我们学习的目的是为了开发一个Web应用程序,而Web应用程序是基于B/S架构的,其中B指的是浏览器,负责向S端发送请求信息,而S端会根据接收到的请求信息返 ...
- python 代码片段7
#coding=utf-8 #列表 book=['python','development',8] book.append(2008) print book book.insert(1,'web') ...
- python批量下载
# -*- coding: utf-8 -*-__author__ = 'Administrator'from PyQt4.Qt import *from PyQt4.QtCore import *f ...
- awk详解
一.简介 强大的文本分析工具,基于指定规则浏览和抽取信息.简单来说awk就是把文件逐行的读入,以空格为默认分隔符将每行切片,切开的部分再进行各种分析处理.awk有3个不同版本: awk.nawk和ga ...
- Python爬虫(十)_正则表达式
本篇将介绍python正则表达式,更多内容请参考:[python正则表达式] 什么是正则表达式 正则表达式,又称规则表达式,通常被用来检索.替换那些符合某个模式(规则)的文本. 正则表达式是对字符串操 ...
- 正则 re模块
Python 正则表达式 re 模块 简介 正则表达式(regular expression)是可以匹配文本片段的模式.最简单的正则表达式就是普通字符串,可以匹配其自身.比如,正则表达式 ‘hello ...
- python 基础语法练习回顾
#!/usr/bin/python# -*- coding: UTF-8 -*-import timeimport calendar student = {"age": 7,&qu ...
随机推荐
- 第二十六节:复习Java语言基础-Java的概述,匿名对象,封装,构造函数
Java基础 Java语言概述 Java语言 语言 描述 javaee 企业版 javase 标准版 javame 小型版 JDK JDK(Java开发工具包) Java语言 语言 Java语言 Ja ...
- Java学习笔记45(多线程二:安全问题以及解决原理)
线程安全问题以及解决原理: 多个线程用一个共享数据时候出现安全问题 一个经典案例: 电影院卖票,共有100座位,最多卖100张票,买票方式有多种,网上购买.自主售票机.排队购买 三种方式操作同一个共享 ...
- Web开发经验谈之F12开发者工具/Web调试[利刃篇]
引语:如今的整个Web开发行业甚至说整个软件开发行业,已经相当成熟,基本上已经很少找不到没有前人做过的东西了,或者换句话说,你想要实现的功能,你总能在某个地方搜索到答案,关键是你有没有这个时间精力去搜 ...
- python 变量进阶(理解)
变量进阶(理解) 目标 变量的引用 可变和不可变类型 局部变量和全局变量 01. 变量的引用 变量 和 数据 都是保存在 内存 中的 在 Python 中 函数 的 参数传递 以及 返回值 都是靠 引 ...
- django 模型关系
模型关系 关系数据库的威力体现在表之间的相互关联,Django提供了三种最常见的数据库关系:多对一 (many-to-one),多对多(many-to-many),一对一(one-to-one) 多对 ...
- Fiddler怎样抓取手机的包
Fiddler作为代理服务器,可以拦截到手机发出的请求,再经过Fiddler发送到服务器,获取到服务器响应的数据,这个过程,只要设置配置好了,使用过程不受影响. 要想抓取到手机的包,先要给手机设置一个 ...
- HDU 6022---MG loves set(K-D树)
题目链接 Problem Description MG is an intelligent boy. One day he was challenged by the famous master ca ...
- Jpush极光推送的一些心得
在集成极光推送的时候,test完全正常.部署到服务器后只发送一条推送之后推送不继续发送.经排查: 2018-06-28 10:24:26.394 [ThreadPoolTaskExecutor-4] ...
- rsync排除多个文件实现同步
首先创建exclude目录放入xx.list排除文件. [root@localhost tmp]# cat /exclude/a_exclude.list a.txt lai ———————————— ...
- 第五章:Android布局
View的布局显示方式有下面几种:线性布局(Linear Layout).相对布局(Relative Layout).表格布局(Table Layout).帧布局(FrameLayout).绝对布局( ...