mercredi 29 août 2018

wkhtmltopdf falis for 1000+ pages ruby on rails

Generating a pdf of 1000+ pages fails in case of header supplied. layouts/header is a header.pdf.haml file. After going through various suggestions, increased the open files limit on ubuntu also didn't work.

respond_to do |format|
  format.html
  format.xlsx
  format.pdf { render pdf: "Test report", dispoistion: :attachment,
      :show_as_html => (params[:d].present? && params[:d] == "true"),
      layout: "pdf.html.haml",
      margin: {
        top: 38
      },
      header: {
        spacing: 2,
        html: {
          template: 'layouts/header',
          formats:  [:pdf],
          handlers: [:haml],
          layout: nil,
          locals: {
            title: "Test Report"
          }
        }
    }
  }
end

Aucun commentaire:

Enregistrer un commentaire