Asp.net mvc 如何使用Rotativa MVC在横向视图中设置特定页面?
我创建了一个MVC5项目。在这个项目中,我设计了一些局部视图。 使用Rotativa.MVC,我可以将局部视图转换为pdfAsp.net mvc 如何使用Rotativa MVC在横向视图中设置特定页面?,asp.net-mvc,pdf,rotativa,Asp.net Mvc,Pdf,Rotativa,我创建了一个MVC5项目。在这个项目中,我设计了一些局部视图。 使用Rotativa.MVC,我可以将局部视图转换为pdf [HttpPost] public ActionResult TestAction(TestViewModel testViewModel) { return PartialView("_testPartial", testViewModel); } 我想为pdf设置横向页面 当使用Rotativa.MVC将局部视图转换为pd
[HttpPost]
public ActionResult TestAction(TestViewModel testViewModel)
{
return PartialView("_testPartial", testViewModel);
}
我想为pdf设置横向页面
当使用Rotativa.MVC将局部视图转换为pdf时,如何在横向视图中设置单个页面
我使用了下面的代码将部分视图转换为pdf
[HttpPost]
public ActionResult TestAction(TestViewModel testViewModel)
{
return PartialView("_testPartial", testViewModel);
}
请为我提供上述功能的解决方案
谢谢请使用下面的代码
public ActionResult TestAction(TestViewModel testViewModel)
{
return new Rotativa.MVC.ViewAsPdf("_testPartial", testViewModel)
{
RotativaOptions = new Rotativa.Core.DriverOptions()
{
PageOrientation = Rotativa.Core.Options.Orientation.Landscape,
},
};
}