-
Notifications
You must be signed in to change notification settings - Fork 2
Ubuntu WKHTMLTOPDF and rvm
For whatever reason, in Ubuntu LTS 64-bit wkhtmltopdf wouldn't install using
pdfkit --install-wkhtmltopdf
It just came over as a lzma file. It would appear in my 'path' so it appeared to be a working executable.... but that wasn't the case.
I am using RVM and adopted the user policy that EVERYTHING should be self contained in ~/ or that user's home directory.
I removed all instances of the existing wkhtmltopdf in /usr/local/bin
sudo rm /usr/local/bin/wkhtmltopdf
I then used wget to get the latest wkhtmltopdf for a 64 bit system and then uncompressed and untar'd the thing in an rvm gem directory. I probably should have put it somewhere else, but this will do for now.
cd /home/pjammer/.rvm/gems/ruby-1.8.7-p249/bin/
wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_beta5-static-amd64.tar.lzma
lzma -d wkhtmltopdf-0.10.0_beta5-static-amd64.tar.lzma
tar -xf wkhtmltopdf-0.10.0_beta5-static-amd64.tar
rm wkhtmltopdf-0.10.0_beta5-static-amd64.tar
mv wkhtmltopdf-amd64 wkhtmltopdf
I then restarted my app for good measure.
Lastly, make sure you change your production.rb environment file (2.3.5 here, the good rails version :-) to something like:
config.middleware.use PDFKit::Middleware, :print_media_type => true, :wkhtmltopdf => '/home/pjammer/.rvm/gems/ruby-1.8.7-p249/bin/wkhtmltopdf'