By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How to get data from database and make download that content as pdf format in Asp.net

P: 2
I have data in varbinary type in database from "Artifact" table like

ID CONTENT
1 Some data in varbinary type

Now i want to get the "Content" column data and should download as PDF format in Users Download folder with name "Report.PDF" file.

How should i this? I have tried like
Expand|Select|Wrap|Line Numbers
  1. public ActionResult DownloadFile(int fileId)
  2. {
  3. ResLandEntities reslandEntities = new ResLandEntities();
  4.  
  5. var content = reslandEntities.ARTIFACT.Where(m => m.ID== fileId).FirstOrDefault();
  6. byte[] contents = content.CONTENT;
  7. string text = Encoding.UTF8.GetString(contents);
  8.  
  9. return File(Server.MapPath("~/download/Report.PDF"), "application/pdf", text );
  10. }
  11.  
But, not getting, can anybody help me
Aug 12 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.