如何在C#中通过Window Services打印文档 [英] How to print Document through Window Services in C#

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

问题描述



谁能告诉我如何使用窗口服务打印文档.
问题是Printpage事件未执行.

我从msdn得到类似
Windows服务或ASP.NET应用程序或服务中不支持使用System.Drawing.Printing命名空间中的类.尝试从这些应用程序类型之一中使用这些类可能会产生意外问题,例如服务性能下降和运行时异常.
Windows服务或ASP.NET应用程序或服务中不支持使用该名称空间.那么有哪些可能的选择呢?

请帮帮我.
预先感谢..

Hi,

Can anybody tell me How to print a document using window services.
The problem is Printpage event is not executing.

i got from msdn something like
Classes within the System.Drawing.Printing namespace are not supported for use within a Windows service or ASP.NET application or service. Attempting to use these classes from within one of these application types may produce unexpected problems, such as diminished service performance and run-time exceptions.
the namespace is not supported for use within a Windows service or ASP.NET application or service. So what are the possible options ?

please help me out.
thanks in advance..

推荐答案

是的,但是看起来并不容易.我现在正在做一个项目,需要类似的东西,所以我做了一些研究.
首先,使用能够交互登录的技术用户进行打印-至少直到为此安装打印机为止.我想您可以临时模拟它,但是最好以它的名称运行应用程序池或服务.出于其他安全考虑,这也有好处.也可以用它的名字生成一个进程.
另请参见以下链接: http://stackoverflow.com/questions/416314/print-html-document-from-windows-service-in-c-sharp-without-print-dialog [ http://support.microsoft.com/kb/322091 [
Yes, but it looks not easy. I am on a project now and need the similar thing, so I have done some research.
First of all, print using a technical user able to log in interactively - at least until you install the printer for it. I suppose you can impersonate it temporary, but it is best to run the application pool or service in it''s name. This is also good for other security considerations. It is also possible to spawn a process in it''s name.
See also following link: http://stackoverflow.com/questions/416314/print-html-document-from-windows-service-in-c-sharp-without-print-dialog[^]. This might be also useful: http://support.microsoft.com/kb/322091[^]
I hope I have helped you, although I am not at the point where I could share my own experience.


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

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