TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Md Akmal
NA
354
19.3k
hot convert byte into pdf file
Oct 31 2019 2:07 PM
Hello
i tried to convert byte (which is store in table )into pdf file(download pdf file)
here is my code in mvc
pdf is genrated but not loaded
what is wrong in code
public FileResult DownloadPDF(string Id)
{
AttachFileSC mAttachFileSC = null;
DataSet mDataSet = null;
MemoryStream pdfStream = new MemoryStream();
string FileName = string.Empty;
try
{
mAttachFileSC = new AttachFileSC();
FileManagerBLL mFileManagerBLL = new FMS.Models.BLL.FileManagerBLL();
mDataSet = mFileManagerBLL.DownloadPDF(Id, UserObj.UserId);
foreach (DataRow mDataRow in mDataSet.Tables[0].Rows)
{
mAttachFileSC.FileName = mDataRow["FileName"].ToString();
mAttachFileSC.FileSize = mDataRow["FileSize"].ToString();
mAttachFileSC.FileExt = mDataRow["FileExt"].ToString();
mAttachFileSC.FileByte = (byte[])mDataSet.Tables[0].Rows[0]["FileByte"];
}
FileName = (mAttachFileSC.FileName).Replace(mAttachFileSC.FileExt, ".pdf");
pdfStream.Write(mAttachFileSC.FileByte, 0, mAttachFileSC.FileByte.Length);
pdfStream.Position = 0;
}
catch (Exception ex)
{
throw ex;
}
return File(pdfStream, System.Net.Mime.MediaTypeNames.Application.Octet, FileName);
}
Reply
Answers (
6
)
how to make cookies in website loading faster in asp.net c#
How to call post method webapi and return result in mvc