0

This is my code am getting the result as byte array.
i want to print this byte array without saving as pdf in system.
kindly note this is web application not window application

        Page p = new Page();
        string fname = string.Empty;
        string filetype = string.Empty;

        ReportViewer rptvw1 = new ReportViewer();
        rptvw1.ProcessingMode = ProcessingMode.Local;
        rptvw1.LocalReport.ReportPath = p.Server.MapPath("~/GridReport.rdlc");
        BL_Insurance.PrintDetail print = new BL_Insurance.PrintDetail();
        DataTable ds = print.Print(Convert.ToInt32(p.Session["transactionid"]), Convert.ToString(p.Session["typeofplan"]),             Convert.ToInt32(p.Session["UserID"]));
        ReportDataSource datasource = new ReportDataSource("DataSet1", ds);
        rptvw1.LocalReport.DataSources.Clear();
        rptvw1.LocalReport.DataSources.Add(datasource);
        ReportParameter[] param = new ReportParameter[4];
        param[0] = new ReportParameter("Company", Convert.ToString(p.Session["insurancecompany"]));
        param[1] = new ReportParameter("Policy", Convert.ToString(p.Session["policyname"]));
        if (ds.Columns.Contains("Adult"))
        {
            param[2] = new ReportParameter("Adult", "True");
            param[3] = new ReportParameter("Child", "True");
        }

        else
        {
            param[2] = new ReportParameter("Adult", "False");
            param[3] = new ReportParameter("Child", "False");
        }
        rptvw1.LocalReport.SetParameters(param);
        rptvw1.LocalReport.Refresh();
        Warning[] warnings = null;
        string[] streamIds = null;
        string mimeType = string.Empty;
        string encoding = string.Empty;
        string extension = string.Empty;
        string fileNameExtension;
        filetype = "pdf";
        byte[] bytes = rptvw1.LocalReport.Render(filetype, null, out mimeType, out encoding, out extension, out streamIds, out warnings);

Edited by Anto_1

2
Contributors
1
Reply
13
Views
2 Years
Discussion Span
Last Post by ddanbe
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.