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
drnic (author)
Wed Sep 30 18:09:29 -0700 2009
mbleigh (committer)
Sun Oct 25 10:41:14 -0700 2009
name age message
file .gitignore Thu Aug 20 21:10:47 -0700 2009 added 1.0.0 gemspec [drnic]
file MIT-LICENSE Mon Dec 17 07:55:59 -0800 2007 Initial import of Princely. git-svn-id: http... [michael]
file README.rdoc Sat Sep 19 18:28:27 -0700 2009 Updating README and gemspec a bit. [mbleigh]
file Rakefile Sat Sep 19 18:28:27 -0700 2009 Updating README and gemspec a bit. [mbleigh]
file VERSION Sat Sep 19 19:51:20 -0700 2009 Version bump to 1.2.5 [mbleigh]
file init.rb Sat Sep 19 19:51:05 -0700 2009 Adding rails/init for gem version. [mbleigh]
directory lib/ Sun Oct 25 10:41:14 -0700 2009 running prince with file names quoted by ' [drnic]
file princely.gemspec Sat Sep 19 19:51:20 -0700 2009 Regenerated gemspec for version 1.2.5 [mbleigh]
directory rails/ Sat Sep 19 19:51:05 -0700 2009 Adding rails/init for gem version. [mbleigh]
README.rdoc

Princely

Princely is a simple wrapper for the Prince XML PDF generation library (www.princexml.com). The plugin will also automatically registers the PDF MimeType so that you can use pdf as a format in controller respond_to blocks.

Example

    class Provider::EstimatesController < Provider::BaseController
      # You can render PDF templates simply by
      # using the :pdf option on render templates.
      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

      # Alternatively, you can use make_and_send_pdf to
      # render out a PDF for the action without a
      # respond_to block.
      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

Contributors

  • Gemification and more: Nic Williams

Resources

  • Copyright © 2007-2009 Michael Bleigh and Intridea, Inc., released under the MIT license.