I've done hours of research trying to get PDFKit to work in my production environment. Everything works fine in development, and "kind of" works on my production server.
- I'm running 64bit Ubuntu server with Nginx/Passenger.
- I can successfully create a pdf from my web root using
wkhtmltopdf google.com public/test5.pdf
-- so I know that wkhtmltopdf is installed and working - I can successfully create a PDF using PDFKit using
rails console
where i can runkit = PDFKit.new('http://google.com')
thenfile = kit.to_file('public/test.pdf')
-- so at least in rails console I know that PDFKit is able to run successfully
But, this just isn't working on the actual website. When I visit the URL (which works in development mode) http://staging.myapp.com/tours/5/print_tour.pdf
I get the "We're sorry but something went wrong" error. My Passenger error log only shows this:
- Rack: /home/deploy/myapp/current: No such file or directory - bundle exec which wkhtmltopdf
- But, I can run
bundle exec which wkhtmltopdf
fine from my web root?
I'm stumped as wkhtmltopdf runs fine from the command line, as does PDFKit in rails console, but somehow something breaks when serving the page from Nginx/Passenger. Help! :-)
wkhtmltopdf
started underxvfb
mode right – Viren