我正在使用Rotativa 1.6.1版本将视图转换为PDF。现在我试图在所有页面上显示带有图像的页脚文本。我使用了以下code snippets:
string customSwitches = string.Format("--header-html \"{0}\" " +
"--header-spacing \"0\" " +
"--footer-html \"{1}\" " +
"--footer-spacing \"10\" " +
"--footer-font-size \"10\" " +
"--header-font-size \"10\" ", header, footer);
return new Rotativa.ViewAsPdf("_PDF_Desgin.cshtml", List)//_PDF_Desgin.cshtml is control Page
{
FileName = "PdfFileName.pdf",
PageSize = Size.A4,
PageOrientation = Orientation.Landscape,
CustomSwitches = customSwitches
};
但不幸的是,这不符合我的情况。你能帮我弄清楚在所有生成的PDF文件中显示带有图像的页脚文本的正确用法。
谢谢和问候, Viju。
答案 0 :(得分:1)
我已经找出问题并使用PageMargins属性显示了页脚模板。
return new Rotativa.ViewAsPdf("_PDF_Desgin.cshtml", List)//_PDF_Desgin.cshtml is control Page
{ FileName = fileName,
IsJavaScriptDisabled = false,
CustomSwitches = customSwitches,
//CustomSwitches = "--no-stop-slow-scripts --print-media-type --javascript-delay 5000 --disable-smart-shrinking",
PageOrientation = Rotativa.Options.Orientation.Portrait,
PageSize = Rotativa.Options.Size.A4,
PageMargins = new Margins(0, 3, 32, 3),
};
谢谢和问候, Viju