问题描述:

I am really having a hard time opening up certain .pdf files within an iframe HTML element. I can open some .pdf files in this iframe, but not all of them. The ones that I cannot open were created by the Crystal Reports engine in Visual Studio 2010.

My source is simple and looks like the following:

<iframe src= "c:\jnk\EULA.pdf">

</iframe>

Is there any characteristic of a .pdf file that could prevent it from being displayed in an iframe? I am using IE8, but get the same results in FF. I also can perfectly display this .pdf file when it is not in an iframe.

网友答案:

IFrame isn't correct solution. You can use other solutions :

1 . <embed src="file:///C:\jnk\EULA.pdf" width="500" height="375">

2 . Download this library and use it.

I hope that I helped.

PS Remember that when we use local file, we should write in prefix file:///

Sorry for my English

网友答案:

Based on a comment of yours, it sounds like your issue is one of permissions, unrelated to PDFs.

If I were you, I'd make sure that I can access the PDFs in my browser outside of any HTML. If that fails, you know you have a problem.

相关阅读:
Top