mileszs/wicked_pdf — Issue #61: WickedPDF model callbacks and RVM path issue
Author: activestylus
Created: 2011-11-04 19:34:37+00:00
State: open

A rough example of what I'm trying:

before_save :generate_pdf

def generate_pdf
pdf = WickedPdf.new.pdf_from_string("

test

")
save_path = Rails.root.join('public','system','pdfs',domain_name,'filename.pdf')
File.open(save_path, 'wb') do |file|
file << pdf
end
end

When I call that method I see that Rails is looking in the wrong place for wkhtmltopdf

RuntimeError: Failed to execute:
/Users/home/.rvm/gems/ruby-1.9.2-p290@myapp/bin/wkhtmltopdf -q - -

I can successfully generate PDFs from the standard controller method. This problem only occurs from the model.

Any tips?