Question: First of all i know this type of posts are already been made but i've tried almost all of them and i'm not been able to get the results so here i'm again posting the same kind of question.

Second of all i'm not having an asset pipeline issue here, so please forget about that.

Now let me explain what i'm doing. I'm using rails 3.1 and ruby 1.9.2, i installed wicked\_pdf as a gem and installed wkhtmltopdf as mentioned in the wiki by purging the already installed wkhtml and downloading and extracting the new one to /usr/bin/wkhtmltopdf

I have an initializer that contains the following:

wicked\_pdf.rb
==============

```
WickedPdf.config = { :exe_path => '/usr/bin/wkhtmltopdf'}

```

In my view i have a link\_to method as follows:

\_filters.html.haml
===================

```
= link_to 'show pdf', jobs_report_jobs_path(:format => :pdf), :method=>"post"

```

note if i remove the :format => :pdf option it works fine
=========================================================

in my controller i'm doing the following:

report\_jobs\_controller.rb
===========================

```
respond_to do |format|
      format.html
      format.js
      format.pdf{
        render :pdf=>"jobs",
        :template => 'jobs.html.erb',
        :layout=>"jobs.html"
      }
end

```

note that i have tried from format.pdf alone without any options. I tried "jobs.pdf.erb", with and without layout option, all sorts of other options i don't even remember. All i get is a 406 not acceptable in the end.

Please guide me coz i need to implement this feature asap.

Regards,

Answer: 
i had a before\_filter in my application controller that was checking every request with the mentioned format for authentication and i was missing pdf format there, so as soon as i put the :pdf in the list of formats for each incoming request it worked fine.
I don't how much about `wicked-pdf`, but I once used `pdfkit` and this is how I did the rendering part: 

```
def pdf
  respond_to do |format|
      format.pdf { render :text => PDFKit.new( Pdf.find(params[:id]).content ).to_pdf }
    end
end

```

I hope the code is clear enough and self-explanatory. My view code is:

```
<p><%= link_to "Download PDF", pdf_pdf_path(@pdf, :format => "pdf") %></p>  

```