混合定位肖像和风景需要从asp.net MVC C生成PDF#
问题描述:
我们正在使用rotativa wkhtmltoPDF在asp.net MVC C#中生成PDF。 我们能够实现所有需要的格式化和索引。所有的好..混合定位肖像和风景需要从asp.net MVC C生成PDF#
我们需要的是有混合的方向。我们的一些页面是肖像,其中一些是风景。 wkhtmltoPDF只支持单向。
有什么办法,我们可以使用混合定向或任何其他库,我们可以用它来实现?
这里是我们使用
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 }
};
的代码下面是我们所使用的方向
--orientation landscape
it made all pages landscape.
答
混合取向的命令没有底层库的支持功能。你可以阅读的功能要求在这里/评论:https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1564
已经有一些解决方法贴出来,像这样的使用CSS(Mixing page orientations in wkhtmltopdf)或通过创建两个或两个以上的PDF文件,然后将它们在一个单独的功能相结合。
嘿,你为什么为这个答案添加点。 https://stackoverflow.com/posts/184701/revisions –