静音打印从浏览器 [英] Silent Print From Browser

查看:285
本文介绍了静音打印从浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经研究在过去的几天这么多,给了我足够的头这个问题。我试图做到的,是使用打印按钮可以从网上直接打印。我不希望浏览器弹出打印出现。将有贴在我的web应用程序2打印机和自动我想要的打印机的选择。

我知道这是不可能的PHP或没有任何浏览器插件或Active X的插件。

我也想到了一个解决方案,使用网络套接字发送打印请求,而一个java客户端的Socket应用程序安装在用户系统。

请给我建议任何节约时间解决我的问题。


解决方案
我已经研究过了Chrome扩展,火狐狸插件
- Faizan阿夫扎尔03月28日15:54在 < /块引用>

在上面的评论,你提到你已经看过了Chrome扩展和火狐浏览器安装,但已经有禁用打印对话框内置到这些浏览器的功能。
如果你正在做的Web应用程序将在受控环境(用于管理其浏览器来访问它,他们是如何配置的),你可以很容易做到这一点。


运行的浏览器首先,转到镀铬://设置/ 和更改主页的Web应用程序。接下来,为您的桌面上的Chrome浏览器快捷方式,然后右​​击它打开属性窗口。在目标输入字段中,添加 --kiosk --kiosk印刷来的位置结束。应用更改,请关闭所有浏览器窗口,然后单击快捷方式。这应该让你在全屏幕(Kiosk模式),当您尝试T打印,它会自动无弹出窗口的默认打印机上打印显示。

火狐
在Firefox上,转到 about:config中并同意任何警告消息。然后,右键单击页面上,并创建了新建 - >布尔。它会提示您输入名称和状态。对于名称,输入 print.always_print_silent ,并为国家,它设置为true。然后,你将需要保存更改并重新启动已打开,任何Firefox窗口。如果您尝试打印的东西,它将不再需要要显示的弹出式窗口,将默认的打印机上自动打印。

无论使用哪种这些浏览器以这种方式配置的,你可以使用标准 window.print(); JavaScript的方法来打印,而无需任何服务器端的交互的搜索结果。
批处理文件?的结果
如果您想更简单的方式来做到这些,你可以使用这两个命令提示符脚本将自动配置和/或运行它们,以满足您的需求:搜索结果 < BR>

  CD程序文件(x86)\\谷歌\\铬\\应用
的chrome.exe --kiosk --kiosk印刷

火狐:的结果

 在FOR / D %% G(%APPDATA%\\ Mozilla的\\火狐\\ Profiles文件\\ *。默认)DO SET教授= %%摹
CD%教授%
回声用户_ preF(print.always_print_silent,真正的);&GT;&GT; prefs.js
CD \\ ..
CD程序文件(x86)\\ Mozilla Firefox浏览器
firefox.exe

I have researched so much in the last few days and have given my enough head in that issue. What I'm trying to achieve is to print directly from web using a print button. I don't want to browser print popup to appear. There will be 2 printers attached to my web application and I want the printer selection automatically.

I know that it is not possible with PHP or without any browser extension or active x plugin.

I also thought a solution to send the print request using web sockets while a java socket client application installation over the user system.

Please suggest me any time saving solution to my problem

解决方案

I've looked into the chrome extensions, fire fox addon
- Faizan Afzal Mar 28 at 15:54

In the above comment, you mentioned that you've looked into Chrome extensions and FireFox addons, however there is already the functionality built into these browsers to disable the print dialog.
If the web application you're making will be run in a controlled environment (where you manage which browsers access it and how they're configured), you can fairly easily do this.

Chrome
Firstly, go to chrome://settings/ and change your home page to the web application. Next, make a shortcut for the Chrome browser on your desktop then right click on it to open the properties window. In the 'Target' input field, add --kiosk --kiosk-printing to the end of the location. Apply the changes, close all Chrome windows and click on the shortcut. This should put you in full screen (kiosk mode) and when you attempt t print, it should automatically print on the default printer without a pop-up window being displayed.

FireFox
On FireFox, go to about:config and agree to any warning messages. Then, right click somewhere on the page and create a "New -> Boolean". It will prompt you for a name and a state. For the name, enter print.always_print_silent and for the state, set it to true. Then you will need to save changes and restart any FireFox windows you have open. If you attempt to print something, it will no longer require the pop-up window to be displayed and will automatically print on the default printer.

With either of these browsers configured in this way, you can use the standard window.print(); JavaScript method to print without needing any kind of server-side interaction.

Batch Files?
If you'd like an easier way to do these, you can use these two command prompt scripts which will automatically configure and/or run them to suit your needs:

Chrome:

cd Program Files (x86)\Google\Chrome\Application
chrome.exe --kiosk --kiosk-printing

FireFox:

FOR /D %%G in ("%APPDATA%\Mozilla\Firefox\Profiles\*.default") DO SET prof=%%G
cd %prof%
echo user_pref("print.always_print_silent", true);>>prefs.js
cd \..
cd Program Files (x86)\Mozilla Firefox
firefox.exe

这篇关于静音打印从浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆