public IActionResult CaseReportForm(int id, int formId) { var form = _caseReportFormManager.GetPatientsForms(id) .Where(f => f.ID == formId) .FirstOrDefault(); var patient = _context.Patients .Where(p => p.ID == id) .FirstOrDefault(); var resultWithIndex = new CaseReportFormResultWithGlobalIndex(); resultWithIndex.Patient = patient; resultWithIndex.Result = form; resultWithIndex.GlobalIndex = 1; resultWithIndex.ShowButtons = false; var pdfBytes = _pdfConverter.GenerateCaseReportFormPdf(resultWithIndex); ViewBag.Index = "0"; return(GetFileContentResult(pdfBytes.Result, ".pdf", "application/pdf")); }
public async Task <byte[]> GenerateCaseReportFormPdf(CaseReportFormResultWithGlobalIndex result) { string htmlView = await _htmlRenderService.RenderToStringAsync("/Views/CaseReportForms/_PdfForm.cshtml", result); return(GeneratePdfFromHtml(htmlView)); }