如何在mvc 4应用程序中添加谷歌文档查看器?

时间:2013-06-06 03:23:59

标签: c# asp.net-mvc-4 google-docs google-docs-api

我是编程初学者。我的问题是,我想在我的网站页面PDF中显示Google Doc Viewer个文件。我将PDF文件放在名为Bullettin的文件夹中,它位于App_Data文件夹中。

如何使用PDF申请通过Google Doc Viewer在我的网站中查看此C# MVC4文件?

我在视图页面中使用了以下代码  http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf&embedded=true"target =“_ blank”class =“embed”>查看

1 个答案:

答案 0 :(得分:2)

您应该使用以下网址进行嵌入:http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf进行预览

和:<a href="http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf&embedded=true" target="_blank">Preview</a>

表示链接,最后:

<iframe src="http://docs.google.com/viewer?url=http://localhost:3907/App_Data/Bullettin/JCI.pdf&embedded=true"></iframe>

对于iframe。

好吧,localhost不适合你,所以让你的项目在实时服务器上或使用IP地址链接你的服务器。

祝你好运。

相关问题