Wicked_pdf: Bad wkhtmltopdf's path

Created on 14 Jun 2017  路  2Comments  路  Source: mileszs/wicked_pdf

I am getting following error

Bad wkhtmltopdf's path: xvfb-run -- /usr/bin/wkhtmltopdf

If I run same command on Ubunutu 16.04 CLI pdf is generated

Could any one please help me on this..

Regards,
Varma

Most helpful comment

I added the "$@":

echo '#!/bin/bash
xvfb-run -- /usr/bin/wkhtmltopdf  "$@"' > bin/wicked_pdf
chmod +x bin/wicked_pdf

All 2 comments

That message is coming from this line.

I'm guessing your config/initializers/wicked_pdf.rb looks something like this:

WickedPdf.config = {
  exe_path: 'xvfb-run -- /usr/bin/wkhtmltopdf'
}

which is currently not supported, as there are checks that make sure that string is a valid path to an executable file.

There is a PR to address this, but I'm not yet sure the benefits outweigh the risks of removing valuable error messages, and want to tweak it a bit.

A good workaround would be to create a new executable stub something like this:

echo echo '#!/bin/bash
xvfb-run -- /usr/bin/wkhtmltopdf' > bin/wicked_pdf
chmod +x bin/wicked_pdf

and change your initializer to point to this new file

WickedPdf.config = {
    exe_path: Rails.root.join('bin', 'wicked_pdf').to_s
}

Let me know how it goes!

I added the "$@":

echo '#!/bin/bash
xvfb-run -- /usr/bin/wkhtmltopdf  "$@"' > bin/wicked_pdf
chmod +x bin/wicked_pdf
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gregblass picture gregblass  路  4Comments

amerritt14 picture amerritt14  路  4Comments

BlakeWard picture BlakeWard  路  3Comments

EdouardPan picture EdouardPan  路  6Comments

m-andreas picture m-andreas  路  5Comments