views:

3042

answers:

3

Is there a way to automatically print a SQL Server Reporting services (2005) report?

EDIT:

We needed to print a SSRS report at a network printer programmatically. Specifically, we wanted to fire this off from a stored procedure. We are currently using likeabanshee's method, and it is working. However, we would like something more managed, without the dependency on Adobe Acrobat and xp_cmdshell. We are looking into this method suggested by Paul G.

+1  A: 

If you use the Microsoft Business Intelligence Editor to create your SSRS, you can write code to fire off a print job.

Sheehan Alam
+3  A: 

You should be able to make that happen programmatically using the built-in web service to render the report. Some sample code for SSRS 2000 is here, but it should be pretty close to what you'd need for 2005 as well I think:

Paul G
That is exactly what I've been trying to find! Thanks
Felipe Fiali
+1  A: 

This question was posted by a co-worker for me. My comments and resolution follow:

Background: I essentially wanted to fire off SSRS reports to networked printers at our corporation through their UNCs. I have a real-time quality monitoring app (for an industrial manufacturing facility) running from SQL Server. As severe defects are detected I wanted to send a report to QA printers for them to analyze the defects. It also supplements our pager/email alerting system to stop problems as they are occuring.

Solution: I wrote a SQL stored procedure to monitor the quality failures. As they are detected, the stored procedure calls a .Net console app using xp_cmdshell, passing the product ID, UNC path, report name, Adobe Reader file path (on the SQL Server) and a few other parameters. Note the console app resides on the same server as the SQL Server. The console app accepts the paramters and passes them to SSRS with an output format of PDF. The PDF is created and saved locally, then the console apps runs a command line using Adobe Reader's hidden run mode (/t). The file path and UNC path are passed as parameters, and voila - automatic printing of SSRS files. An optional parameter tells the console app whether to delete the locally saved PDF.

ScottLenart