Error:
Create PDF Error :
RuntimeError (command failed: "/home/ubuntu/.rvm/gems/ruby-1.9.3-p392@xxx/bin/wkhtmltopdf" "--page-size" "Letter" "--margin-top" "0.75in" "--margin-right" "0.75in" "--margin-bottom" "0.75in" "--margin-left" "0.75in" "--encoding" "UTF-8" "--quiet" "-" "-")
Solution:
(1) first, installing dependencies
$sudo aptitude install openssl build-essential xorg libssl-dev
(2) for
64bits OS Run one by one following commands.
$sudo wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2
$sudo tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
$sudo mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
$sudo chmod +x /usr/local/bin/wkhtmltopdf
Finally Go to your rails
app/config/initializer Folder and create new file pdfkit.rb and paste following code in it.
PDFKit.configure do |config|
config.wkhtmltopdf = '/usr/local/bin/wkhtmltopdf' if Rails.env.production?
end
I refer
generating-pdfs-in-rails-with-pdfkit-and-deploying-to-a-server link