Printing a PDF from a Windows service

2020-07-18 05:58发布

With C#, how can I print a PDF document (without any dialog boxes in the background) to an indicated printer?

3条回答
我想做一个坏孩纸
2楼-- · 2020-07-18 06:32

I have used the following PDF library in the past to perform batch printing of PDF documents from a C# Windows Service.

http://www.quickpdflibrary.com/

It's a pretty decent library and if I remember correctly it only took a few lines of code to print the document. It worked very well and saved me a consider amount of time.

Also, the recommended link that discusses using DDE to launch a desktop application on a server to perform the printing is a bad idea. Adobe Reader probably doesn't support this and since it is a desktop application running in a windowless session you may run into problems with message boxes and dialog boxes. That solution just doesn't scale in my humble opinion.

查看更多
甜甜的少女心
4楼-- · 2020-07-18 06:58

Disclaimer: I work for Atalasoft

If you don't want to depend on Acrobat being on the server, you need to rasterize the PDF pages yourself and send them to the printer using the normal .NET printing API. We have a product that can rasterize PDF that uses the Foxit engine underneath. It deploys as a normal .NET assembly and doesn't require any other software to be installed.

查看更多
登录 后发表回答