最近客户要求做一个打印功能,本想在直接用window.print();直接打印出来,感觉不是很满意。于是发现利用active控件打印还是不错。现将源码附上,以供以后项目参考。相信大家一家源码就明白了,相当简单,我在这里就不多废话了。
css控制打印区域代码如下所示:
<style>
@media print {
.noprint {
display: none
}
}
</style>
这里是打需要打印的内容.<span class="noprint">我只显示不打印哦,很神奇吧。哈哈</span>
<div class="noprint" >
<table style="margin:0 auto;width:500px;">
<tr align="center" ><td>
<object id="WebBrowser" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height="0"
width="0">
</object>
<input type="button" value="打印" onclick="document.all.WebBrowser.ExecWB(6,1)">
<input type="button" value="页面设置" onclick="document.all.WebBrowser.ExecWB(8,1)">
<input type="button" value="直接打印" onclick="document.all.WebBrowser.ExecWB(6,6)">
<input type="button" value="打印预览" onclick="document.all.WebBrowser.ExecWB(7,1)">
</td></tr>
</table></div>
分享到:
相关推荐
html调用打印实现打印 <input class="b" name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=...<input class="b" name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印>
4.<INPUT onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印 name=Button> 5.<INPUT onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置 name=Button4> 等等
vb6_Webbrowser控件使用技巧 1、获得浏览器信息: Private Sub Command1_Click() WebBrowser1.Navigate "http://www.applevb.com" End Sub Private Sub Command2_Click() Dim oWindow Dim oNav Set oWindow ...
页面设置和打印预览如下所示,直接调用即可document.all.WebBrowser.ExecWB(6,6) 直接打印document.all.WebBrowser.ExecWB(8,1) 页面设置document.all.WebBrowser.ExecWB(7,1) 打印预览或者:execScript("document....
完整获取webBrowser1的Cookie HttpOnly的Cookie
document.all.WebBrowser.ExecWB(6,6) 直接打印 document.all.WebBrowser.ExecWB(8,1) 页面设置 document.all.WebBrowser.ExecWB(7,1) 打印预览 3 隐藏不打印的页面元素和分页 CSS 有个Media 属性,可以分开...
iewebbrowser组件的execwb方法IEWebBrowser组件的execWB方法整理。 1. <object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object> 2. 调用方法。 WebBrowser....
WebBrowser.Document.InvokeScript()方法声称提供了一种与WebBrowser HTML文档中JavaScript代码进行交互的方法。 但是,试图弄乱我无法控制的第三方JavaScript(意思是:包含在我无法更改的外部网页中),...
c# 桌面应用 WebBrowser 是IE浏览器内核,目前很多网站不支持了,从国外网站找到一个 谷歌内核的WebBrowser 名字叫 EO.WebBrowser ,比较好用,本文档是他的帮助文档。
EO.WebBrowser免安装dll.C# VB直接饮用版本,你懂得
INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1> 2.<INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2> 3.<INPUT ...
NuGet Gallery | EO.WebBrowser for .NET 16.2.37 https://www.nuget.org/packages/EO.WebBrowser/ 出自 .NET Google 浏览器内核 Eo.Webbrowser | Flyヽ Blog http://lfei.org/net-eo-webbrowser/
无缝集成chrome浏览器引擎和.net的强大功能; 在Windows中增加浏览器容量。表单和WPF应用程序只需通过拖放; 还支持“无头”模式,没有UI,完美的数据抓取/自动化; 支持.net Framework 2.0及以上,.net Core 3.0及以上...
利用IE内置打印控件IEWebBrowser进行打印.
VB.net捕获整个网页并保存成图像有软件 Private Sub GetImage() If WebBrowser1.Document Is Nothing Then Return End If Try Dim scrollWidth As Integer Dim scrollHeight As Integer scrollHeight = ...
使用WebBrowser控件打印页面demo,通过修改demo中的几行代码就可以使用
邮箱登录器 使用WebBrowser.Document获取hao123.com网页的元素而成.
MvvmCross WebBrowser插件 提供用于显示网页的跨平台UI。安装使用软件包管理器安装此库。 Install-Package SByteDev.MvvmCross.Plugins.WebBrowser用法using SByteDev . MvvmCross . Plugins . WebBrowser ;await ...
vs2010+CSerialPortv4.1.0.201010+webbrowser控件实现百度地图(在线和离线)定位
VB编程WebBrowser控件开发经典代码Classic VB programming code WebBrowser Control Development