轨道 3 + PDFKit 问题:权限被拒绝 (Errno::EACCES)
我想在 Windows 上的 Rails 3 应用程序中使用 PDFKit。
我安装了 wkhtmltopdf 和 pdfkit gem。
这是我用来创建 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
我收到以下错误:
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"
有什么想法吗?
I would like to use PDFKit in my Rails 3 application on Windows.
I installed wkhtmltopdf
and the pdfkit
gem.
Here is the code that I use to create the 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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您指向文件夹而不是实际的文件 (.exe),您将会收到该错误。
我让 PDFkit 在 Windows 上运行,如下所示:
You will get that error if you point to a folder and not the actual file (.exe)
I got PDFkit to run on windows like this: