wkhtmltopdf_binary_gem icon indicating copy to clipboard operation
wkhtmltopdf_binary_gem copied to clipboard

Windows platforms?

Open m-baumgartner opened this issue 9 years ago • 4 comments

Is there any way we can make this work on Windows? wkhtmltopdf has Windows packages. Am I missing something here?

m-baumgartner avatar Jul 09 '15 15:07 m-baumgartner

If you can make it work, I'll gladly merge it in. Do you know if they need to run an installer, or if the exe alone is enough?

unixmonkey avatar Jul 14 '16 15:07 unixmonkey

I had a quick go at this, my theory is that you could just extract the contents of wkhtmltox-0.12.4_msvc2015-win64.exe into the bin/ folder and then modify the contents of bin/wkhtmltopdf to match on /mingw32/

However I got stuck with Cygwin path hacks getting in the way with https://github.com/mileszs/wicked_pdf/. wicked_pdf was correctly reporting the executable path of this binary as /cygdrive/c/Ruby/lib/ruby/gems/2.3.0/bin/wkhtmltopdf, but File.exist?("/cygdrive/c/Ruby/lib/ruby/gems/2.3.0/bin/wkhtmltopdf") == false.

My Cygwin knowledge isn't strong enough to continue, so a much easier solution with wicked_pdf on Windows is to just install the Windows package, and set the path manually in config/initializers/wicked_pdf.rb:

if RbConfig::CONFIG['host_os'].match(/mingw32/)
  WickedPdf.config[:exe_path] = 'C:\\program files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe'
end

soundasleep avatar Jan 16 '18 21:01 soundasleep

Is there any way we can make this work on Windows? wkhtmltopdf has Windows packages. Am I missing something here?

@m-baumgartner , I'm curious; is your Ruby application currently on Windows in production or is this request purely for dev purposes?

webaholik avatar Nov 08 '19 12:11 webaholik

@unixmonkey I think we can close it 🤝 🍻

pedrofurtado avatar Jul 23 '21 21:07 pedrofurtado