public
Description: A simple Rails wrapper for the PrinceXML PDF generation library.
Homepage: http://www.mbleigh.com/plugins/princely-rails-prince-xml-wrapper
Clone URL: git://github.com/mbleigh/princely.git
cpjolicoeur (author)
Tue Apr 28 10:54:12 -0700 2009
mbleigh (committer)
Wed Apr 29 06:55:40 -0700 2009
commit  df6f2728c37c7729c295a9519cb51d98da835053
tree    6f4cd087916c35db469f994676ed1a0983396413
parent  b22561b3b7c127926e73a76d9772c4aa7729f9a3
princely / README
100644 51 lines (38 sloc) 1.302 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Princely
========
 
Princely is a simple wrapper for the Prince XML PDF generation library
(http://www.princexml.com). It is almost entirely based on the SubImage
Prince library found on this blog post:
 
http://sublog.subimage.com/articles/2007/05/29/html-css-to-pdf-using-ruby-on-rails
 
I have taken the helpers and made them a little bit more generalized and
reusable, and created a render option set for pdf generation. The plugin
will also automatically register the PDF MimeType so that you can use
pdf in controller respond_to blocks.
 
Example
=======
 
class Provider::EstimatesController < Provider::BaseController
  def show
    respond_to do |format|
      format.html
      format.pdf do
        render :pdf => "file_name",
               :template => "controller/action.pdf.erb",
               :stylesheets => ["application","prince"]
               :layout => "pdf"
      end
    end
  end
  
  def pdf
    make_and_send_pdf("file_name")
  end
end
 
Render Defaults
===============
 
The defaults for the render options are as follows:
 
layout: false
template: the template for the current controller/action
stylesheets: none
 
Resources
=========
 
Trac: http://trac.intridea.com/trac/public/
 
Copyright (c) 2007 Michael Bleigh and Intridea, Inc., released under the MIT license