For reporting purposes, I use Reportviewer control. But as you know it has a handicap that is you cannot print the report directly. To tackle this, I and one of my collegaues have developed a solution for this problem. The solution is to use the Print job ActiveX of the ReportServer in the report page.
I am not going to tell much about the details since this is a known issue. The page is as following;
<html>
<head>
<object id="RSClientPrint" classid="CLSID:FA91DF8D-53AB-455D-AB20-F2F023E498D3" codebase="http://myAppUrl/RSClientPrint.cab" viewastext></object>
<script type="text/javascript">
function Print(reportid) {
RSClientPrint.Authenticate = false;RSClientPrint.Print('http://myAppUrl/ReporGenerator.aspx?Param=PuUfK1YXSlAWfq4MFTcM9w%3d%3d', 'reportId=' + reportid, 'Rapor'); }
</script>
</head>
<body>
<form name="aspnetForm" method="post" action="Rapor.html" id="aspnetForm"> .......
<input type="button" value="Bas" onclick="Print('f956661a-501e-402e-9849-551ca88ea72f');" />
................
</form>
</body>
</html>
Here, the key point or key element is the RsClientPrint ActiveX. This object is used by ReportServer.
But unfortunatelly a few days ago one of our clients reported that the print function was not working. When you clicked on the Print Button, you got an Javascript error saying "object does not support this function" or something like that. The source of the problem was the ActiveX object. After some investigation I have found that an update with code KB956391 broke down the ActiveX. I have tried different ways as described in; http://www.technologystudio.net/blog/post/Microsoft-Update-KB956391-breaks-Reporting-Services-ReportViewer.aspx. Uninstalling then reinstalling, cleaning related registry and reinstalling etc. All of them was successfull but when you update the system the problem re-occurs. This means that there is a conflict between the ActiveX and the update, I mean you cannot use this ActiveX no more because it is not compatible no more.
Anyway, I have begun to find a newer version of the ActiveX that is compatible with this update. (The logic is simple; if the old one is unuseful there must be one that is useful :) As Microsoft cannot say "you cannot print your reports anymore", they must have the solution. So, the Report Server 2005(SP1) should have to overcome this problem, too. With this thought in my mind, I have searched the report server folder and found a newer version of the ActiveX at location; "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin". After making the below changes in the application in order to use the new activex, the problem dissapeared.
SOLUTION:
- Uninstall the old ActiveX if exists in C:\WINDOWS\Downloaded Program Files\ folder. (Actually you dont need to do this, I mean it is not a must but in case...)
- Replace the older RSClientPrint.cab file in your application(where the codebase points to) with the new one(the cab file you get from the report server 2005 folder mentioned somewhere above).
- Lastly, chage the CLSID of the Object as 41861299-EAB2-4DCC-986C-802AE12AC499 (old clsid was;FA91DF8D-53AB-455D-AB20-F2F023E498D3)
After these changes when you open your report page ActiveX Installation window should popup. But it may have been installed before by another application. So if the installation windows does not popup don't panic just try to print :) if the print window opens it' s OK, if not then check out the above steps or something I have forgotten :). After succesfully accomplishing this, your clients will begin to use the new ActiveX "RSClientPrint 2005 Class". That' s all.
For diagnostic purposes, here is the properties of the old and the new ActiveX objects.
| |
Old ActiveX |
New ActiveX |
| FileName |
RSClientPrint.cab |
RSClientPrint.cab |
| Class Name |
RSClientPrint Class |
RSClientPrint 2005 Class |
| CLSID |
{FA91DF8D-53AB-455D-AB20-F2F023E498D3} |
{41861299-EAB2-4DCC-986C-802AE12AC499} |
| Version |
2005.90.1399.0 |
2005,90,3073,0 |
| Version of the rsclientprint.dll included |
2005.90.1399.0 |
2005,90,3073,0 |
| Version of the gdiplus.dll included |
5.2.3790.1830 |
5.1.3102.3352 |
| |
|
|
!!! I do not attach the new "RSClient 2005 Class" ActiveX because of the License Agreement things ... If you have a licensed Report Server you can install the related SP1 (if not did yet) then you have the new ActiveX in your hands-computer- legally !!!