我在用着
Windows 7
Rails 3.2.11
wkhtmltopdf 0.9.9
在宝石文件中
gem 'wicked_pdf'
在我的初始化程序中
WickedPdf.config = { :exe_path => 'C:\wkhtmltopdf' }
exe位于
C:\wkhtmltopdf\wkhtmltopdf.exe
当我从rails c运行时
irb(main):001:0> WickedPdf.new.pdf_from_string('<h1>Hello There!</h1>')
我收到以下错误...
" * ** * *** \"C:\wkhtmltopdf\"
\"file:///C:/Users/bob/bob_rail s_demo/Course_Stats/wicked_pdf20130307-6328-7cuwz7.html\" \"C:/Users /bob/wful ts_rails_demo/Course_Stats/wicked_pdf_generated_file20130307-6328-n902yj.pdf\" * * ** * **" RuntimeError: 执行失败: "C:\wkhtmltopdf" "file:///C:/Users/bob/bob_rails_demo/Course_Stats/wicked_pdf20130307-6328-7cuwz7.html" "C:/Users/bob/bob_rails_demo/Course_Stats /wicked_pdf_generated_file20130307-6328-n902yj.pdf" 错误:权限被拒绝 - "C:\wkhtmltopdf" "file:///C:/Users/bob/wful ts_rails_demo/Course_Stats/wicked_pdf20130307-6328-7cuwz7.html" "C:/用户/bob /bob_rails_demo/Course_Stats/wicked_pdf_generated_file20130307-6328-n902yj.pd f" 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/wicked_pdf-0.9 .4/lib/wicked_pdf.rb :50:inrescue in pdf_from_string' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/wicked_pdf-0.9 .4/lib/wicked_pdf.rb:34:in
pdf_from_string' 来自 (irb):1 来自 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands/console.rb :47:在start' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands/console.rb:8:in
从 C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 开始' 1/lib/rails/commands.rb:41:in<top (required)>' from script/rails:6:in
来自 script/rails:6 :在`'
如果我将此行更改为此...
WickedPdf.config = { :exe_path => 'C:\wkhtmltopdf\wkhtmltopdf.exe' }
然后在 rails 命令行中运行它似乎可以工作,但在我的应用程序中,机架中间件只是挂起......