Display PDF in Html

Posted by anil on Stack Overflow See other posts from Stack Overflow or by anil
Published on 2010-06-14T13:50:40Z Indexed on 2010/06/14 13:52 UTC
Read the original article Hit count: 336

Filed under:

Hi, i want to show PDF in a view in MVC, following function return file

public ActionResult TakeoffPlans(string projID) { Highmark.BLL.Models.Project proj = GetProject(projID); List ff = proj.GetFiles(Project_Thin.Folders.CompletedTakeoff, false); ViewData["HasFile"] = "0"; if (ff != null && ff.Count > 0 && ff.Where(p => p.FileExtension == "pdf").Count() > 0) { ViewData["HasFile"] = "1"; }

        ViewData["ProjectID"] = projID;
        ViewData["Folder"] = Project_Thin.Folders.CompletedTakeoff;
        //return View("UcRenderPDF");
        string fileName = Server.MapPath("~/Content/Project List Update 2.pdf");
        return File(fileName, "application/pdf", Server.HtmlEncode(fileName));
    }

but it display some bad data in view, please help me on this

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2