2016-12-13 9 views
0

rotativa PDFを使用してasp.net mvc領域で私の見解を得る方法。 Area rotativaでは常に空白のPDFを返します。エリア外では正常に動作しています。Rotativa PDFを使用してAsp.Net MVC領域の表示を取得するには?

私はすでに試してみてください。

public ActionResult Report() 
    { 
     return new ViewAsPdf("Report") { 
      FileName = "Report.pdf", 
      PageSize = Size.A3, 
      PageOrientation = Orientation.Portrait, 
      PageMargins = { Left = 0, Right = 0 } 
     }; 
    } 

とを:

public ActionResult Report() 
    { 
     return new ViewAsPdf("Report", new { area = "Admin" }) { 
      FileName = "Report.pdf", 
      PageSize = Size.A3, 
      PageOrientation = Orientation.Portrait, 
      PageMargins = { Left = 0, Right = 0 } 
     }; 
    } 

答えて

0

を私のために働いたviewNameパラメータでフルルートを指定します。お使いのコントローラが何であるかわからない、私は

だから.cshtmlにあなたのルートが\エリアであれば、その「何とか」を仮定します\管理\ビュー\何とか\ Report.cshtmlその後、使用:

public ActionResult Report() 
{ 
    return new ViewAsPdf("~\Areas\Admin\Views\Blah\Report.cshtml") { 
     FileName = "Report.pdf", 
     PageSize = Size.A3, 
     PageOrientation = Orientation.Portrait, 
     PageMargins = { Left = 0, Right = 0 } 
    }; 
} 
関連する問題