MVC打开PDF文件 [英] MVC open pdf file

查看:167
本文介绍了MVC打开PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:
我有一个MVC应用程序,在某些控制器我生成PDF文件的一些动作,是在服务器上的特定路径上生成的文件。这一行动被称为视图的操作链接,当用户点击该链接时,操作生成的PDF,一切都很正常,直到在这里。
我希望页面显示与我生成的PDF文件,该文件说的对话框:

I have the following issue: I have a MVC application, in some action of some controller i'm generating a PDF file, the file is being generated on a specific path on the server. That action is being called on an action link of the view, when the user clicks that link, the action generated that PDF, everything fine until here. I want the page to show the dialog with my generated PDF file that says:

打开 - 保存 - 取消(该tipical文件对话框,当你点击一个文件)

Open - Save - Cancel (the tipical file dialog when you click a file)

但无需刷新页面,只显示对话框,当用户点击了该链接。

But without refreshing the page, only show the dialog when the user clicked the link.

我怎么能这样做呢?应该怎样行动回报的看法?
谢谢你。

How could i do that? what should the action return to the view? Thanks.

推荐答案

有一个看的 FilePathResult 和的 FileStreamResult。。一个例子是这里

Have a look at FilePathResult and FileStreamResult.. An example is here.

这篇关于MVC打开PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆