【发布时间】:2016-02-03 05:20:32
【问题描述】:
我在 Rails 中使用 PDFKit 来显示我的数据库中的表记录。我想在当前页面没有空间时显示新页面继续记录以及表头。我怎样才能做到这一点?
html_content = render_to_string(:template => "example/pdf_example.html.erb",:layout => false)
pdf_convert = PDFKit.new(html_content, :margin_right => '0.1in',:margin_left => '0.1in',:margin_top => '0.1in',:margin_bottom => "0.1in",:page_size => "A4", :orientation => 'landscape')
report_name = "example report"
send_data(pdf_convert.to_pdf,:filename=>"#{report_name}.pdf")
【问题讨论】:
标签: ruby-on-rails-4 pdf wkhtmltopdf pdfkit