Ruby On Rails : PdfKit Runtime Error

Hello Every One,

I am using PdfKit to download as a PDF in my application. I did it in the following way but it didn’t worked for me

  1. In gem file

    gem ‘pdfkit’

  2. In config/application.rb

I add this code
"config.middleware.use “PDFKit::Middleware”, :print_media_type => true

  1. In show.html.erb

I added this code

<%= link_to “Download Invoice (PDF)”, order_path(@order, :format => “pdf”) %>****

But the problem is
PdfKit gem successfully installed in my machine. Then I run gem install wkhtmltopdf-binary and output was

Well, then tried to access the pdf version of my page. But it also showed me an error
Runtime Error ControllerName#show

What should I do if I want to correct output.

Thanks in Advance

Hello Every One,

I am using PdfKit to download as a PDF in my application. I did it in the following way but it didn’t worked for me

  1. In gem file

    gem ‘pdfkit’

  2. In config/application.rb

I add this code
"config.middleware.use “PDFKit::Middleware”, :print_media_type => true

  1. In show.html.erb

I added this code

<%= link_to “Download Invoice (PDF)”, order_path(@order, :format => “pdf”) %>****

But the problem is
PdfKit gem successfully installed in my machine. Then I run gem install wkhtmltopdf-binary and output was

Well, then tried to access the pdf version of my page. But it also showed me an error
Runtime Error ControllerName#show

What should I do if I want correct output.

Thanks in Advance

Comment out the below line from application.rb file.

"config.middleware.use “PDFKit::Middleware”, :print_media_type => true

you can see this also: http://stackoverflow.com/questions/8044659/pdfkit-does-not-style-pdfs