Wicked PDF for Rails 3.1
I've recently faced the problem to generate PDF files in Rails 3.1. In many projects done with a minor version of Rails we used wicked_pdf gem (that use wkhtml2pdf binary to convert html to pdf, as name says) because it make the task easier. It's just render a valid html document but in pdf extension. (More information in their github repository).
Asset Pipeline in Rails 3.1 make stylesheets and images unreachable for wicked_pdf.
The fact of using Asset Pipeline in Rails 3.1 makes me change the way to include CSS and Images into Html document. The point is that wicked_pdf cannot reach it using a direct url (like /assets/pageable.css), or even using the rigth way with the helper 'stylesheet_link_tag "pageable"'.
Digging into that question, I got the solution in the master branch of their gem. Right there in the wicked_pdf_helper. As you may see, there are 4 new helpers that embed the content of CSS, JS and Images directly into the html document.
So the solution is call 'wicked_pdf_stylesheet_link_tag', 'wicked_pdf_image_tag' and 'wicked_pdf_javascript_src_tag'.
The last point I want to remark is that you has to include the wicked_pdf gem directly from the repository. Otherwise, you will never find those helpful helpers.
gem 'wicked_pdf', :git => "git://github.com/mileszs/wicked_pdf.git"