Render Pdf bytes array within browser in MVC
Render Pdf within browser There are different ways to render Pdf in a browser. In this I’m explaining to render Pdf by fileContent/byte array. In a below example I’m using Index Action which returns the FileContentResult. public ActionResult Index() { Response.Clear(); Response.AddHeader(“Content-Disposition”,“inline; filename=sample.pdf”); Response.AddHeader(“Content-Type”,“application/pdf”); Response.ClearHeaders(); Response.AddHeader(“Content-Length”, byteArray.Length.ToString()); FileContentResult result = new FileContentResult(byteArray, “application/pdf”); return result; } …