我想在我的浏览器中使用iframe或object标签打开PDF文件,或者我们可以做什么
我有一个PDF.aspx页面:
Response.Buffer = false; //transmitfile self buffers
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=file1.pdf");
Response.TransmitFile(filepath);
Response.End();
这是我在另一页中的iframe:
<iframe runat="server" src="PDF.aspx" class="pdfFilePanel_fn" width="99%" height="98%"></iframe>
它会打开pdf文件,而不是在iframe中显示它!
任何想法或更好的解决方案?
答案 0 :(得分:2)
Response.AddHeader("Content-Disposition", "attachment; filename=file1.pdf");
应改为
Response.AddHeader("Content-Disposition", "inline; filename=file1.pdf");
:)