[英]Rails 3 + PDFKit Problem: Permission denied (Errno::EACCES)
I would like to use PDFKit in my Rails 3 application on Windows . 我想在Windows的 Rails 3应用程序中使用PDFKit 。
I installed wkhtmltopdf
and the pdfkit
gem. 我安装了wkhtmltopdf
和pdfkit
gem。
Here is the code that I use to create the PDF: 这是我用来创建PDF的代码:
class JobsController < ApplicationController
def create_pdf_invoice
kit = PDFKit.new("<h1>Hello</h1><p>This is PDF!!!</p>", :page_size => "A4")
file = kit.to_file("my_first_pdf") # Error issued here!!
...
end
end
I got the following error: 我收到以下错误:
Errno::EACCES in JobsController#create_pdf_invoice
Permission denied - "c:\Program Files\wkhtmltopdf" "--page-size" "A4"
"--margin-top" "0.75in" "--margin-right" "0.75in"
"--margin-bottom" "0.75in" "--margin-left" "0.75in"
"--encoding" "UTF-8" "--quiet" "-" "my_first_pdf"
Any ideas ? 有任何想法吗 ?
You will get that error if you point to a folder and not the actual file (.exe) 如果您指向一个文件夹而不是实际的文件 (.exe),则会出现该错误。
I got PDFkit to run on windows like this: 我让PDFkit在这样的Windows上运行:
PDFKit.configure do |config|
config.wkhtmltopdf = 'C:\wkhtmltopdf\wkhtmltopdf.exe'
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.