Embed PDF in IE10

mrK picture mrK · May 6, 2013 · Viewed 8k times · Source

I need to embed a PDF in an HTML document that can be viewed in IE8/9/10, firefox, and chrome on a .Net application. I need to stay away from 3rd party libraries because we need to meet a release date and there isn't time to push new licenses through our legal department. I've tried the following solutions and none of them worked for the reasons listed. I don't think this should be hard to do, so any ideas are welcome.

<object src='MyUrl.pdf' />

Object tags didn't work because object tags in .Net require a class to be associated with them

<embed src='MyUrl.pdf' type='application/pdf' />

Embed tags don't seem to work in IE10. Nothing gets displayed but a missing image icon

<iframe src='MyUrl.pdf' style="z-index: 1; zoom: 1" />

In IE10 , the z-index of the iframe cannot be controlled and the menus on the page drop down behind the frame.

As I mentioned, any help is appreciated.

Answer

MrWater picture MrWater · Sep 27, 2013

this works for me for most browsers.

I do have a z-index problem still in IE, since I have a fixed-position header.

<object data="myurl.pdf" type="application/pdf" width="600px" height="500px">
          <param name="wmode" value="transparent" />
          <param name="allowFullScreen" value="true"></param>
          <embed src="myurl.pdf"
                 type="application/pdf"
                 width="600px"
                 height="500px"
                 allowscriptaccess="always"
                 allowfullscreen="true"
                 wmode="transparent"
                 />
</object>