Can't create pdfs with pdfkit - PDFKit::NoExecutableError

Ali picture Ali · Mar 7, 2012 · Viewed 8k times · Source

I got pdfkit install and even set up wkhtmltopdf installed as well however I'm getting the following error everytime I try to create a pdf.

PDFKit::NoExecutableError 
No wkhtmltopdf executable found at bundler: command not found: which
Install missing gem executables with `bundle install`
>> Please install wkhtmltopdf - https://github.com/jdpace/PDFKit/wiki/Installing-WKHTMLTOPDF

My Gemfile has the following:

gem 'jquery-rails'
gem 'devise'
gem 'carrierwave'
gem "wkhtmltopdf"
gem 'pdfkit'

And my application.rb has the following entry:

config.middleware.use "PDFKit::Middleware", :print_media_type => true

am I missing something here - I've run a bundle install but still get this error everytime I try to create a pdf. Please help

Answer

fl00r picture fl00r · Mar 7, 2012

You should read Install readme here:

https://github.com/jdpace/PDFKit

so you need to install wkhtmltopdf manualy:

https://github.com/jdpace/PDFKit/wiki/Installing-WKHTMLTOPDF

or like this

gem install wkhtmltopdf-binary

PS

check which wkhtmltopdf

and create new file config/initializers/pdfkit.rb

PDFKit.configure do |config|
  config.wkhtmltopdf = 'PATH/TO/wkhtmltopdf'
end