On my Macbook I have wkhtmltopdf
installed and when I do wkhtmltopdf -V
I get:
wkhtmltopdf 0.12.2.1 (with patched qt)
When I deploy the Rails app to Heroku, the PDF renders different. So I checked the version on Heroku with heroku run "wkhtmltopdf -V"
, but that gives me:
bash: wkhtmltopdf: command not found
.
The PDF itself renders fine on Heroku, so there must be a wkhtmltopdf
installed I guess? I followed these instructions to create a buildpack, but with no change when I request the version:
https://elements.heroku.com/buildpacks/rafaelp/heroku-buildpack-wkhtmltopdf
In the Gemfile
I have this:
group :development do
gem 'wkhtmltopdf-binary-edge', '~> 0.12.2.1'
end
So, how do I properly install wkhtmltopdf
on Heroku and make sure the version is the same as on my Macbook?
You're probably seeing a conflict in versions here between a binary bundled in the gem you're using in development, and another binary.
You should manually manage your wkhtmltopdf binary manually in development & heroku (homebrew/apt-get + buildpack), or use a gem which includes the binaries in both environments. Not a mix of both, as you'll get inconsistent results.
Personally, I use this buildpack on heroku and use brew to install the version I need locally for development.