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

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

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

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();
  5. var content = reslandEntities.ARTIFACT.Where(m => m.ID== fileId).FirstOrDefault();
  6. byte[] contents = content.CONTENT;
  7. string text = Encoding.UTF8.GetString(contents);
  9. return File(Server.MapPath("~/download/Report.PDF"), "application/pdf", text );
  10. }
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.