We need to print a report periodically from a windows service, we use .NET 2.0.
We have modules that produce this report as a PDF or as an HTML file, PDF would be better because we have better control over the look of the report.
We also have the username, password and the name of the printer selected for the task.
I searched and researched several options on how to print PDF files from windows service, namely using Acrobat Reader from command line and couldn't make it work.
Acrobat Reader seems to be unreliable and difficult to use, also we would need to guarantee it is intalled on our clients machines.
Do you have a solution for this, which may be in a third party component?
Thanks
views:
986answers:
5You may or may not have seen the question I asked about this here which may give you some hints if you are forced to use Acrobat after all.
Otherwise this commercial third party component will do what you want - abcpdf. It's thread-safe BTW.
P.S. You'll need the professional version because only the pro version supports rendering.
Are you able to execute the commandline tool? (e.q. are you using an Application NOT website (hta should also work))
If so, maybe using Crystal Reports (set export type to PDF) in conjunction with a free export tool (search for crexport on Google) is a good solution.
Also there are a lot of PDF export components for .NET, maybe writing your own commandline application would suffice?
This is a pretty common scenario I hear from our customers using ActiveReports to run the report and print it from the service. Another nice point about using ActiveReports, is that in addition to being able to print the report, you'll be able to save the same report as PDF, HTML, or Excel and not have to make any changes to the report.
Scott Willeke
Data Dynamics / GrapeCity
If you are using the Crystal Reports then you can use the Crystal Report's builtin option to print the report using the code like this.
oReport.PrintOptions.PrinterName = "PrinterName";
oReport.PrintToPrinter(1, true, 0, 0);
Or you can have another option listed here How to send raw data to a printer
We found this hidden pearl of open source library called pdfprint# that does exactly what we needed.
It seems it's based on XPDF which is an open source library in C++.
The author wrote in the forum that "The printer has to be post-script capable, the library sends raw postscript to the printer." and I wonder (and fear) how big of a problem this will be...
Thanks all for your help!