asp.net mvc - Populating Iframe with PDF - Using MVC [IE Issue] -
currently, have issue populating iframe have pdf document, issue occurs in ie.
basic layout:
i have screen contains list of items (attachments), can images, text or pdf. when user clicks on 1 of these items - make call controller action [viewattachment] return requested item , display in iframe.
this works data types exception of pdfs in ie. (firefox, chrome etc. display pdf in iframe without issue.)
i using adobe reader 9, , upgraded 10 in hopes of solving issue. i'll attach code see if has suggestions how possibly resolve this.
code populate iframe: (moved 2 lines readability)
$(".viewattachment").live('click',function () { $("iframe#test").attr("src","<%=url.action("viewattachment","images") %>? attachment=" + $(this).next().val()); });
viewattachment controller action:
public actionresult viewattachment(string attachmentguid) { attachment attachment= imageagent.getattachment(attachmentguid); stream resultstream = new memorystream(); resultstream = storageproviders[attachment.providername] .readfile(attachment.filereference); resultstream.position = 0; filestreamresult result = new filestreamresult(resultstream, attachment.contenttype); return result; }
notes:
- i've attempted toggling "display pdf in browser" in adobe reader without success.
- currently testing ie8.
- when clicking on pdf view - iframe remains @ it's previous content , doesn't change @ all.
after several different methods , iterations of testing - determined conflict between ie8-9 , versions of adobe reader 9-10. added following meta tag window containing iframe , resolved of issues:
<meta http-equiv="x-ua-compatible" content="ie=7" />
this should @ least work until update / fix made.
Comments
Post a Comment