dsbfbz75185 2012-10-09 00:25
浏览 103

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

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条回答

  • duanlu5055 2012-10-09 01:38
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试