Click here to Skip to main content
15,896,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
iam working n windows form application
i have invoice form after saving the bill i want to open pdf or excel file as the invoice for printing

now i add rdlc report in the same form after i save the invoice i generate the rdlc then export to pdf in harddisk then repoen by using System.Diagnostics.Process.Start
to open the pdf file
but the problem this is cycle take too much time toopen the pdf file
i need any help to get any more performance way to generate report & open it
thanks for any help
Posted
Comments
Member 11428137 9-Mar-15 0:41am    
Can you show the code you are using to export to pdf?
This is probably the part that is slow, but without knowing how you're doing it, it will be hard to suggest improvements.
Thanks
md_refay 24-Mar-15 0:40am    
Dear Thanks for your support
this is my code to convert rdlc to pdf file
--******************************************
privare void callreport()
{
string[] ReportDataSourecName = new string[4];
ReportDataSourecName[0] = "DataSet1";
ReportDataSourecName[1] = "DataSet2";
ReportDataSourecName[2] = "DataSet3";
ReportDataSourecName[3] = "Ds_Setting";
//**************
object[] objs = new object[4];
objs[0] = ((List<reportdatasource>)e.Result)[0].Value;
objs[1] = ((List<reportdatasource>)e.Result)[1].Value;
objs[2] = ((List<reportdatasource>)e.Result)[2].Value;
objs[3] = ((List<reportdatasource>)e.Result)[3].Value;
//**************
Guid _guid = Guid.NewGuid();
General_Cls.FillReport(reportViewer1, objs, "RptGetPurchaseOrder_ByOrderID", ReportDataSourecName);
General_Cls.CreatePdfFile(reportViewer1, General_Cls.TempPath + _guid.ToString() + ".pdf");
System.Diagnostics.Process.Start(General_Cls.TempPath + _guid.ToString() + ".pdf");
}
--******************************************
public static void FillReport(ReportViewer reportViewer1, object[] obj, string ReportName, string[] ReportDataSourecName)
{
reportViewer1.LocalReport.DataSources.Clear();
int _len = obj.Length;
Microsoft.Reporting.WinForms.ReportDataSource rds = null;
for (int x = 0; x <= obj.Length - 1; x++)
{
rds = new Microsoft.Reporting.WinForms.ReportDataSource();
rds.Name = ReportDataSourecName[x];
rds.Value = obj[x];
reportViewer1.LocalReport.DataSources.Add(rds);
}
reportViewer1.LocalReport.ReportEmbeddedResource = "ERPSystem.Reports." + ReportName + ".rdlc";
reportViewer1.RefreshReport();
}
--******************************************
public static void CreatePdfFile(ReportViewer Rv)
{
try
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
byte[] bytes = Rv.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
using (FileStream fs = new FileStream(@"c:\Rpt.pdf", FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
}
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
}

--******************************************
Member 11428137 24-Mar-15 4:22am    
Do you need the ReportViewer to actually view the report, or are you just using it to export to pdf? If it is just for the export, then you can actually just create a LocalReport object and use that instead. That could speed it up a little bit.
I also just found this, which looks like it could help: http://stackoverflow.com/questions/15031212/ssrs-localreport-mode-takes-a-long-time-to-render-in-pdf

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900