C# – Crystal Reports in a PDF file

asp.netccrystal-reportsvb.net

I am using the following code to output a Crystal Report to an ASP.NET application:

Dim rptDocument As New ReportDocument
Dim rptPath As String = Server.MapPath("Reports/Employees.rpt")

rptDocument.Load(rptPath)
Me.CrystalReportViewer1.ReportSource = rptDocument

Everything is working fine. My question is, is there a way to render the report as a PDF file instead of rendering to a crystalreportviewer?

I am using Visual Studio 2008 and Crystal Reports for Visual Studio 2008.

Best Answer

Yes, you can use ExportToHttpResponse. Set the ExportFormatType to PortableDocFormat. Check out this tutorial.