Wicked_pdf: wkhtmltopdf is not executable on Windows

Created on 8 Oct 2017  路  5Comments  路  Source: mileszs/wicked_pdf

I have this two gems in my Gemfile:

gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'

And on my ruby folder I have this:
image
And this:
image

I have tried setting the config to both folders, but I always get the wkhtmltopdf is not executable error:

WickedPdf.config = {
    exe_path:  "C:/Ruby24/bin/wkhtmltopdf"
  }

Without the config I get this error Bad wkhtmltopdf's path: /c/Ruby24/bin/wkhtmltopdf and which wkhtmltopdf return /c/Ruby24/bin/wkhtmltopdf

I have been looking on StackOverflow but nothing seems to work.

Most helpful comment

Oh! Good point! I didn't realize the documentation in the README was out-of-date. The gem we used to recommend (years ago) did have the windows exe packaged in it, but this gem does not.

I've updated the README in this commit.

Thanks so much for pointing that out!

All 5 comments

Download from here https://wkhtmltopdf.org/downloads.html
unpack, and run or save in c, not in ruby, i dont remember the process, but i think is this.

and your wicked_pdf.rb

WickedPdf.config = {

:exe_path => 'C:wkhtmltopdfbinwkhtmltopdf.exe'

}

It looks to me like your wkhtmltopdf under Ruby24/bin might be either the linux binary (due to it not having a .exe extension, or a symlink, which Windows probably won't like (or could point to the wrong file).

The wkhtmltopdf-binary gem doesn't include a windows build, so you can remove it entirely, unless you also run in a production/staging environment that is linux.

Follow @elisbresciani's advice and download the Windows EXE version, and point your config at it.

Let me know how it goes!

Right, I did end up doing what @elisbresciani recommended.

I found this part of the readme confusing, since as @unixmonkey says "the wkhtmltopdf-binary gem doesn't include a windows build"

The simplest way to install all of the binaries (Linux, OSX, Windows) is through the gem wkhtmltopdf-binary.

Oh! Good point! I didn't realize the documentation in the README was out-of-date. The gem we used to recommend (years ago) did have the windows exe packaged in it, but this gem does not.

I've updated the README in this commit.

Thanks so much for pointing that out!

@elisbresciani muchas gracias!!

Was this page helpful?
0 / 5 - 0 ratings