开发者

uninitialized constant error using PDFKit

In my rails app, I am trying to generate pdf from html and trying to use pdfkit and wkhtmltopdf. I am trying to start by simplest code like:

kit = PDFKit.new("<p>This is some text.</p>")
pdf = kit.to_file "/home/user/test.pdf"

But I am ending up with the following error:

uninitialized constant TestController::PDFKit

TestController is my controller name. FYI, I am using Fedora12 an开发者_StackOverflow社区d rails 2.2.

Need some help. Anybody there?


You add pdf mime type for your app:

open config/initializer/mime_types.rb , add this code :

Mime::Type.register "application/pdf", :pdf

Hope it helps you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜