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.

    评论

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大