2

I am trying to generate PDF reports with wicked_pdf gem. THe PDF generation works fine on my development environment, but it fails once it's deployed on Heroku

This is the error I am getting:

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'

Any idea how to address this issue?

20120207 - Additional attemps

When adding these to my gem file, I get a diffenret error:

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

The Error:

Location of wkhtmltopdf unknown
  .bundle/gems/ruby/1.9.1/gems/wicked_pdf-0.7.2/lib/wicked_pdf.rb:20:in `initialize' 
zabumba
  • 12,172
  • 16
  • 72
  • 129
  • Ok I tried to improve the description text. Still I don't understand the overzealous -1? Also I'd be grateful to have my question reopened. – zabumba Feb 06 '12 at 22:48
  • I voted for reopening. I do not quite understand why it is closed. Did you find a solution? – nathanvda Mar 07 '12 at 21:07
  • Work around only and use another gem. gem "pdfkit", "~> 0.5.2" but ended up with a compatibility problem with Rails 3.1 assets. It's fixed in 3.2 apparently. This video helped a lot http://railscasts.com/episodes/220-pdfkit and you need to add wkhtmltopdf binary to your-project/app/bin – zabumba Mar 08 '12 at 22:12
  • Ok. I got it to work with wicked-pdf and the wkhtmltopdf-heroku gem. But good you found a solution. – nathanvda Mar 08 '12 at 22:45
  • I'd still be interested if/when you have the time to punch a few lines on how you had it fixed. I liked wicked_pdf. Cheers – zabumba Mar 10 '12 at 00:54
  • 1
    Since I can't answer here, I wrote a small blogpost about it: http://www.dixis.com/?p=634 It turned out to be incredibly easy. – nathanvda Mar 10 '12 at 20:59
  • Check out my answer to this here http://stackoverflow.com/a/16577677/307308 It works perfectly! – scarver2 May 16 '13 at 02:30

1 Answers1

2

Are you using proper wkhtmltopdf library? Something like this one:

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