<!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的更多相关文章

  1. 遭遇Web print

    一直都知道Web打印还不太成熟,以前IE横行时,普遍都是采用打印相关的ActiveX控件,有些国产厂家做得不错,只是那时还没有付费能力,没有太多关注.而纯粹基于Web标准的打印,浏览器对CSS pri ...

  2. 多页面打印--web print

    背景:项目中要求做在一个页面中通过选择网址来打印多个页面的内容的功能 原理:通过iframe把各网址的页面内容加载进来,通过iframe.contentWindow拿到iframe的window对象, ...

  3. 纯手撸web框架

    纯手撸web框架 一.Web应用的组成 接下来我们学习的目的是为了开发一个Web应用程序,而Web应用程序是基于B/S架构的,其中B指的是浏览器,负责向S端发送请求信息,而S端会根据接收到的请求信息返 ...

  4. python 代码片段7

    #coding=utf-8 #列表 book=['python','development',8] book.append(2008) print book book.insert(1,'web') ...

  5. python批量下载

    # -*- coding: utf-8 -*-__author__ = 'Administrator'from PyQt4.Qt import *from PyQt4.QtCore import *f ...

  6. awk详解

    一.简介 强大的文本分析工具,基于指定规则浏览和抽取信息.简单来说awk就是把文件逐行的读入,以空格为默认分隔符将每行切片,切开的部分再进行各种分析处理.awk有3个不同版本: awk.nawk和ga ...

  7. Python爬虫(十)_正则表达式

    本篇将介绍python正则表达式,更多内容请参考:[python正则表达式] 什么是正则表达式 正则表达式,又称规则表达式,通常被用来检索.替换那些符合某个模式(规则)的文本. 正则表达式是对字符串操 ...

  8. 正则 re模块

    Python 正则表达式 re 模块 简介 正则表达式(regular expression)是可以匹配文本片段的模式.最简单的正则表达式就是普通字符串,可以匹配其自身.比如,正则表达式 ‘hello ...

  9. python 基础语法练习回顾

    #!/usr/bin/python# -*- coding: UTF-8 -*-import timeimport calendar student = {"age": 7,&qu ...

随机推荐

  1. bash编程-cut、printf

    1. cut cut命令用于从行中截取字符串. SYNOPSIS cut OPTION... [FILE]... ** OPTION** -d CHAR:以指定的字符为分隔符(不要用空格作为分隔符): ...

  2. 迁移桌面程序到MS Store(5)——.NET Standard

    接下来的几篇,我想讨论下迁移桌面程序到MS Store,可以采用的比较常见.通用性比较强的实施步骤和分层架构. 通常商业项目一般都是不断的迭代,不太可能突然停止更新现有的桌面版本,然后花很长时间从头来 ...

  3. 11.webview、shareSDK

    布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:la ...

  4. js中的行为委托和无类编程

    概述 <你不知道的JavaScript>中有这么一段话:不幸的是,将类和继承的设计模式思维带入Javascript的想法是你所做的最坏的事情,因为语法可能会让你迷惑不已,让你以为真的有类这 ...

  5. php cli模式和浏览器访问下加载php.ini文件的注意事项[架构篇]

    使用wampserver或Xampp时,会将配置文件放在一个统一的目录中去调用,这时如果都使用浏览器访问,自然是没有问题的,但是如果换成cli命令行模式运行,则会出现加载了的扩展无法使用的问题. 案例 ...

  6. itext7知识点研究(PDF编辑)

    取出pdf文档文字 String sourceFolder2 = "E:\\picture2\\租赁合同2.pdf"; PdfDocument doc = new PdfDocum ...

  7. 声反馈抑制使用matlab/simulink仿真

    第一份工作时做啸叫抑制的仿真,调大0.3可以有大的啸叫产生,下图的SIMULINK仿真模型 实现移相有多种方法: 1.iir实现 2.FFT实现 3.使用FIR实现 所有信号均可以由正弦信号叠加而成.

  8. python语法基础-初始化/继承

    写了一些程序,基本上都是直接def函数 然后在main方法中 调用 但是在一些应用程序中 会有基本语法的使用(初始化,继承) 初始化: 1.在程序执行时一定执行一次的操作 2.python中初始化in ...

  9. 使用Chrome开发者工具调试Android端内网页(微信,QQ,UC,App内嵌页等)

    使用Chrome开发者工具调试Android端内网页(微信,QQ,UC,App内嵌页等) 前言 移动端页面调试一直是好多朋友头疼的问题,iOS 由于其封闭的特性和整体较高的性能,整体适配相对好做,调试 ...

  10. JAVA中的COPYONWRITE容器

    Copy-On-Write简称COW,是一种用于程序设计中的优化策略.其基本思路是,从一开始大家都在共享同一个内容,当某个人想要修改这个内容的时候,才会真正把内容Copy出去形成一个新的内容然后再改, ...