Sha256: cf22c460f78445fd7753d40f4dfc6ab19fa0017e09a5d319325a9d9b044c8f55

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8       
# 
# Multi-faceted example that demonstrates a document flowing between header
# and footer regions.  At the moment, headers and footers in Prawn are run
# using the current font settings (among other things), for each page.  This
# means that it is important to non-destructively set your desired styling 
# within your headers and footers, as shown below.  
#
# Future versions of Prawn may make this more convenient somehow.
#
require "#{File.dirname(__FILE__)}/../example_helper.rb"

Prawn::Document.generate("flow_with_headers_and_footers.pdf")  do

  header margin_box.top_left do 
    font "Helvetica" do
      text "Here's My Fancy Header", :size => 25, :align => :center   
      stroke_horizontal_rule
    end
  end   
                
  footer [margin_box.left, margin_box.bottom + 25] do
    font "Helvetica" do
      stroke_horizontal_rule
      text "And here's a sexy footer", :size => 16
    end
  end
                                      
  bounding_box([bounds.left, bounds.top - 50], 
      :width  => bounds.width, :height => bounds.height - 100) do                 
   text "this is some flowing text " * 200    
   
   
 end    
 
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-layout-0.3.2 examples/page_layout/flowing_text_with_header_and_footer.rb
prawn-layout-0.3.1 examples/page_layout/flowing_text_with_header_and_footer.rb
prawn-layout-0.2.1 examples/page_layout/flowing_text_with_header_and_footer.rb