在C#中静默打印pdf [英] print pdf silently in c#

查看:726
本文介绍了在C#中静默打印pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Adobe Reader静默打印pdf。
我从以下位置获取了示例:

I am trying to print pdf silently using adobe reader. I have taken the example from the following location:

http://www.codeproject.com/Tips/598424/How-to-Silently-Print-PDFs-using-Adobe-读者-和

我可以根据需要在本地主机中使用上述示例代码。

I am able to work as desired with the above example code in my localhost.

但是当我在服务器上部署应用程序时,我无法打印PDF。

But when I deploy my application on the server,I am unable to print the PDFs.

在本地主机上的按钮单击事件中,我正在创建PDF和将其保存到一个位置并进行打印。打印Adobe窗口会打开并打印PDF,然后自动退出。

In my localhost on button click event,I am creating the PDFs and saving it to one location and printing the same.While printing adobe window opens and prints the PDFs and exits automatically.

在我的服务器中无法正常使用。我是能够创建和保存PDF,但是adobe无法打开和打印我的文件。我什至没有遇到任何异常/错误。它只是没有显示adobe窗口。

The same doesn't work in my server.I am able to create and save PDFs,but adobe is not opening and printing my file.I am not even getting any exception/error.It simply doesn't show up adobe window.

没有人遇到同样的问题。
在这方面的任何帮助。
预先感谢。

Did anyone face the same issue. Any help in this regard. Thanks in advance.

推荐答案

可以使用Acroread命令行参数或PDF JavaScript实现静音打印。事件处理程序(当然,如果您的PDF生成器工具可以定义/注入PDF的OpenAction处理程序)。

A silent printing can be achieved with an Acroread command line parameters or with a PDF JavaScript event handler (of course, if your PDF producer tool has a possibility to define/inject PDF's OpenAction handler).

请参见 http://pd4ml.com/cookbook /pdf_automated_printing.htm

使用JavaScript方法,您不必绑定到打印机驱动程序,网络名称或IP地址。另一方面,例如,可以通过公司安全策略禁用Acroread中的JavaScript。

With the JavaScript approach you are not bound to a printer driver, network name or IP address. On the other hand, JavaScript in Acroread can be disabled, for example, by a corporate security policy.

这篇关于在C#中静默打印pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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