title: How to get data from database and make download that content as pdf format in Asp.net MVC
body: <p>I have data in varbinary type in database from "Artifact" table like</p>
  
  <p><strong>ID</strong>&nbsp;&nbsp;&nbsp;<strong>CONTENT</strong><br/>
  1&nbsp;&nbsp;&nbsp;&nbsp;Some data in varbinary type</p>
  
  <p>Now i want to get the "Content" column data and should download as PDF format in Users Download folder with name "Report.PDF" file.</p>
  
  <p>How should i this? I have tried like</p>
  
  <pre><code> public ActionResult DownloadFile(int fileId)
      {
          ResLandEntities reslandEntities = new ResLandEntities();
  
          var content = reslandEntities.ARTIFACT.Where(m =&gt; m.ID== fileId).FirstOrDefault();
          byte[] contents = content.CONTENT;
          string text = Encoding.UTF8.GetString(contents);
  
  
  
          return File(Server.MapPath("~/download/Report.PDF"), "application/pdf", text );
      }
  </code></pre>
  
  <p>But, not getting, can anybody help me</p>