Class: ChiliPDF::Formatter
- Inherits:
-
Object
- Object
- ChiliPDF::Formatter
- Defined in:
- lib/chili_pdf/formatter.rb
Constant Summary collapse
- HEADER_FOOTER_FONT_SIZE =
8
- DEFAULT_MARGIN =
'0.5in'
- DEFAULT_PAGE_SIZE =
"Letter"
- DEFAULT_PAGE_TITLE =
"Untitled"
- DEFAULT_LAYOUT =
'pdf.pdf.erb'
- DEFAULT_VIEW_TEMPLATE =
'extended_wiki/show.pdf.html.erb'
Instance Attribute Summary collapse
-
#page_title ⇒ Object
readonly
Returns the value of attribute page_title.
Instance Method Summary collapse
-
#initialize(filename, title = nil, render_html_version = nil) ⇒ Formatter
constructor
A new instance of Formatter.
- #render_options ⇒ Object
Constructor Details
#initialize(filename, title = nil, render_html_version = nil) ⇒ Formatter
Returns a new instance of Formatter.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/chili_pdf/formatter.rb', line 18 def initialize(filename, title = nil, render_html_version = nil) @page_title = title @filename = filename @allow_debugging = render_html_version # TODO: Hack...need to come up with better approach for this... TokenManager.add_token_definition do {:page_title => {:replacement_object => (@page_title || DEFAULT_PAGE_TITLE), :description => "The project & wiki page name (eg: 'My Project, Wiki Page Title')"}} end end |
Instance Attribute Details
#page_title ⇒ Object (readonly)
Returns the value of attribute page_title.
10 11 12 |
# File 'lib/chili_pdf/formatter.rb', line 10 def page_title @page_title end |
Instance Method Details
#render_options ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/chili_pdf/formatter.rb', line 30 def = { :pdf => @filename, :template => view_template, :page_size => DEFAULT_PAGE_SIZE, :show_as_html => render_as_html?, :margin => { :top => DEFAULT_MARGIN, :bottom => DEFAULT_MARGIN, :left => DEFAULT_MARGIN, :right => DEFAULT_MARGIN }, :layout => DEFAULT_LAYOUT } .merge!() if ChiliPDF::Config. .merge!() if ChiliPDF::Config.header_enabled? end |