如何通过C#在Windows服务中打印文档? [英] How to print a document in windows service via C#?

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

问题描述

如何通过c#在Windows服务中打印文档?



我想打印PDF文档。我正在通过C#在Windows服务中开发相同的内容。我想要内置的dlls&如果没有(免费的第三方dll)也这样做。还想在App.Config中配置打印机设置。



我尝试过:



我想打印PDF文档。我正在通过C#在Windows服务中开发相同的内容。我想要内置的dlls&如果没有(免费的第三方dll)也这样做。还想在App.Config中配置打印机设置。

How to print a document in windows service via c#?

I want to print a PDF document . I am developing the same in Windows Service via C#. I want inbuilt dlls & if not (free third party dlls) to do the same. Also want to configure the printer settings in App.Config.

What I have tried:

I want to print a PDF document . I am developing the same in Windows Service via C#. I want inbuilt dlls & if not (free third party dlls) to do the same. Also want to configure the printer settings in App.Config.

推荐答案

也许您可以根据自己的需要调整此提示中的代码。



如何无声使用Adobe Reader和C#打印PDF [ ^ ]



如果您计划在服务器上使用它,它可能无法工作,因为它使用Acrobat Reader进行打印。



你也可以和Ghostscript一起尝试Redmon。

使用Redmon你可以创建一个虚拟机打印机端口,将打印机输出重定向到您自己的软件,弄乱它,然后将其发送到真正的打印机或其他软件。

Ghostscript可用于将PDF翻译成打印机语言。



这是一个o ld文章描述了这一点:

PDF Writer [ ^ ]

如果您遇到问题在你的计算机上创建一个端口,查看文章的评论部分。



我必须承认我自己没有尝试过这种方法。
Maybe you can adapt the code in this tip to suit your needs.

How to Silently Print PDFs using Adobe Reader and C#[^]

It will probably not work if you plan to use it on a server, though, as it is using Acrobat Reader for the printing.

You could also try Redmon together with Ghostscript.
With Redmon you can create a virtual printer port, redirect the printer output to your own software, mess with it and then send it to the real printer or another software.
Ghostscript can be used to translate PDF into printer language.

This is an old article that describes just that:
PDF Writer[^]
If you have problems to create a port on your computer look in the comment section for the article.

I have to admit I haven't tried this approach myself.


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

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