1
我想在我的Rails 3應用程序中使用PDFKit在Windows上。Rails 3 + PDFKit問題:權限被拒絕(Errno :: EACCES)
我安裝wkhtmltopdf
和pdfkit
寶石。
這裏是我用來創建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"
任何想法?
謝謝很多!現在它可以工作。我不知道你能不能幫我也有這樣一條:http://stackoverflow.com/questions/5177074/rails-3-pdfkit-how-to-print-a-view-to-pdf。非常感謝! – 2011-03-03 05:39:21