My report is generated successfully in IIS and now I want to get that report in PDF format. Please guide me - I listed my source below:
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("MR.rpt"));
rpt.SetDatabaseLogon("", "", "RAMYA-BD", "");
rpt.SetParameterValue("MRNO", ddlmrno.SelectedItem.Text);
CrystalReportViewer1.ReportSource = rpt;
Response.ContentType = "application/pdf";
}
Go through following Links:
http://www.dotnetspider.com/resources/4946-Create-pdf-from-crystal-report.aspx
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-export-pdf.htm
or the stack overflow same problem: Converting Crystal report to PDF
If you not have add Viewer:
Stream st = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=\"xxx.pdf\"");
st.CopyStream(Response.OutputStream);
Response.Output.Flush();
Response.End();
Database connection maybe
rep.DataSourceConnections[0].SetLogon("Login","Password");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.