5

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.

mrK
  • 2,208
  • 4
  • 32
  • 46
  • @DanPichelman Sorry, the post was unclear, the iframe wasn't the missing image problem. The ifram has the z-index problem. – mrK May 06 '13 at 16:02
  • Possibly of interest [Recommended way to embed PDF in HTML?](http://stackoverflow.com/q/291813/427192) – Dan Pichelman May 06 '13 at 16:04
  • @DanPichelman Yeah, I looked at that post already. That's where I got the idea for the embed tag. – mrK May 06 '13 at 16:05
  • @Pro.. No solution as of yet. I basically rearranged the entire page to make sure the pdf never interferes with the surroundings. Terrible answer, but it's where I'm at. – mrK Feb 05 '15 at 17:26
  • I have the same issue. Googled a lot and found that it is only IE bug with the z-index of pdf object. But still finding if I get anything. – Pradip R. Feb 05 '15 at 19:17

1 Answers1

-1

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>
MrWater
  • 1,797
  • 4
  • 20
  • 47