When developing ASP.NET applications that use the Microsoft SQL Server Reporting Services 2005 (SSRS) to display and print reports, you will face a problem when you want to provide a direct print functionality to user outside the traditional Web Report Viewer. This article will describe how to use the RsClientPrint ActiveX control provided by Microsoft to print SSRS reports inside custom ASP.NET applications.
Note that this article doesn’t include any samples to download; only code snippets and scenario descriptions will be included.
If you Googled through the web regarding printing options for SSRS reports, you will be left with three probable options:
- When your report is rendered in multiple pages, the pages will not print in correct format. You will have pages that don’t break correctly due the web browser printing margins settings and other printing problems because the browser will print it as an HTML page.
- The web browser headers and footers will be displayed in the printout. You can guide users to remove the web browser headers and footers when using your print functionality. (Users will hate this.)
- Printing landscape reports will require users to change their print settings every time they want to print a report with landscape orientation.
- Export the report to another format that can be used for printing. E.g. PDF or Microsoft Excel. The odds are:
- User must have PDF or Excel viewer to print the reports.
- Print operation will be tedious since the user needs to do many steps to just print the report.
- Use the RsClientPrint ActiveX control. This is a good solution to sends the reports directly to the printer. The odds are:
- User must use Internet Explorer as web browser to support ActiveX controls. Also you can write Firefox extension for this task.
- The Microsoft documentation is very short (don’t expect so much information from Microsoft MSDN regarding using RsClientPrint .
- If you follow the Microsoft documentation, you will face a problem with SSRS authentication as we are going to discuss through this article.
In this article, I will describe how to use the RsClientPrint in an efficient way and implement the same functionality provided in Microsoft Reports Web Viewer printing.
The RsClientPrint is an ActiveX control. This control should be registered to clients PCs before we can use it.
The RsClientPrint control contains several properties and one method. Please refer to Microsoft RsClientPrint for more information here .
Here is the list of the control properties and methods borrowed from MSDN site above: