Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 999
Ali Avatar asked Feb 21 '23 05:02

Ali


1 Answers

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
like image 73
fl00r Avatar answered Mar 05 '23 00:03

fl00r