Rails:wkhtmltopdf RuntimeError(wkhtmltopdf的位置未知)

问题描述:

我正在使用Ubuntu 11.04在Ruby on Rails中开发应用程序。
在应用程序中,我需要生成pdf文档。因此,我正在使用
的wicked_pdf和wkhtmltopdf-binary宝石。

I am using Ubuntu 11.04 to develop an app in Ruby on Rails. In the app I need to generate pdf documents. So I am using the wicked_pdf and wkhtmltopdf-binary gems.

在系统的开发环境中,一切正常。
但是一旦我使用Phusion
Passenger将应用程序部署到CentOS 5.6上的生产中后,当我尝试快速生成pdf时,就会出现以下错误:

In the development environment in my system everything is working fine. But once I deployed the app in production on CentOS 5.6 using Phusion Passenger, when I try to generate pdfs on the fly its giving me the following error:

RuntimeError(wkhtmltopdf的位置未知)

我正在使用Ruby1.9.2.p136
Rails 3.1.1

I am using Ruby1.9.2.p136 Rails 3.1.1

任何帮助将不胜感激。

您是否使用静态wkhtmltopdf二进制文件?我在此处下载了它,并将其扩展到 / path /到/ rails_app / bin

do you use static wkhtmltopdf binary? i downloaded it here and extraced it to /path/to/rails_app/bin

并将其添加到如下所示的rails中:

and add it to rails like this:

#config/initializers/wicked_pdf.rb
WickedPdf.config = {
  :exe_path => Rails.root.join('bin', 'wkhtmltopdf-i386').to_s,
}