hi,
I am using ASP.NET mvc3.In that I am using pdf viewer and I want to implement this using" memory stream".I did like
public ActionResult Index(string docId)
{
if(docId != null)
var query = docContext.My_general_profile_docs.Join(docContext.My_general_profile_doc_details, i => new i.Docs_general_profile_doc_id, j => j.Docs_general_profile_doc_id,
(i, j) => new
{
docs_general_profile_doc = i.Docs_general_profile_doc
}).FirstOrDefault();
byte[] buff = query.docs_general_profile_doc;
MemoryStream mmystrm = new MemoryStream(buff);
Stream r = mmystrm;
PdfLoadedDocument pdfDoc = new PdfLoadedDocument(mmystrm);
MemoryStream m = new MemoryStream();
pdfDoc.Save(m);
Stream input = m;
ViewData["doc"] = input;
}
return View();
}
and in the view I gave like
<div id="update" style="padding: 15px 5px 3px 5px;"> @{Html.Syncfusion().PdfViewer("PdfViewerModel").Load((Stream)ViewData["doc"]).Width(System.Web.UI.WebControls.Unit.Pixel(900)).Render();}
</div>
I am getting bytes at the ViewData["doc"] but In the view It is throwing "Null Reference Exception",can u tell me how to fix this