gpt4 book ai didi

ruby-on-rails-3 - Ruby on Rails : PdfKit Runtime Error

转载 作者:行者123 更新时间:2023-12-03 01:17:09 25 4
gpt4 key购买 nike

pdfkit gem 已成功安装在我的机器上。然后我运行 gem install wkhtmltopdf-binary 并输出为

Successfully installed wkhtmltopdf-binary-0.9.9.1
1 gem installed
Installing ri documentation for wkhtmltopdf-binary-0.9.9.1...
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_386, skipping
unable to convert "\xA3" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_x64, skipping
unable to convert "\xCE" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_darwin_386, skipping
Installing RDoc documentation for wkhtmltopdf-binary-0.9.9.1...
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_386, skipping
unable to convert "\xA3" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_linux_x64, skipping
unable to convert "\xCE" from ASCII-8BIT to UTF-8 for bin/wkhtmltopdf_darwin_386, skipping

好吧,然后尝试访问我的页面的 pdf 版本。但它也向我显示了一个错误运行时错误ControllerName#show

command failed: "/home/yasir/.rvm/gems/ruby-1.9.3-p194/bin/wkhtmltopdf" "--page-size" "Letter" "--margin-top" "0.75in" "--margin-right" "0.75in" "--margin-bottom" "0.75in" "--margin-left" "0.75in" "--encoding" "UTF-8" "--quiet" "-" "-

"

最佳答案

在 pdfkit 配置文件 (config/initializers/pdfkit.rb) 中添加 wkhtmltopdf 安装路径,如下

PDFKit.configure do |config|
# Download compatible version of wkhtmltopdf from 'http://wkhtmltopdf.org/downloads.html'
# Install it in your system.
# Then run 'which wkhtmltopdf' in your terminal to identify the path and update it below
config.wkhtmltopdf = '/usr/local/bin/wkhtmltopdf'
end

关于ruby-on-rails-3 - Ruby on Rails : PdfKit Runtime Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12307540/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com