0

I am trying to use wicked_pdf in my rails 3 application. I have followed all the tutorials and I am getting this error:

Failed to execute:
"/usr/local/bin/wkhtmltopdf" -q        "file:////var/folders/_b/50kywsc97r95gvr9gy9nr6700000gn/T/wicked_pdf20130228-874-a51lgi.html" "/var/folders/_b/50kywsc97r95gvr9gy9nr6700000gn/T/wicked_pdf_generated_file20130228-874-1ihqg74.pdf"

I know that wkhtmltopdf exists in the right place because when I type which wkhtmltopdf I am shown the path above. I also get told it's there when I try to brew install again. Furthermore when I type wkhtmltopdf google.com google.pdf it runs fine.

My controller looks like this:

def show #shows some material
@material = Material.find(params[:id])
  respond_to do |format|
    format.html
    format.pdf do
      render :pdf => '#{@material.id}',
             :wkhtmltopdf => '/usr/local/bin/wkhtmltopdf'
    end
  end

end

Any suggestions? Does this seem like a wkhtmltopdf issue or a wicked_pdf issue? I have bundle installed everything and bundle updated everything. I have added the wkhtmltopdf-binary gem (which shouldn't be necessary). It doesn't work on heroku either.

4

2 回答 2

0

听起来那里可能有一些 wkhtmltopdf 图像。如果 rails 正在尝试使用 /usr/local/bin/wkhtmltopdf,请尝试从终端执行命令 /usr/local/bin/wkhtmltopdf 并查看运行该命令是否有任何问题。如果您有几个来自不同 gem 安装的副本,那么在您的搜索路径中首先运行的那个可能不是 rails 正在尝试的那个。

希望能帮助到你

鲍勃

于 2013-03-12T05:20:59.820 回答
0

首先验证二进制文件的位置

  1. 打开终端提示符并输入

    $ which wkhtmltopdf

我机器的回报是

/usr/local/bin/wkhtmltopdf

  1. 验证二进制文件是否运行良好

    wkhtmltopdf google.com google它必须使用谷歌网页生成pdf

  2. 在初始化程序中创建一个类

看我的要点

就这样

于 2013-05-14T17:20:39.020 回答