Locally It works without any error but when I try to generate the PDF on the server it trows:
RuntimeError (Failed to execute: ["/usr/local/bin/wkhtmltopdf", "-q", "file:////tmp/wicked_pdf20180531-994-1x8fbfn.html", "/tmp/wicked_pdf_generated_file20180531-994-1vidmtk.pdf"] Error: PDF could not be generated!
Command Error: /usr/bin/env: ruby: No such file or directory ):
Here's what's on my_controller.
pdf=WickedPdf.new.pdf_from_string(render_to_string('disc_bill',:layout=>false))
save_file = Rails.root.join("public","bill.pdf")
File.open(save_file, 'wb') do |file|
file << pdf
end
And in my Gemfile
gem 'wicked_pdf', '~> 1.1' gem 'wkhtmltopdf-binary', '~> 0.12.3.1'
Aucun commentaire:
Enregistrer un commentaire