2012-02-29 63 views
0

我正尝试使用wicked_pdf gem生成PDF报告。 PDF生成工作正常在我的开发环境,但它失败,一旦它的部署在Heroku未能在heroku上部署PDF时创建PDF

这是我收到的错误:

Failed to execute: 
/app/.bundle/gems/ruby/1.9.1/bin/wkhtmltopdf --header-font-name 'Century Gothic' --header-left 'My Test - Neuffen, Germany' --header-right '2012-02-05 15:50:57 -0800' --header-font-size 14 --header-line --footer-center 'Generated by Biowatts - http://biowatts.org' --footer-font-name 'Century Gothic' --footer-font-size 13 --footer-line --toc-font-name 'Century Gothic' --toc-disable-links --toc-disable-back-links  --orientation 'Landscape' --no-background -q - - 
Error: PDF could not be generated! 
.bundle/gems/ruby/1.9.1/gems/wicked_pdf-0.7.2/lib/wicked_pdf.rb:39:in `rescue in pdf_from_string' 

不知道如何解决这个问题?

20120207 - 其他attemps

通过添加这些对我的宝石文件,我得到一个diffenret错误:

group :production do 
    gem "wkhtmltopdf-heroku", :git => 'git://github.com/camdez/wkhtmltopdf-heroku.git' 
end 

的错误:

Location of wkhtmltopdf unknown 
    .bundle/gems/ruby/1.9.1/gems/wicked_pdf-0.7.2/lib/wicked_pdf.rb:20:in `initialize' 

回答

1

您需要打包wkhtmltopdf二进制与您的应用程序,因为它通常不在heroku堆栈上。

它基本上是将二进制文件添加到git,然后告诉你的代码二进制文件的位置。

此处了解详情:http://blog.mattgornick.com/using-pdfkit-on-heroku

+0

我会尝试这一点,但我不知道它是否是不情愿,因为它试图生成PDF时某处写Heroku的堆栈上,看到的第一个错误消息。我的第二次尝试(20120207)与wkhtmltopdf-heroku确实给出了“wkhtmltopdf未知”,这表明它确实在寻找那个二进制文件,但我之前没有这样做。 – zabumba 2012-02-29 20:48:45