Sha256: 0abdefceff6ddbeaee3c178e96f127567deface6452693a6b969cf49b7c76342

Contents?: true

Size: 959 Bytes

Versions: 6

Compression:

Stored size: 959 Bytes

Contents

# encoding: utf-8

$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require "prawn"

Prawn::Document.generate("span.pdf") do
  
  # Spans will typically be used outside of bounding boxes as a way to build
  # single columns of flowing text that span across pages.
  #
  span(350, :position => :center) do
    text "Here's some centered text in a 350 point column. " * 100
  end
  
  # Spans are not really compatible with bounding boxes because they break
  # the nesting chain and also may position text outside of the bounding box
  # boundaries, but sometimes you may wish to use them anyway for convenience
  # Here's an example of how to do that dynamically.
  # 
  bounding_box([50,300], :width => 400) do
    text "Here's some default bounding box text. " * 10 
    span(bounds.width, 
      :position => bounds.absolute_left - margin_box.absolute_left) do
      text "The rain in spain falls mainly on the plains. " * 300
    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
fullcirclegroup-fullcirclegroup-prawn-0.2.99.2 examples/span.rb
fullcirclegroup-prawn-0.2.99.3 examples/span.rb
satoko-prawn-0.2.99.6 examples/span.rb
prawn-0.2.1 examples/span.rb
prawn-0.2.2 examples/span.rb
prawn-0.2.3 examples/span.rb