After reading around it seemed to me that Prawn is out and wkhtmltopdf is in. It also seems like the PDFKit and wicked_pdf gems for Rails are the new co
Mine was also hanging and opening the wkhtmltopdf icon in the dock.
I actually found the problem for me was I only had 1 unicorn worker process running. Once I added more than 1 it worked fine.
I'm running wkhtmltopdf 0.9.9 on OS X with pdfkit 0.6.2
Try the last version. The easy way install on MacOS:
brew install Caskroom/cask/wkhtmltopdf
The problem is with wkhtmltopdf itself, specifically, any version after 0.9.9. wkhtmltopdf hangs when run directly from the command-line.
Steps to correct:
brew uninstall wkhtmltopdf
cd /usr/local/Library/Formula/
git checkout 6e2d550 /usr/local/Library/Formula/wkhtmltopdf.rb
brew install wkhtmltopdf
Then verify the correct version is installed wkhtmltopdf --version
which should yield wkhtmltopdf 0.9.9
Citations:
Exact same symptoms but using WickedPdf
currently. At this point, I believe the issue lies with wkhtmltopdf
as well.
Unfortunately, neither of the recommendations I've been able to find in Stack/Google worked for me. Instead, I needed to combine several suggestions, including some found in this post.
Solution was:
brew uninstall wkhtmltopdf
wkhtmltopdf
in /usr/bin
WickedPdf.config
line in config/initializers
config.threadsafe!
to development.rb
wkhtmltopdf-binary
to gemfileMime::Type.register_alias "application/pdf", :pdf
to config/initializers/mime_types.rb
(for me, this causes 'warning: already initialized constant PDF')My set-up was: Mac OSX Mountain Lion with Rails 3.2.1, Webrick, Postgres and wkhtmltopdf-binary (0.9.9.1).
Try editing config/initializer/pdfkit.rb
in the following way:
PDFKit.configure do |config|
config.wkhtmltopdf = Rails.root.join('bin', 'wkhtmltopdf-i386').to_s
config.default_options = {
:encoding=>"UTF-8",
:page_size=>"A4",
:margin_top=>"0.25in",
:margin_right=>"0.1in",
:margin_bottom=>"0.25in",
:margin_left=>"0.1in",
:disable_smart_shrinking=> false
}
end
I got the same issue. It works when I added: 'config.threadsafe!' in application.rb as the answer in the stack. Hope this help.