We are using rotativa wkhtmltoPDF to generate PDF in asp.net MVC C#. We were able to achieve all the required formating and indexing. All good..
What we need is to have mixed orientation. Our some of the pages are portrait and some of them landscape. wkhtmltoPDF only support single orientation.
Is there any way, we can use mixed orientation or any other library which we can use to achieve?
Here is the code which we are using
string tocXslPath = Server.MapPath("/Rotativa/toc.xsl");
string customSwitches = string.Format("--print-media-type --enable-smart-shrinking --header-html {0} --header-spacing \"4\" --footer-html {1} --footer-spacing \"4\" cover {2} cover {3} " + coverPages + " toc --xsl-style-sheet " + tocXslPath + " ", Url.Action("Header", "Home", new { area = "" }, "http"), Url.Action("Footer", "Home", new { area = "" }, "http"), Url.Action("CoverTitle", "Home", new { area = "" }, "http"), Url.Action("CoverAll", "Home", new { area = "" }, "http"), Url.Action("EmptyCover", "Home", new { area = "" }, "http"));
return new Rotativa.ViewAsPdf("ProjectPdf")
{
FileName = "Project.pdf",
CustomSwitches = customSwitches,
PageMargins = { Top = 15, Bottom = 15 }
};
Here is the command which we are using for orientation
--orientation landscape
it made all pages landscape.