1

I am trying to use pdf generator in my rails 2.3app. It is working fine in my local machine and pdf is generating. In my production server (nginix) it is not working and shows the error:

"wkhtmltopdf RuntimeError (Location of wkhtmltopdf unknown)" 

In the config/initializers/wicked_pdf.rb.example file I have mentioned the path to the binary exe file as:

WickedPdf.config = { :wkhtmltopdf => '/opt/wkhtmltopdf-amd64', :layout => 'pdf.html' :header => {:html => {:template=> 'layouts/pdf_header.html'}} } 

And in the opt folder there is wkhtmltopdf-amd64 binary exe file.

3
  • Please look into this stackoverflow.com/questions/7723937/… thanks Commented Jul 17, 2013 at 8:23
  • its working now... It was due to the file name error. I had renamed the wicked_pdf.rb.example to wicked_pdf.rb and it worked.. Commented Jul 17, 2013 at 8:25
  • ok thanks one suggestion please use your executable with in rails app Commented Jul 17, 2013 at 8:27

2 Answers 2

1

:wkhtmltopdf => '/opt/wkhtmltopdf-amd64',

This is your system opt folder, check whether this folder has permission to execute the binary.

Alternatively change the location of wkhtmltopdf into your rails application by extracting it to /path/to/rails_app/bin

and then change your initializer to :wkhtmltopdf => Rails.root.join('bin', 'wkhtmltopdf-amd64').to_s

Sign up to request clarification or add additional context in comments.

Comments

0

can we replace the path with installed gem at gemset? At terminal just check 'which wkhtmltopdf' is installed in our app gemset path.Then replace the path your wkhtmltopdf initializer with that.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.