public string GenerateReportForREportTemplate(string ReportTemplateName, object RIf, object RTs) { ReportInfo RI = (ReportInfo)RIf; ReportTemplate RT = (ReportTemplate)RTs; ReportPage RP = new ReportPage(RI, RT.Xaml); string FileName = Path.GetTempPath() + ReportTemplateName + ".rtf"; if (System.IO.File.Exists(FileName)) { FileName = Path.GetTempPath() + " " + DateTime.Now.ToString("dMMMyyyy_HHmmss_fff") + "_" + ReportTemplateName + ".rtf"; } GC.Collect(); RP.SaveReport(FileName); string PDFFileName = FileName.Replace(".rtf", ".pdf"); RTFtoPDF.Convert(FileName, PDFFileName); return(PDFFileName); }