Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 糟糕的工作HTMLTOPDF';s wicked_pdf和wkhtmltopdf的路径_Ruby On Rails 4_Spree_Wicked Pdf - Fatal编程技术网

Ruby on rails 4 糟糕的工作HTMLTOPDF';s wicked_pdf和wkhtmltopdf的路径

Ruby on rails 4 糟糕的工作HTMLTOPDF';s wicked_pdf和wkhtmltopdf的路径,ruby-on-rails-4,spree,wicked-pdf,Ruby On Rails 4,Spree,Wicked Pdf,我正在使用两个gem将HTML转换为PDF 使用“” /初始化器/wicked_pdf.rb WickedPdf.config = { exe_path => "xxxxxxxxxxxxxxxxxxx" } 执行路径应该使用什么路径?哪个wkhtmltopdf 这将为您提供wkhtmltopdf的路径。您应该复制此路径并粘贴到config/initializers/wicked_pdf.rb中,然后重新启动服务器。将其添加到config/initializers/wicked_pd

我正在使用两个gem将HTML转换为PDF

使用“”

/初始化器/wicked_pdf.rb

WickedPdf.config = {
  exe_path =>  "xxxxxxxxxxxxxxxxxxx"
}

执行路径应该使用什么路径?

哪个wkhtmltopdf


这将为您提供wkhtmltopdf的路径。您应该复制此路径并粘贴到config/initializers/wicked_pdf.rb中,然后重新启动服务器。

将其添加到
config/initializers/wicked_pdf.rb
中,确保引用了正确的
GEM_HOME

WickedPdf.config = {
  :exe_path => "#{ENV['GEM_HOME']}/bin/wkhtmltopdf"
}

这样您就不会硬编码任何路径。

config/initializers/wicked\u pdf.rb

path = `which wkhtmltopdf`.gsub(/\n/, "")

WickedPdf.config = { exe_path: path }

你在使用windows吗?@test no我在使用ubuntu.Do
在你的项目目录终端中使用哪个wkhtmltopdf
。它会给你一条路。将该路径粘贴到config/initializers/wicked_pdf.rb中,然后重新启动server@test在我通过路径get之后出现了相同的错误,WKHTMLTOPDFW在该路径之后为我工作。我爱你,虽然你的代码片段可能会解决这个问题,但是你应该描述你的代码的目的(它是如何解决这个问题的)。此外,您可能需要检查
path = `which wkhtmltopdf`.gsub(/\n/, "")

WickedPdf.config = { exe_path: path }