I have to display a PDF(stored as BLOB in SQL Server table) in a partial view. I am doing the same for a ".jpeg" image stored as BLOB in the table.The image is getting displayed,however,the PDF isnt.I have the following code in my controller:
[Authorize]
public ActionResult Show3LeadImage(int id)
{
Byte[] imageData = null;
using (var scope = new PatientPersistenceScope())
{
searchRequest leadRequest = new searchRequest();
leadRequest.CaseNumber = id;
var mrx12LeadBitmap = _mrxSearchService.Get12Lead(leadRequest);
imageData = mrx12LeadBitmap.Data12Leads[0].mrx3Lead;
scope.Done();
}
return File(imageData,"image/png");//I have tried "FileContentResult,but it didnt work
}
The code in the partial view(.ascx) looks like this:
<object data='<%= Url.Action("Show3LeadImage", "CareRecord", new { id = Model.CareRecord.CaseNumber}) %>' type="application/pdf" style="width: 721px; height: 800px;" ></object>
I do not have access to the physical file....the BLOB is all I have.
Is it even possible to display a PDF as image in partial view? I came across lots of articles that explained how to make a PDF available for download in the partial view.But I do not want my file to be downloadable. Is this functionality achievable or am I trying to do something impossible?