问题描述
我正在使用 Rails gem PDFKit 创建 PDF。主要内容是渲染,但我想在 PDF 页脚中显示页数。
html = ERB.new(File.read(Rails.root.join("app/views","report/_pdf_report.html.erb"))).result(binding)
kit = PDFKit.new(html,root_url: "#{Rails.root}/app/assets/images/logo.jpg",:page_size => 'A4',:margin_top => '25px',:margin_right => '5px',:margin_bottom => '0px',:margin_left => '5px',:footer_center => "footer",)
使用上述代码页脚不会显示在 PDF 上。如果我在 pdf 中搜索给页脚,chrome 会显示匹配的单词但不显示。
@media print {
#footer {
color: black;
display: block;
}
#footer_center {
display: block;
color: black;
}
}
我已将此代码绑定在我的 pdf html.erb 样式标记文件中,但没有成功。
提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)