Created
June 22, 2016 09:23
-
-
Save WiredUK/695a3e9873dc3ebf2d42254f9844e133 to your computer and use it in GitHub Desktop.
Example code to output landscape PDF when using Wired.RazorPdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult LandscapeControllerlessPdfWithoutLayout() | |
{ | |
var generator = new StandaloneGenerator(new Parser(), Server.MapPath("~")); | |
var pdf = generator.GeneratePdf( | |
(writer, document) => | |
{ | |
document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); | |
}, | |
GetModel(), | |
Server.MapPath("~/Views/Pdf/ControllerlessPdfWithoutLayout.cshtml")); | |
return new FileContentResult(pdf, "application/pdf"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment