Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pdfkit command failed: "/usr/bin/wkhtmltopdf" "--page-size" "Letter" ".... "--quiet" "-" "-"

i'm using pdfkit for generating pdf when i generate pdf it gives me following error.

command failed: "/usr/bin/wkhtmltopdf" "--page-size" "Letter" 
"--margin-top" "0.75in" "--margin-right" "0.75in" "--margin-bottom" 
"0.75in" "--margin-left" "0.75in" "--encoding" "UTF-8" "--print-media-type" 
"--quiet" "-" "-"

Any help?

  • Ateq
like image 682
Muhammad Ateq Ejaz Avatar asked Jan 21 '13 19:01

Muhammad Ateq Ejaz


1 Answers

Hello Guys i serached it on google and find answer on a blog.Thanks guys.

Solution is here.
(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

Thats it.Now your pdf file will be download. Also visit for further information http://www.stormconsultancy.co.uk/blog/development/generating-pdfs-in-rails-with-pdfkit-and-deploying-to-a-server/

Thanks.

like image 75
Muhammad Ateq Ejaz Avatar answered Oct 27 '22 04:10

Muhammad Ateq Ejaz