gpt4 book ai didi

c# - 在 iframe 中打开 pdf

转载 作者:行者123 更新时间:2023-11-30 21:00:24 25 4
gpt4 key购买 nike

我想在 asp.net 页面内的 inframe 中打开 PDF 文件。我试过了

<iframe src="http://samplepdf.com/sample.pdf" width="400px" height="300px"  />

这很好用。

但是,当我如下更改 PDF 文件的路径时

<iframe id ="myframe" src=@"C:\Book.pdf" width="400px" height="300px"  runat="server"/>

框架内不显示任何内容。

我尝试如下更改 CodeBehind 中的路径

myframe.Attributes.Add("src", @"C:\Book.pdf");

但是 pdf 文件没有在 iframe 中打开。什么是问题?有人知道解决方案吗?

最佳答案

HTML 无法与本地磁盘上的文件路径交互。

您需要使用网络服务器中的路径引用 PDF 文件。

关于c# - 在 iframe 中打开 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14924766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com