在iframe中显示pdf文件

问题描述:

我的代码:

My code:

protected void Page_Load(object sender, EventArgs e)
        {
            myframe.Attributes.Add("src", "/UploadJournal/okay3.pdf");
        }



ASP.NET中的代码:


Code in ASP.NET:

<div>
    <iframe id="myframe" runat="server"></iframe>
    </div>





问题: 当我运行我的程序时,它正在尝试下载of pdf文件但是没有显示在我的页面中。请解决这个问题。





看看这里:

http://stackoverflow.com/a/11603354 [ ^ ]


这取决于浏览器如何显示pdf内容..大多数浏览器不支持显示pdf内联。你需要一个自定义解决方案。



检查这个没有安装在客户端或服务器上的Acrobat Reader的ASP.NET PDF Viewer用户控件 [ ^ ]
It depends on the browser how to display the pdf content... Most browsers do not support to display pdf inline. You need a custom solution.

Check this ASP.NET PDF Viewer User Control Without Acrobat Reader Installed on Client or Server[^]


http://amitpatriwala.wordpress.com/2009/08/28/pdf-viewer -in-asp-net / [ ^ ]