Rails:wkhtmltopdf RuntimeError(wkhtmltopdf 的位置未知) [英] Rails: wkhtmltopdf RuntimeError (Location of wkhtmltopdf unknown)
问题描述
我正在使用 Ubuntu 11.04 在 Ruby on Rails 中开发应用程序.在应用程序中,我需要生成 pdf 文档.所以我正在使用wicked_pdf 和 wkhtmltopdf-binary gems.
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 在 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导轨 3.1.1
I am using Ruby1.9.2.p136 Rails 3.1.1
任何帮助将不胜感激....谢谢.
Any help will be much appreciated....Thanks.
推荐答案
你使用静态 wkhtmltopdf 二进制文件吗?我下载了 here 并将其提取到 /path/to/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,
}
这篇关于Rails:wkhtmltopdf RuntimeError(wkhtmltopdf 的位置未知)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!