使用Jquery或javascript将RTF文件打印到客户端的默认打印机

我正在根据用户提交的php web应用程序表单创建 .rtf </ code>文件。 直到这里没关系。</ p>

现在我需要在客户端默认打印机上静默打印此 .rtf </ code>文件,而不需要任何 rtf </ code>标签 它(当我们在MS-Word中打开 .rtf </ code>时,直接打印rtf文件)。</ p>

所以有任何脚本,使用javascript 或者jQuery这样做? 显示打印机对话框也适用于我。</ p>

任何人都可以通过示例向我推荐。 提前致谢。</ p>
</ div>

展开原文

原文

I am creating an .rtf file based on user submitted form for php web application. Until here it's fine.

Now I need to print this .rtf file on client side default printer silently without any rtf tags in it(print rtf file directly as it is as we have, when we open .rtf in MS-Word).

So is there any script, using javascript or jQuery to do this? Showing the printer dialog also works for me.

Can anyone please suggest me with examples. Thanks in advance.

1个回答



这将要求您的脚本到达浏览器沙箱之外并编写应用程序脚本以启动打印,因此无法使用 javascript和jQuery。</ p>

有几种方法可行:</ p>

首先,如果您将RTF转换为HTML unsing unoconv </ 代码>,然后通过javascript调用打印,允许您从浏览器打印,但它可能包括浏览器的默认页眉和页脚。</ p>

其次,但仅适用于Intranet 应用程序,您可以从Intranet区域降低ActiveX的安全设置,并将Word作为ActiveX控件运行:</ p>

  var msw = new ActiveXObject(“Word.Application”);

</ code> </ pre>

第三,再次对于Intranet,让服务器运行OpenOffice并打印到离用户最近的网络打印机。</ p>

考虑用例以及自动打印是否为最终用户增加了足够的价值 麻烦。 我从网上“打印”的大部分内容,实际上只是打印到PDF并存档到磁盘,大多数打印对话框都需要额外的鼠标点击才能将作业发送到打印机。</ p>
< / DIV>

展开原文

原文

This would require your script to reach outside of the browser sandbox and script the application to initiate printing, so it can not be done just using javascript and jQuery.

There are few approaches that might work:

First, if you converted the RTF to HTML unsing unoconv, and then called print via javascript, that would allow you to print from the browser, but it would probably include the browser's default headers and footers.

Second, but only for an Intranet application, you could lower the security settings for ActiveX from the Intranet zone, and run Word as an ActiveX control:

var msw = new ActiveXObject("Word.Application");

Third, again for an Intranet, have the server run OpenOffice and print to the network printer nearest the user.

Consider the use case and whether automatic printing adds enough value for the end users to be worth the extra hassle. Most of the things I "print" from the web, I actually just print to PDF and archive to disk, and most print dialog boxes require a few extra mouse clicks before sending the job to the printer anyway.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐