-
Notifications
You must be signed in to change notification settings - Fork 426
Use with Heroku
[Update] You can use wkhtmltopdf-heroku
gem for Heroku. You do not need to configure anything, just ensure config.wkhtmltopdf
is not being set for Heroku
.
First you need to use the heroku-buildpack-multi:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi.git
Then create a .buildpacks
file in your repo root containing:
https://github.com/heroku/heroku-buildpack-apt
https://github.com/heroku/heroku-buildpack-ruby
https://github.com/a2ikm/heroku-buildpack-libjpeg62
Use apt-get to install wkhtmltopdf. Create an Aptfile
in your repository root with content:
https://wkhtmltopdf.org/downloads.html
And finally instruct PDFKit the location of wkhtmltopdf on Heroku at config/initializers/pdfkit.rb
:
PDFKit.configure do |config|
if File.executable? '/app/.apt/usr/local/bin/wkhtmltopdf'
config.wkhtmltopdf = '/app/.apt/usr/local/bin/wkhtmltopdf'
end
end
libjpeg62 is not installed on cedar-14 (why is it needed for pdfkit?). You can install it with .buildpacks by adding https://github.com/a2ikm/heroku-buildpack-libjpeg62.git.
It may also work by adding libjpeg62 libjpeg62-dev
to Aptfile (but haven't seen any failures without it installed at all, so don't know if this works).