i was thinking of opening a pdf file in modal . current using
@Html.ActionLink("open file", "Download")
open another windows. i want it to populate it to a div so that i can view in in modal or overlay.
i am ok with jquery solution as well as currently my jquery return me some bytes character.
function openfile() {
$.ajax({
url: '@Url.Action("Download", "mycontroller")',
type: "POST",
dataType: "application/pdf",
success: function (data) {
$('#showpdf').html(data);
},
error: function (err) {
alert(err)
}
});
}
Action in the controller:
public ActionResult Download()
{
string path = HttpContext.Server.MapPath("/pdf/service_reports/SR26175.pdf");
return File(path, "application/pdf");
}