timriley / saucerly
- Source
- Commits
- Network (1)
- Issues (1)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
saucerly /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu Sep 24 21:52:29 -0700 2009 | |
| |
MIT-LICENSE | Wed Sep 23 18:47:41 -0700 2009 | |
| |
README.md | Thu Sep 24 22:10:11 -0700 2009 | |
| |
Rakefile | Thu Sep 24 20:57:12 -0700 2009 | |
| |
TODO | Wed Sep 23 19:11:00 -0700 2009 | |
| |
VERSION | Thu Sep 24 21:53:13 -0700 2009 | |
| |
init.rb | Thu Sep 24 20:56:47 -0700 2009 | |
| |
lib/ | Thu Sep 24 21:52:29 -0700 2009 | |
| |
rails/ | Thu Sep 24 21:52:29 -0700 2009 | |
| |
saucerly.gemspec | Thu Sep 24 21:53:13 -0700 2009 |
README.md
Saucerly
Saucerly provides PDF rendering for your Rails app using the Java-based FlyingSaucer library.
It is based on Princely. The benefit of Saucerly is that it provides competent XHTML to PDF rendering without the $4k PrinceXML pricetag.
Example
Rendering from a template:
class ExamplesController < ApplicationController::Base
def show
@document = Document.find(params[:id])
respond_to do |format|
format.html
format.pdf { render :pdf => 'file_name', :template => 'controller/action.pdf.haml', :layout => 'pdf' }
end
end
end
Rendering from an inline string:
render :pdf => 'file_name', :inline => 'XHTML goes here'
Installation
First, set up the dependencies:
- Install JRuby
- Register the flying_saucer gem dependency: add
config.gem 'flying_saucer'toconfig/environment.rb - Install flying_saucer:
jruby -S rake gems:install
Then, install Saucerly:
- As a gem, add
config.gem 'timriley-saucerly', :source => 'http://gems.github.com/', :lib => 'saucerly'toconfig/environment.rband runjruby -S rake gems:install - As a plugin, run
jruby script/plugin install git://github.com/timriley/saucerly
Now you're ready to go! Add some code to your controllers like the examples above.
If you're developing on OS X and you don't want a Java icon to appear in your dock, put java.lang.System.set_property("java.awt.headless", "true") in environment.rb or an initializer
Copyright (c) 2009 Tim Riley & RentMonkey Pty Ltd, released under the MIT license
