【问题标题】:ROR + PdfKit + No such file or directory -"C:\\Program\ Files\\wkhtmltopdf\\wkhtmltopdf.exe"ROR + PdfKit + 没有这样的文件或目录 -"C:\\Program\ Files\\wkhtmltopdf\\wkhtmltopdf.exe"
【发布时间】:2013-03-12 04:01:46
【问题描述】:

在我的项目中,我在 windows 平台上使用了 PDFKIT。最初它运行良好,但现在它给出了一些奇怪的错误消息。

没有这样的文件或目录 - “C:\Program\ 文件\wkhtmltopdf\wkhtmltopdf.exe" "--page-size" "信" “--margin-top” “0.75in” “--margin-right” “0.75in” “--margin-bottom” “0.75in” “--margin-left” “0.75in” “--encoding” “UTF-8” “--quiet” “-” “-”

我没有办法解决它,这里是 ruby​​ 代码。

kit = PDFKit.new(html)
send_data(kit.to_pdf, :filename => "#{file_name}.pdf", :type =>'application/pdf')

文件:app/config/initializers/pdfkit.rb

PDFKit.configure do |config|
  config.wkhtmltopdf = 'C:\Program Files\wkhtmltopdf\wkhtmltopdf.exe'
  # config.default_options = {
  #   :page_size => 'Legal',
  #   :print_media_type => true
  # }
  # config.root_url = "http://localhost" # Use only if your external hostname is unavailable on the server.
end

提前谢谢..

【问题讨论】:

    标签: ruby-on-rails-3 pdf-generation pdfkit


    【解决方案1】:

    当我的系统上发生这种情况时,我通过将 wkhtmltopdf 移动到路径不包含空格的目录来解决它。

    【讨论】:

      猜你喜欢
      • 2020-07-16
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      • 1970-01-01
      • 2014-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多