预览pdf而不是使用Rotativa下载 [英] Preview pdf instead of download using Rotativa

查看:108
本文介绍了预览pdf而不是使用Rotativa下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Rotativa将.html文件打印为.pdf文件.我已经尝试过此代码:

I am trying to print .html file as .pdf file using Rotativa. I have tried this code:

return new ActionAsPdf("Index") { FileName = "Product.pdf" };

我的索引操作在这里:

public ActionResult Index()
{
    return View(db.Products.ToList());
}

但是,下载的是生成的.pdf文件,而不是预览文件.我不想下载它.我想要预览,然后打印.

But, the generated .pdf file is downloaded instead of previewed. I don't want to download it. I want the preview and then print it.

推荐答案

我得到了答案.我需要删除FileName属性.如果要下载它,则需要添加FileName属性,如果需要要仅查看预览,我需要将其删除.代码应仅为:

I got the answer.I need to remove the FileName attribute.If I want to download it, I need to add the FileName attribute and if I want to see just the preview, I need to remove this.The code should be just :

return new ActionAsPdf("Index");

这篇关于预览pdf而不是使用Rotativa下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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