Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad wkhtmltopdf's path #659

Closed
varmad opened this issue Jun 14, 2017 · 2 comments
Closed

Bad wkhtmltopdf's path #659

varmad opened this issue Jun 14, 2017 · 2 comments

Comments

@varmad
Copy link

varmad commented Jun 14, 2017

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

@unixmonkey
Copy link
Collaborator

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!

@batdevis
Copy link

I added the "$@":

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants