Chrome 静默打印及其它启动参数

此方法只能在客户端设置,浏览器本身不提供权限通过JS控制打印机

 

 

在地址栏敲: about:flags ,打开设置界面:

停用(无此选项则跳过):Enable Print Preview Registration Promos Windows, Linux, Chrome OS

 

Chrome快捷方式增加:

--kiosk-printing

 

 

这样就可以静默,打印,直接使用默认打印机进行打印。

 

另:如需是Chrome全屏+静默打印: 使用 --kiosk --kiosk-printing

 

 

其它一些参数:

序号 参数 说明

0 --purge-memory-button 在Chrome的任务管理器中增加内存清理功能 

1 --allow-outdated-plugins 不停用过期的插件。

2 --allow-running-insecure-content 默认情况下,https 页面不允许从 http 链接引用 javascript/css/plug-ins。添加这一参数会放行这些内容。
3 --allow-scripting-gallery 允许拓展脚本在官方应用中心生效。默认情况下,出于安全因素考虑这些脚本都会被阻止。
4 --disable-accelerated-video 停用 GPU 加速视频。
5 --disable-dart 停用 Dart。
6 --disable-desktop-notifications 禁用桌面通知,在 Windows 中桌面通知默认是启用的。
7 --disable-extensions 禁用拓展。
8 --disable-file-system 停用 FileSystem API。
9 --disable-preconnect 停用 TCP/IP 预连接。
10 --disable-remote-fonts 关闭远程字体支持。SVG 中字体不受此参数影响。
11 --disable-speech-input 停用语音输入。
12 --disable-web-security 不遵守同源策略。
13 --disk-cache-dir 将缓存设置在给定的路径。
14 --disk-cache-size 设置缓存大小上限,以字节为单位。
15 --dns-prefetch-disable 停用DNS预读。
16 --enable-print-preview 启用打印预览。
17 --extensions-update-frequency 设定拓展自动更新频率,以秒为单位。
18 --incognito 让浏览器直接以隐身模式启动。
19 --keep-alive-for-test 最后一个标签关闭后仍保持浏览器进程。(某种意义上可以提高热启动速度,不过你最好得有充足的内存)
20 --kiosk 启用kiosk模式。(一种类似于全屏的浏览模式)
21 --lang 使用指定的语言。
22 --no-displaying-insecure-content 默认情况下,https 页面允许从 http 链接引用图片/字体/框架。添加这一参数会阻止这些内容。
23 --no-first-run 跳过 Chromium 首次运行检查。
24 --no-referrers 不发送 Http-Referer 头。
25 --no-sandbox 彻底停用沙箱。
26 --no-startup-window 启动时不建立窗口。
27 --proxy-pac-url 使用给定 URL 的 pac 代理脚本。(也可以使用本地文件,如 --proxy-pac-url="file:\\\c:\proxy.pac")
28 --proxy-server 使用给定的代理服务器,这个参数只对 http 和 https 有效。(例如 --proxy-server=127.0.0.1:8087 )
29 --single-process 以单进程模式运行 Chromium。(启动时浏览器会给出不安全警告)
30 --start-maximized 启动时最大化。
31 --user-agent 使用给定的 User-Agent 字符串

参数:--user-data-dir=UserDataDir
用途:自订使用者帐户资料夹(如:–user-data-dir="D:\temp\Chrome User Data")
参数:--process-per-tab
用途:每个分页使用单独进程
参数:--process-per-site
用途:每个站点使用单独进程
参数:--in-process-plugins
用途:插件不启用单独进程

参数:--disable-popup-blocking
用途:禁用弹出拦截
参数:--disable-javascript
用途:禁用JavaScript
参数:--disable-java
用途:禁用Java
参数:--disable-plugins
用途:禁用插件
参数:–disable-images
用途:禁用图像
参数:--omnibox-popup-count=”num”
用途:将网址列弹出的提示选单数量改为num个
参数:--enable-vertical-tabs
用途:调整chrome游览器标签存放在左边,非顶部
来源:http://blog.lihaixin.name/2010/08/chrome-command-line-parameter.html
            http://code.google.com/p/xiaody/wiki/ChromiumCommandLineSwitches
   http://tieba.baidu.com/p/685173694

   http://www.cnblogs.com/sinceyou/articles/4834929.html

转载于:https://www.cnblogs.com/whoami3/p/10147746.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【利用WebBrowser彻底解决Web打印问题(包括后台打印) 】利用WebBrowser彻底解决Web打印问题(包括后台打印)BS架构下的打印大家是怎么解决的呢,我最近作了一个项目正好负责这一块,不仅要求打印页面的特定部分,还要求有后台的批量打印,在网上查了一些资料,最后终于解决了。抱着“取之于众 服务于众”的思想,我总结了一下,把它拿到网上来与大家分享,希望能帮助遇到类似问题的朋友。我主要使用了IE内置的WebBrowser控件,无需用户下载和安装。WebBrowser有很多功能,除打印外的其他功能就不再赘述了,你所能用到的打印功能也几乎全部可以靠它完成,下面的问题就是如何使用它了。先说显示后打印,后面说后台打印。1.首先引入一个WebBrowser在需要打印的页面,可以直接添加:到页面,或者使用JavaScript在需要的时候临时添加也可以:document.body.insertAdjacentHTML("beforeEnd","");2 .页面设置打印预览如下所示,直接调用即可document.all.WebBrowser.ExecWB(6,6) 直接打印document.all.WebBrowser.ExecWB(8,1) 页面设置document.all.WebBrowser.ExecWB(7,1) 打印预览或者:execScript("document.all.WebBrowser.ExecWB 7, 1","VBScript");3 隐藏不打印的页面元素和分页CSS 有个Media 属性,可以分开设置打印和显示的格式。如 … 中间的格式将只在打印时起作用,不会影响显示界面。所以可以设定.Noprint{display:none;}.PageNext{page-break-after: always;}然后给不想打印的页面元素添加: class="Noprint" ,那就不会出现在打印打印预览中了。想分页的地方添加: 就可以了。4.打印页面的特定部分我是通过将需要打印的特定部分另建一个页面,然后装入主页面的一个IFrame中,再调用IFrame的打印方法,只打印IFrame中的内容实现的。如:下面的pringFrame js函数将只打印Iframe中的内容,可以直接引用使用,如printFrame(FrameId);window.print = printFrame;// main stufffunction printFrame(frame, onfinish) {if ( !frame ) frame = window;function execOnFinish() {switch ( typeof(onfinish) ) {case "string": execScript(onfinish); break;case "function": onfinish();}if ( focused && !focused.disabled ) focused.focus();}if (( frame.document.readyState !== "complete") &&( !frame.document.confirm("The document to print is not downloaded yet! Continue with printing?") )){execOnFinish();return;}var eventScope = printGetEventScope(frame);var focused = document.activeElement;window.printHelper = function() {execScript("on error resume next: printWB.ExecWB 6, 1", "VBScript");printFireEvent(frame, eventScope, "onafterprint");printWB.outerHTML = "";execOnFinish();window.printHelper = null;}document.body.insertAdjacentHTML("beforeEnd","");printFireEvent(frame, eventScope, "onbeforeprint");frame.focus();window.printHelper = printHelper;setTimeout("window.printHelper()", 0);}// helpersfunction printIsNativeSupport() {var agent = window.navigator.userAgent;var i = agent.indexOf("MSIE ")+5;return parseInt(agent.substr(i)) >= 5 && agent.indexOf("5.0b1") < 0;}function printFireEvent(frame, obj, name) {var handler = obj[name];switch ( typeof(handler) ) {case "string": frame.execScript(handler); break;case "function": handler();}}function printGetEventScope(frame) {var frameset = frame.document.all.tags("FRAMESET");if ( frameset.length ) return frameset[0];return frame.document.body;}Iframe中所装载页面的打印效果在所装载页面设置就可以了,如分页等。5.后台打印我是通过建一个隐藏Iframe实现的,当然仍然会有页面装载的过程。下面的函数创建Iframe装载页面并打印。如 printHidden(url) //url为页面地址function printHidden(url) {document.body.insertAdjacentHTML("beforeEnd","");var doc = printHiddenFrame.document;doc.open();doc.write("");doc.write("");doc.write("");doc.close();}function onprintHiddenFrame() {function onfinish() {printHiddenFrame.outerHTML = "";if ( window.onprintcomplete ) window.onprintcomplete();}printFrame(printHiddenFrame.printMe, onfinish);}它用到了printFrame,所以别忘了引用前面的函数。总之,WebBroswer已经为我们提供了解决方案,我们只要结合需求把它应用好就行了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值