在我的项目中,我在 windows 平台上使用了 PDFKIT。最初它工作正常,但现在它给出了一些奇怪的错误消息。
没有这样的文件或目录 - "C:\Program\ Files\wkhtmltopdf\wkhtmltopdf.exe" "--page-size" "Letter" "--margin-top" "0.75in" "--margin-right" "0.75 in" "--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
提前致谢..