问题描述
这是事情。我在nodejs上,我想用wkhtmltopdf生成一个PDF文件。
在本地工作正常,但是当我在heroku上推送它时,我有一个应用程序错误。
我认为这是因为它缺少一个用于Heroku的二进制Wkhtmltopdf ,你知道吗?
或者是其他东西?
Heroku不包含 wkhtmltopdf code> binary,但你有两个选项可以在那里工作。
首先是(使用)。
二是直接捆绑 wkhtmltopdf
与您的应用。阅读, and 的指导。实质上,您必须将二进制可执行文件下载到您的应用程序的 / bin
文件夹中,将其推送到Heroku,并正确配置 wkhtmltopdf
的设置。
PS我引用的例子与Ruby有关,但他们很好地概述了为了使Heroku工作需要设置 wkhtmltopdf
。有一个与 wkhtmltopdf
作为参考。
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?
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.
这篇关于在Heroku上使用Wkhtmltopdf和Nodejs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!