zeypo
zeypo

Reputation: 33

Using Wkhtmltopdf with Nodejs on Heroku

Here is the thing. I'm on nodejs and I want to generate a PDF file with wkhtmltopdf. It works fine locally, but when I push it on heroku I have an "Application Error".

I think it's because it's missing a binary Wkhtmltopdf for Heroku, do you know one? Or is it something else?

Upvotes: 0

Views: 1450

Answers (1)

Arman H
Arman H

Reputation: 5618

Heroku doesn't include the wkhtmltopdf binary, but you have two options to get it working there.

First is to build wkhtmltopdf from source on Heroku (using the Vulcan gem).

The second is to directly bundle wkhtmltopdf with your app. Read through this, this and this for guidance. Essentially, you have to downloading the binary executable into your app's /bin folder, push it to Heroku, and correctly configure wkhtmltopdf's settings from within the app.

P.S. The examples I cited deal with Ruby, but they give a good overview of what needs to be set up for wkhtmltopdf to work on Heroku. There is a sample Rails app pre-integrated with wkhtmltopdf for reference.

Upvotes: 2

Related Questions