I have my MVC4 Actionresult return a MemoryStream
MemoryStream memory = new MemoryStream();
Response.AppendHeader("Content-Disposition", "inline; filename=" + outputFilename + ".pdf");
return File(memory, "application/pdf");
And the Jquery
$.ajax({
type: "GET",
url: '/Report/Pdf/',
async: false,
dataType: 'html',
success: function (result) { alert("Done!");}
});
How Do I open a new window/tab and display the PDF file oon the Success function of the AJAX?
The easiest way would be to use a link, with or without
target=blank(the former will allow the user to control themselves where they want to open it).then there’s
window.openbut to my knowledge, you can’t directly target a new tab with that.