I'm using
Windows 7
Rails 3.2.11
wkhtmltopdf 0.9.9
in gemfile
gem 'wicked_pdf'
In my initializer
WickedPdf.config = { :exe_path => 'C:\wkhtmltopdf' }
Exe is located at
C:\wkhtmltopdf\wkhtmltopdf.exe
When I run from rails c
irb(main):001:0> WickedPdf.new.pdf_from_string('<h1>Hello There!</h1>')
I get the following error...
"*******\"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: Failed to execute: "C:\wkhtmltopdf" "file:///C:/Users/bob/bob_rails_demo/Course_Stats/ wicked_pdf20130307-6328-7cuwz7.html" "C:/Users/bob/bob_rails_demo/Course_S tats/wicked_pdf_generated_file20130307-6328-n902yj.pdf" Error: Permission denied - "C:\wkhtmltopdf" "file:///C:/Users/bob/wful ts_rails_demo/Course_Stats/wicked_pdf20130307-6328-7cuwz7.html" "C:/Users/bob /bob_rails_demo/Course_Stats/wicked_pdf_generated_file20130307-6328-n902yj.pd f" from 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' from (irb):1 from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 1/lib/rails/commands/console.rb:47:instart' 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
start' from 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
require' from script/rails:6:in `'
If I change this line to this...
WickedPdf.config = { :exe_path => 'C:\wkhtmltopdf\wkhtmltopdf.exe' }
Then run it in the rails command line it appears to work, but in my app Rack middleware is just hanging...
I ran into the same issue, except originally I had my exe located at C:\Program Files (x86)\wkhtmltopdf\wkhtmltopdf.exe
So I changed it to C:\wkhtmltopdf\wkhtmltopdf.exe
(which you already have) and then I made my :exe_path
this: :exe_path => 'C:\wkhtmltopdf\wkhtmltopdf.exe'
I believe the reason you have to add the .exe in a windows environment is because windows needs to have the file explicitly pathed. Once I did this it worked like a charm.
Let me know how it goes (or went)!