mileszs / wicked_pdf
- Source
- Commits
- Network (4)
- Issues (2)
- Downloads (0)
- Graphs
-
Tree:
968b499
commit 968b4994c88e1c0f37d52ba15be1711d31512e5e
tree 8fe3991b64c215f77280174ba77815732a60f1e2
parent 8cf3653052cb1735630bbe28aa456d45a9780382
tree 8fe3991b64c215f77280174ba77815732a60f1e2
parent 8cf3653052cb1735630bbe28aa456d45a9780382
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Tue Jun 16 13:57:57 -0700 2009 | |
| |
README.md | ||
| |
init.rb | Tue Jun 16 13:57:57 -0700 2009 | |
| |
lib/ |
README.md
Wicked PDF
A PDF generation plugin for Ruby on Rails
Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff.
Installation
First, be sure to install wkhtmltopdf.
Next:
script/plugin install git://github.com/mileszs/wicked_pdf.git
Usage
class ThingsController < ApplicationController
def show
respond_to do |format|
format.html
format.pdf do
render :pdf => "file_name",
:template => "things/show.pdf.erb",
:layout => "pdf.html"
end
end
end
end
By default, it will render without a layout (:layout => false) and the template for the current controller and action. (So, the template line in the above code is actually unnecessary.)
Inspiration
You may have noticed: this plugin is heavily inspired by the PrinceXML plugin princely. PrinceXML's cost was prohibitive for me. So, with a little help from some friends (thanks jqr), I tracked down wkhtmltopdf, and here we are.


