Example #1
0
        public async Task <IActionResult> GetPdfViewInHtml <T>(string ViewInHtml, T model)
        {
            var html = await _engine.RenderHtmlToStringAsync(ViewInHtml, model);

            var          byteArray = GetPDF(html);
            MemoryStream pdfStream = new MemoryStream();

            pdfStream.Write(byteArray, 0, byteArray.Length);
            pdfStream.Position = 0;
            return(new FileStreamResult(pdfStream, "application/pdf"));
        }