Princely
Princely is a simple wrapper for the Prince XML PDF generation library.
The plugin will also automatically register the PDF MimeType so that you can use
pdf as a format in Rails 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',
:handlers => %w[erb],
:formats => %w[pdf],
:stylesheets => %w[application prince],
:layout => 'pdf',
:locals => { :foo => 'bar' },
:disposition => 'inline',
:relative_paths => true
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
locals: none
stylesheets: none
disposition: attachment (created PDF file will be sent as download)
relative_paths: true
server_flag: true
javascript_flag: false
timeout: none
Contributors
Resources
- Copyright (c) 2007-2013 Michael Bleigh and Intridea, Inc., released under the MIT license.