gpt4 book ai didi

ruby - 无法使用 pdfkit 创建 pdf - PDFKit::NoExecutableError

转载 作者:数据小太阳 更新时间:2023-10-29 07:26:10 26 4
gpt4 key购买 nike

我安装了 pdfkit,甚至还安装了 wkhtmltopdf,但是每次我尝试创建 pdf 时都会收到以下错误。

PDFKit::NoExecutableError 
No wkhtmltopdf executable found at bundler: command not found: which
Install missing gem executables with `bundle install`
>> Please install wkhtmltopdf - https://github.com/jdpace/PDFKit/wiki/Installing-WKHTMLTOPDF

我的 Gemfile 有以下内容:

gem 'jquery-rails'
gem 'devise'
gem 'carrierwave'
gem "wkhtmltopdf"
gem 'pdfkit'

我的 application.rb 有以下条目:

config.middleware.use "PDFKit::Middleware", :print_media_type => true

我在这里遗漏了什么吗?我已经运行了捆绑安装,但每次尝试创建 pdf 时仍然会出现此错误。请帮忙

最佳答案

你应该在这里阅读安装自述文件:

https://github.com/jdpace/PDFKit

所以你需要手动安装wkhtmltopdf:

https://github.com/jdpace/PDFKit/wiki/Installing-WKHTMLTOPDF

或者像这样

gem install wkhtmltopdf-binary

附言

检查哪个wkhtmltopdf

并创建新文件config/initializers/pdfkit.rb

PDFKit.configure do |config|
config.wkhtmltopdf = 'PATH/TO/wkhtmltopdf'
end

关于ruby - 无法使用 pdfkit 创建 pdf - PDFKit::NoExecutableError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9598082/

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