I am trying to stream a byte[] to load inside a jquery modal when a certain link is clicked using MVC3. In my controller I have
public ActionResult GetTermsAndCondtion()
{
byte[] termsPdf = GetTermsAndConditions(DateTime.Now);
return new FileContentResult(termsPdf, "application/pdf");
}
In one of my view I have
@Html.ActionLink("Terms and Conditon","GetTermsAndCondtion","Customer", new{id="terms"})
This opens the pdf file in a tab. But I want to open the byte[] as pdf file inside a modal.
Any Help?
Iframe could be your answer.
The problem it's that ajax can't load the pdf it inside the browser, to show a pdf you must specified the content disposition and the browser show the pdf inside him
to specified the content disposition add header
Controller
And finally add this iframe inside your modal
Here's a solution [to view/print/save a PDF], that generates the PDF modal dialog from a byte[] via an MVC-ajax call. It is built from a number of other semi-related posts elsewhere. There are two options: PrintDialog1 uses the object tag, were as PrintDialog2 uses iframe tag.
Controller >>
Razor page >>