2017-06-16 83 views
0

Details方法返回本地化視圖,但GeneratePdf方法不會。Rotavita.ActionAsPdf中的本地化不起作用

public ActionResult GeneratePdf(long id, long userId) 
{ 
    return new ActionAsPdf("Details", new { id = id, userId = userId }) { FileName="pdf.pdf", PageOrientation = Rotativa.Options.Orientation.Landscape}; 
} 
public ActionResult Details(long id, long userId) 
{ 
    return View(); 
} 

回答

0

不是返回View in Details方法,而是返回ViewAsPdf來解決問題。

public ActionResult Details(long id, long userId) 
{ 
    return new ViewAsPdf() { FileName = "pdf.pdf", PageOrientation = Rotativa.Options.Orientation.Landscape }; 
}