Please visit DEMANDDRAFT.STORE for quality of products...

Ad

Search This Blog

Friday, August 7, 2015

How to display PDF file in Iframe which are in Folder by clicking Image button in MVC4

I have a folder called PDF in the application . I have stored 2 pdf files.

In the view :-

  <a href="~/UserSettings/GetSocialPDF" target="iframe_a">

          <img id="imgfinancialProcess" src="~/images/social_options.png"  height="250px" width="250px"/>

  </a>


 <a href="~/UserSettings/GetoptionPDF" target="iframe_a">

          <img id="imgfinancialProcess" src="~/images/options.png" height="250px" width="250px" />

 </a>

And i have  i frame in my VIEW. Please find below.

<iframe src="" name="iframe_a" style="height: 1000px; width: 1400px"></iframe> 


In my Controller :-

1) 
 public FileStreamResult GetSocialPDF()
        {
            FileStream fs = new FileStream(Server.MapPath(@"~\pdf\Socialsheet.pdf"), FileMode.Open, FileAccess.Read);

            return File(fs, "application/pdf");


        }

2) 
 public FileStreamResult GetoptionPDF()
        {
            FileStream fs = new FileStream(Server.MapPath(@"~\pdf\Option Appraisals Web Portal Specification.pdf"), FileMode.Open, FileAccess.Read);
            return File(fs, "application/pdf");

        }

No comments:

Post a Comment