I am trying to use the NuGet package RazorPDF2 to convert a Razor View to a PDF. The tool works wonderfully and is simple to use for just rendering a PDF, but I cannot figure out how to change the page orientation to landscape.
I am using very simple controller code just to test the conversion to PDF. The conversion works, but I cannot change the orientation.
public ActionResult TrainingCertificate()
{
var model = new CertificateModel();
model.Name = "Michael White";
return new PdfActionResult("TrainingCertificate", model);
}
The "PdfActionResult" method does have an overload that looks like it might take configuration settings, but I cannot figure out how to use it because the parameter is an "encapsulated" "Action":
public PdfActionResult(string viewName, object model, Action<iTextSharp.text.pdf.PdfWriter, iTextSharp.text.Document> configureSettings) : base(viewName, model, configureSettings)
{
}
Does anyone have any experience with this tool or can help with figuring out what is needed for the "configurationSettings" parameter, please help. Thanks!
Okay, so I figured this one out. I changed the return "PdfActionResult" code to the following: