【发布时间】:2019-12-09 01:29:50
【问题描述】:
我正在尝试使用 DotVVM 在浏览器选项卡中查看 PDF。
我尝试使用此处描述的ReturnFile() 方法https://www.dotvvm.com/docs/tutorials/advanced-returning-files/1-1
使用additionalHeaders,但没有成功。
var additionalHeaders = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("Content-Disposition", "inline")
};
using (var file = ...)
{
Context.ReturnFile(file.Stream, ItemId + "-" + type + ".pdf", "application/pdf", additionalHeaders);
}
有什么方法可以在浏览器中使用ReturnFile() 方法查看PDF,还是我必须创建自己的DotvvMPresenter?或者有没有其他合适的方法来管理它?
我也试过设置Context.HttpContext.Response.Body/Headers/ContentType
,但即使这样也没有用。
【问题讨论】: