我在Windows上运行Rails并安装了wkhtmltopdf(path - C:\ Users \ User \ local \ bin)。我正在尝试使用文档配置它 - https://github.com/pdfkit/pdfkit#configuration。但它给了我关于路径的错误。
我在initializers文件夹中创建了pdfkit.rb文件并写了:
PDFKit.configure do |config|
config.wkhtmltopdf = "C:Users/User/local/bin"
config.default_options = {
:page_size => 'Legal',
:print_media_type => true
}
end
但它给了我错误
No wkhtmltopdf executable found at C:Users/User/local/bin
>> Please install wkhtmltopdf - https://github.com/jdpace/PDFKit/wiki/Installing-WKHTMLTOPDF
答案 0 :(得分:1)
您需要指定整个可执行文件路径并在 C:
之后加上斜杠
路径应如下所示:C:/Users/User/local/bin/wkhtmltopdf.exe
还要考虑在Windows中使用反斜杠\而不是斜杠/