Automatically Printing Crystal Reports in ASP.NET
My second Crystal Alliance article was published today:
Automatically Printing Crystal Reports in ASP.NET
source: http://aspalliance.com/509
Unlike the Windows Forms CrystalReportViewer toolbar, the web-based CrystalReportViewer toolbar does not include a print button. For reports that are directly rendered as HTML, the user can simply use the browser's print button. For reports rendered as PDF or Excel, the user can use the print functionality in either the Acrobat Reader or Excel to print the report.
Most users can figure out how to print the report, but some still need a little help, and in some cases, clients request this as part of their application specs. In this article, we'll review two methods for automatically printing a Crystal Report using the web-based CrystalReportViewer: the server side ReportDoucment.PrintToPrinter method, and a small client-side JavaScript that uses the window.print method. We'll also discuss rendering a report in PDF and allowing the user to print that document as an alternative to the two other methods. Because of the disconnected nature of web client applications, and security considerations, there isn't a perfect way to make every web-based Crystal Report automatically print. But, under certain conditions, we can provide this functionality in user-friendly ways.