2014-10-17 76 views
1

我已經安裝了妖獸PDF上軌道4,現在我有這個問題:妖獸PDF RuntimeError

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 
+0

是否在你的gemfile中添加了'gem「wkhtmltopdf-binary」'?如果沒有,然後添加並運行'捆綁安裝' – 2014-10-17 10:38:28

+0

@Gagan Gami是的,我做到了。 – gmrash 2014-10-21 05:10:10

回答

0

我得到了同樣的錯誤,並按照這裏的方向

https://github.com/mileszs/wicked_pdf/issues/157固定它

即我通過更改gemfile條目切換到gem臨時修復:

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

我相信它與使用file://而不是file:///有關。

0

找到path/to/gem/wkhtmltopdf/bin中的wicked_pdf.rb,在線64替換file://file:///