当前位置: 动力学知识库 > 问答 > 编程问答 >

html - Trying to open a .pdf file in an iframe

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: