2017-04-05 22 views
0

Ich verwende Rotativa-Ressourcen, um PDF-Dateien von meiner HTML-Seite in einem MVC ASP.NET-Projekt zu erstellen. Hier ist mein Code:Rotativa HTML zu PDF auf ASP.NET MVC: Wie erstellt man PDF als Landschaft?

Controller:

public class HomeController : Controller 
{ 
    public ActionResult Index() 
    { 
     return View(); 
    } 

    public ActionResult ExportPDF() 
    { 
     return new ActionAsPdf("Index") 
     { 
      FileName = Server.MapPath("~/Content/Relato.pdf") 
     }; 
    } 
} 

Ansicht

<a href="@Url.Action("ExportPDF","Home")" class="hidden-print" >EXPORT PDF</a> 

Die PDF-Dokumente im Hochformat-Layout erstellt werden, sind. Wie könnte ich sie in ein Landschaftslayout setzen?

Prost!

Antwort

0

Nur das Problem gelöst. Hier ist der aktualisierte Code (siehe PageOrientation und PageSize Zeilen):

public ActionResult ExportPDF() 
     { 
      return new ActionAsPdf("Index") 
      { 
       FileName = Server.MapPath("~/Content/Relato.pdf"), 
       PageOrientation = Rotativa.Options.Orientation.Landscape, 
       PageSize = Rotativa.Options.Size.A4 
      }; 
     } 

Prost!