Converting RDLC reportviewer output to PDF Manually

Sksamantaray
Posted by Sksamantaray under ASP.NET category on | Points: 40 | Views : 4069
Sometimes we need to convert out Report output to pdf and at the same time we do not require to show the Report Header.
So report-viewer output has to be converted to pdf manually. For that you can refer to following code.


 public void createPdfReport()

{

Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
byte[] bytes = this.ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);
FileStream fs = new FileStream(@"c:\filename.pdf", FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
}

protected void Button1_Click1(object sender, EventArgs e)
{
createPdfReport();
}

Comments or Responses

Login to post response