事情就是这样。我在 nodejs 上,我想用 wkhtmltopdf 生成一个 PDF 文件。它在本地运行良好,但是当我将它推到 heroku 上时,出现“应用程序错误”。
我认为这是因为它缺少 Heroku 的二进制 Wkhtmltopdf,你知道吗?或者是别的什么?
事情就是这样。我在 nodejs 上,我想用 wkhtmltopdf 生成一个 PDF 文件。它在本地运行良好,但是当我将它推到 heroku 上时,出现“应用程序错误”。
我认为这是因为它缺少 Heroku 的二进制 Wkhtmltopdf,你知道吗?或者是别的什么?
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.