开发者

Rails 3 + PDFKit Problem: Permission denied (Errno::EACCES)

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 <开发者_Python百科 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)

I got PDFkit to run on windows like this:

  PDFKit.configure do |config|
    config.wkhtmltopdf = 'C:\wkhtmltopdf\wkhtmltopdf.exe'
  end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜