public byte[] RenderPDFFromReportViewObject(string reportName, ReportParameter[] reportParameters)
    {
        CustomReportCredentials objCustomReportCredentials = null;
        Uri reportServerURL = null;

        try
        {
            SystemConfigurations systemConfigurations = SystemConfigurations.GetInstance();
            reportServerURL = new Uri(systemConfigurations.ReportURL);
            string   reportServerDomain   = systemConfigurations.ReportServerDomain;
            string   reportServerUserName = systemConfigurations.ReportServerUserName;
            string   reportServerPassword = systemConfigurations.ReportServerPassword;
            string   reportFolder         = systemConfigurations.ReportFolder;
            string[] streamids;

            objCustomReportCredentials = new CustomReportCredentials(reportServerUserName, reportServerPassword, reportServerDomain);
            ReportViewer1.ServerReport.ReportServerCredentials = objCustomReportCredentials;
            ReportViewer1.ServerReport.ReportServerUrl         = reportServerURL;
            ReportViewer1.ServerReport.ReportPath = "/" + reportFolder + "/" + reportName;
            ReportViewer1.ServerReport.SetParameters(reportParameters);
            ReportViewer1.ServerReport.Refresh();
            return(ReportViewer1.ServerReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings));
        }
        finally
        {
            if (reportServerURL != null)
            {
                reportServerURL = null;
            }
            if (objCustomReportCredentials != null)
            {
                objCustomReportCredentials = null;
            }
        }
    }