且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2021-07-28 04:23:19

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



如何无声使用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.