//public void Post([FromBody] string value) public IActionResult GeneratePDF(Patient patient) { var globalSettings = new GlobalSettings { ColorMode = ColorMode.Color, Orientation = Orientation.Portrait, PaperSize = PaperKind.A4, Margins = new MarginSettings { Top = 10 }, DocumentTitle = patient.FName + " " + patient.LName, //Out = Path.Combine(Directory.GetCurrentDirectory(), "data", "pdf", patient.FName + " " + patient.LName + " - " + patient.PCell + ".pdf") }; //var globalSettingsSave = new GlobalSettings //{ // ColorMode = ColorMode.Color, // Orientation = Orientation.Portrait, // PaperSize = PaperKind.A4, // Margins = new MarginSettings { Top = 10 }, // DocumentTitle = patient.FName + " " + patient.LName + " - " + patient.PCell, // Out = Path.Combine(Directory.GetCurrentDirectory(), "data", "pdf", patient.FName + " " + patient.LName + " - " + patient.PCell + ".pdf") //}; var objectSettings = new ObjectSettings { //Page= "http://localhost:50598/", PagesCount = true, HtmlContent = TemplateGenerator.GetHtmlTemplate(patient), WebSettings = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "StyleForHTML.css") }, HeaderSettings = { FontName = "Arial", FontSize = 9, Right = "Page [page] of [toPage]", Line = true }, FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Center = "Report Footer" } }; //var objectSettingsSave = new ObjectSettings //{ // //Page= "http://localhost:50598/", // PagesCount = true, // HtmlContent = TemplateGenerator.GetHtmlTemplate(patient), // WebSettings = { DefaultEncoding = "utf-8", UserStyleSheet = Path.Combine(Directory.GetCurrentDirectory(), "assets", "StyleForHTML.css") }, // HeaderSettings = { FontName = "Arial", FontSize = 9, Right = "Page [page] of [toPage]", Line = true }, // FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Center = "Report Footer" } //}; //var pdfSave = new HtmlToPdfDocument() //{ // GlobalSettings = globalSettingsSave, // Objects = { objectSettingsSave } //}; var pdfServe = new HtmlToPdfDocument() { GlobalSettings = globalSettings, Objects = { objectSettings } }; byte[] pdfBytes = _converter.Convert(pdfServe); _logger.LogInformation("PDF Generated"); //Utility u = new Utility(); GenerateXML(patient); _logger.LogInformation("XML Generated"); return(File(pdfBytes, "application/pdf", patient.FName + " " + patient.LName + ".pdf")); }