Ruby on rails 4 使用PDFKit(包括表格标题)启动新页面

Ruby on rails 4 使用PDFKit(包括表格标题)启动新页面,ruby-on-rails-4,pdf,wkhtmltopdf,pdfkit,Ruby On Rails 4,Pdf,Wkhtmltopdf,Pdfkit,我在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',:mar

我在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")
您可以使用“wicked_pdf”,它将html页面转换为具有所有html样式的pdf

<% if params[:format] == "html"%>
  <%= render template: "reports/term_loan_report_data_header.html.erb"%>
<%end%>