使用Rotativa在我的mvc4应用程序中创建pdfs。问题是如何在pdf上显示页码。
答案 0 :(得分:3)
您应该能够通过向Rotativa * AsPdf添加CustomSwitches属性来利用wkhtmltopdf上的页脚选项。 看看http://madalgo.au.dk/~jakobt/wkhtmltoxdoc/wkhtmltopdf-0.9.9-doc.html
答案 1 :(得分:3)
此代码将在页脚中心为您提供页码。
return new Rotativa.ViewAsPdf()
{
CustomSwitches = "--page-offset 0 --footer-center [page] --footer-font-size 8"
}
使用--page-offset选项设置起始页码。 将页面偏移设置为0,页面编号将从1开始(这也是默认选项)。 可以通过指定--footer-font-size选项来控制字体大小。