public void ToPdfFile()
        {
            if (IsLoaded && IsPrepared)
            {
                if (!Directory.Exists(OutputPath))
                {
                    Directory.CreateDirectory(OutputPath);
                }

                var diskFileName = String.Format(@"{0}\{1}_{2:yyyyMMdd_HHmmss}.pdf", OutputPath,
                                                 Path.GetFileNameWithoutExtension(ReportPath), DateTime.Now);

                var crExportOptions = new ExportOptions
                {
                    ExportDestinationType = ExportDestinationType.DiskFile,
                    ExportFormatType      = ExportFormatType.PortableDocFormat,
                    DestinationOptions    = new DiskFileDestinationOptions
                    {
                        DiskFileName = diskFileName
                    },
                    FormatOptions = new PdfRtfWordFormatOptions()
                };

                try
                {
                    ReportDoc.Export(crExportOptions);
                }
                catch (Exception ex)
                {
                    _logger.LogEx(String.Format("Error exporting {0}", diskFileName), ex);
                }
            }
        }
 public Stream ToPdfStream()
 {
     if (IsLoaded && IsPrepared)
     {
         try
         {
             return(ReportDoc.ExportToStream(ExportFormatType.PortableDocFormat));
         }
         catch (Exception ex)
         {
             _logger.LogEx(String.Format("Error while creating the FileStream for report {0}", ReportPath), ex);
         }
         _logger.Log(LogLevel.Info, String.Format("{0} was provided as FileStream.", ReportPath));
     }
     else
     {
         _logger.Log(LogLevel.Error, String.Format("Report {0} is {1}.", ReportPath,
                                                   IsLoaded && !IsPrepared
                                         ? "not prepared"
                                         : !IsLoaded && IsPrepared
                                                 ? "not loaded"
                                                 : "neither loaded nor prepared"));
     }
     return(null);
 }
        public void Load()
        {
            IsLoaded = false;

            if (File.Exists(ReportPath))
            {
                try
                {
                    ReportDoc.Load(ReportPath);
                    IsLoaded = true;
                    _logger.Log(LogLevel.Info, String.Format("{0} was loaded.", ReportPath));
                }
                catch (Exception ex)
                {
                    _logger.LogEx(String.Format("Error loading report {0}", ReportPath), ex);
                }
            }
            else
            {
                _logger.Log(LogLevel.Error, String.Format("Report {0} was not found.", ReportPath));
            }
        }