My issue is I'm currently receiving from a web service response a string that is the binary data of a PDF file. I need to display this PDF file embedded in an MVC view. I'm using C#.
Any pointers are appreciated.
My issue is I'm currently receiving from a web service response a string that is the binary data of a PDF file. I need to display this PDF file embedded in an MVC view. I'm using C#.
Any pointers are appreciated.
You can just return it using File. Something like this:
public ActionResult ShowPDF()
{
byte[] pdf = myService.GetPDF();
return File(pdf, "application/pdf");
}
UPDATE
Create a page containing a iframe element and set the src attribute to point to your view that renders the PDF file. Here is an example taken from here
<iframe src="ShowPDF" width="100%" style="height:20em">
[Your browser does <em>not</em> support <code>iframe</code>,
or has been configured not to display inline frames.
You can access <a href="ShowPDF">the document</a>
via a link though.]
</iframe>