在iframe中显示本地pdf文件 [英] display local pdf file in iframe
本文介绍了在iframe中显示本地pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个由activex控件创建的pdf文件.
然后将其保存到本地计算机c:\ temp.pdf.
我将如何在iframe中显示此内容以供用户查看.
我已经尝试过了,但是当我运行网页时却找不到该文件.
Hi guys,
i have a pdf file thats gets created by an activex control.
it is then saved to the local machine c:\temp.pdf.
how would i display this in an iframe for user to view.
i have tried this, but when i run the web page it foes not find the file.
Dim buffer As [Byte]() = client.DownloadData("c:\temp.pdf")
Response.ClearContent()
Response.ContentType = "application/pdf"
Response.AddHeader("content-length", buffer.Length.ToString())
Response.BinaryWrite(buffer)
Response.Flush()
Response.End()
有什么想法吗?
谢谢
Anoop
any ideas?
thanks
Anoop
推荐答案
当您说本地计算机"时,我假设您的意思是客户端".
如果是这种情况,您可以尝试在iframe src中使用"file:///C:/temp.pdf".这是否有效取决于浏览器/插件/设置,因为file:///前缀往往会向某些人发出安全警告.
您可以在此处快速阅读: http://en.wikipedia.org/wiki/File_URI_scheme [ ^ ]
如果这对您没有帮助,则最好生成pdf服务器端,然后使用正常的http(s)网址将其显示在iframe中.
希望这会有所帮助.
When you say ''local machine'' I assume you mean the ''client side''.
If this is the case you can try using "file:///C:/temp.pdf" in the iframe src. It will depend on the browser/plugin/settings if this will work or not, since the file:/// prefix tends to throw security warnings for some people.
You can quickly read up on it here: http://en.wikipedia.org/wiki/File_URI_scheme[^]
If this does not help in your situation, it might be best to generate the pdf server side and then show it in the iframe using a normal http(s) url.
Hope this helps.
这篇关于在iframe中显示本地pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文