csquared/IMGKit

Running on Windows

Opened this issue · 0 comments

I was having numerous problems while running on Windows. This is how I solved it -

  1. Download the wkhtmltox-0.12.5-1.mxe-cross-win64.7z file from the wkhtmltopdf releases page.

  2. Extract and get the full path to the exe file which is located in the bin folder.

  3. In the beginning of my program, I added the following in the IMGKit.configure block.

Path with backslashes escaped -

IMGKit.configure do |config|
  config.wkhtmltoimage = "D:\\wkhtmltox\\bin\\wkhtmltoimage.exe"
end

Or, path with backslashes replaced by forward slashes.

IMGKit.configure do |config|
  config.wkhtmltoimage = "D:/wkhtmltox/bin/wkhtmltoimage.exe"
end

Note: The path can contain spaces. Ruby parses it correctly regardless.