views:

375

answers:

1

Hi, How can we show the SSRS 2005 report in the pdf format when clicked on the link for print preview?

A: 

Two ways come to mind. One is achieving what you ask for, the other one is better.

To achieve what you ask for, you need to derive from the ReportViewer class and handle the event raised for "Print Preview" before the Microsoft code does. In the handler, you would render the report as PDF and present the resulting stream to the client. If we are talking about the ReportViewer web control, there may be some tweaking of auto-generated client-side JavaScript code involved. If we're talking about the ReportViewer WinForms control, you might also look into messing with the control's toolbar buttons and event handlers.

The better way is to have a separate link or button to invoke the PDF rendering. If your not a 100% satisfied with the ReportViewer's toolbar, you can always hide it and show your own.