从.NET服务打印NET

2023-09-02 01:46:15 作者:不美不萌不温柔

我工作的一个项目,现在,涉及从另一个应用程序接收消息,格式化该消息的内容,并将其发送到打印机。选择的技术是C#窗口服务。输出可以被称为一个报告,我想,但报告引擎是没有必要的。一个简单的模板引擎,StringTemplate的一样,甚至XSLT输出HTML就可以了。我遇到的问题是找到一个免费的方式,从服务打印此类型的输出。由于它的似乎的,它会工作,我正在使用微软的RDLC原型,填充本地报表,然后渲染它作为一个图像到内存流,我会再打印。与该问题有:

I am working on a project right now that involves receiving a message from another application, formatting the contents of that message, and sending it to a printer. Technology of choice is C# windows service. The output could be called a report, I suppose, but a reporting engine is not necessary. A simple templating engine, like StringTemplate, or even XSLT outputting HTML would be fine. The problem I'm having is finding a free way to print this kind of output from a service. Since it seems that it will work, I'm working on a prototype using Microsoft's RDLC, populating a local report and then rendering it as an image to a memory stream, which I will then print. Issues with that are:

在多页印刷将是一个大伤脑筋。 还是要用的PrintDocument打印内存流,这是不支持在Windows服务(尽管它可能工作 - 还没有得到那么远与原型还) 如果将数据通过变化来了,我必须要改变的数据集,并且该数据被反序列化到类。不好不好不好。

有没有人有远程做这样的事?任何建议?我已经提出了一个问题有关,而无需用户输入的打印HTML,并在该浪费大约3天之后,我得出的结论是,它不能做的,至少不会有任何免费的工具。

Has anyone had to do anything remotely like this? Any advice? I already posed a question about printing HTML without user input, and after wasting about 3 days on that, I have come to the conclusion that it cannot be done, at least not with any freely available tool.

所有帮助AP preciated。

All help is appreciated.

编辑:我们是在.NET Framework 2.0版

We are on version 2.0 of the .NET framework.

推荐答案

相信我,你会花更多的钱,试图寻找/开发了一个解决方案相比,购买一个第三方组件。不要重新发明轮子,去的支付解决方案。

Trust me, you will spend more money trying to search/develop a solution for this as compared to buying a third party component. Do not reinvent the wheel and go for the paid solution.

印刷是一个复杂的问题,我很乐意看到时更好的框架支持,增加了对这一新的一天。

Printing is a complex problem and I would love to see the day when better framework support is added for this.