Showing Reports in PDF Format
This tutorial expands on Rendering Multiple Reports by allowing the user to view the report in PDF format using the ShowPDF method. It consists of three simple steps:
1. From the Toolbox, double-click the Button control to add it to the Web form and set its Text property to PDF.
2. Double-click the PDF button to add an event handler for the Click event. The Code Editor will open with the insertion point placed within the event handler.
3. Insert the following code:
C1WebReport1.ShowPDF()
• C#
C1WebReport1.ShowPDF();
Note that this code redirects the browser to show the current report in Adobe's Portable Document Format (PDF).
Run the project and observe the following:
In a few seconds, the browser will come back showing the report. Click the PDF button to see the PDF version of the current report right on you page.
Click the browser's Back button to return to the application, select a different report, and click the PDF button again.
Notice that PDF reports are also cached, so if you view them again they will come back very quickly.
|