Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Programmatically Create PDF from Crystal Report

Hi,

Some times when working with crystal report viewer you do not want to show the report to user in raw format but instead you want to pass on the report in PDF or other format without requiring user to do extra click. This can be done easily in Dot Net with the following code.

MyReport report = new MyReport();

DataSet ds = GetData();

report.SetDataSource(ds);

report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "ExportedReport");

 

If you want you can use different format for export like PDF, word, Excel by changing the ExportFormatType enumeration value.

 

Vikram

No Comments