/// <summary> /// Generates a PDF report from the specified report XML document using the default XSLT file and returns /// the file name of the generated PDF document /// The default XSLT file is FMO_PDFReport_Generic.xslt in RM.CommonLibrary.Reporting.Pdf /// The report XML document must be compliant with the schema defined in FMO_PDFReport_Generic.xsd in /// RM.CommonLibrary.Reporting.Pdf. The RM.CommonLibrary.Reporting.Pdf.ReportFactoryHelper class /// provides methods that create compliant elements and attributes, but the onus is on the developer /// to verify that the report XML document is compliant /// </summary> /// <param name="reportXml">The XML report containing the report definition</param> /// <returns>The PDF document file name</returns> public string CreatePdfReport(string reportXml) { // Validate the arguments if (string.IsNullOrWhiteSpace(reportXml)) { throw new ArgumentException($"{nameof(reportXml)} must not be null or empty."); } using (this.loggingHelper.RMTraceManager.StartTrace($"Business.{nameof(CreatePdfReport)}")) { string methodName = typeof(PDFGeneratorBusinessService) + "." + nameof(CreatePdfReport); this.loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.PDFGeneratorAPIPriority, LoggerTraceConstants.PDFGeneratorBusinessServiceMethodEntryEventId); // Create the PDF report with a new file name string pdfFileName = CreatePdfReportFileName(); string pdfFilePath = Path.Combine(this.pdfReportFolderPath, pdfFileName); bool created = PdfGenerator.CreatePDF(reportXml, pdfFilePath); if (!created) { pdfFileName = string.Empty; pdfFilePath = string.Empty; } this.loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.PDFGeneratorAPIPriority, LoggerTraceConstants.PDFGeneratorBusinessServiceMethodExitEventId); return(pdfFileName); } }