1
votes

I have installed Wicked PDF on rails 4, and now I have this issue:

RuntimeError in ClientsController#show

Error: Failed to execute: ["C:/Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe", "--footer-center", "Center", "--footer-left", "Left", "--footer-right", "Right", "file://C:/Users/Rashid/AppData/Local/Temp/wicked_pdf20141017-9664-18xoryq.html", "C:/Users/Rashid/AppData/Local/Temp/wicked_pdf_generated_file20141017-9664-zo89le.pdf"] Error: PDF could not be generated! Command Error: Loading pages (1/6) [> ] 0% [======> ] 10% Error: Failed loading page file://c/Users/Rashid/AppData/Local/Temp/wicked_pdf20141017-9664-18xoryq.html (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to network error: ContentNotFoundError

def show
respond_to do |format|
  format.html
  format.pdf do
    @example_text = "some text"
    render :pdf => "file_name",
           :template => 'clients/show.pdf.erb',
           #:layout => 'pdf',
           :footer => {
               :center => "Center",
               :left => "Left",
               :right => "Right"
           }
  end
 end
end
2
have u added gem "wkhtmltopdf-binary" in your gemfile? If not then add and run bundle installGagan Gami
@Gagan Gami Yes, I did.gmrash

2 Answers

0
votes

I was getting the same error and fixed it by following directions here

https://github.com/mileszs/wicked_pdf/issues/157

Namely I switched to tempory fix of gem by changing gemfile entry to:

gem 'wicked_pdf', github: 'mileszs/wicked_pdf'

I believe it has to do with using file:// instead of file:///.

0
votes

Find wicked_pdf.rb in path/to/gem/wkhtmltopdf/bin, on line 64 replace file:// with file:///.