The Objective:
I have to print a PDF on a new tab after some tasks have finished correctly.
Steps: I want to execute a method that should go to the server, take the PDF and open it on a new Tab, I was trying with these but is not working:
Controller: Export
public ActionResult PrintPdf()
{
Response.AppendHeader("Content-Disposition", "inline; filename= " + MyClassPdfWriter.GetFileName);
return File(MyClassPdfWriter.GetMemoryStream, "application/pdf");
}
View:
function TasksSucced(){
$.get('@Url.Action("PrintPdf", "Export", "new {target = _blank}")');
}
Solved! That works for me
window.open('/Export/PrintPdf');