Sha256: 89b61fca8e366b5ded86f0886b507ca08939962c8bc0ddf48585b2ca0af01294

Contents?: true

Size: 784 Bytes

Versions: 6

Compression:

Stored size: 784 Bytes

Contents

# encoding: utf-8
#
# A text box is positioned by a top-left corner, width, and height and is
# essentially an invisible rectangle that the text will flow within.  If the
# text exceeds the boundaries, it is either truncated, replaced with some
# ellipses, or set to expand beyond the bottom boundary.
#
require "#{File.dirname(__FILE__)}/../example_helper.rb"

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

  text_box "Oh hai text box. " * 200, 
    :width    => 300, :height => font.height * 5,
    :overflow => :ellipses, 
    :at       => [100,bounds.top]

  text_box "Oh hai text box. " * 200,
    :width    => 250, :height => font.height * 10,
    :overflow => :truncate,
    :at       => [50, 300]

  move_down 20

  text_box "Oh hai text box. " * 100, :overflow => :expand
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
prawn-layout-0.3.2 vendor/prawn-core/examples/text/text_box.rb
prawn-core-0.6.3 examples/text/text_box.rb
prawn-core-0.6.2 examples/text/text_box.rb
prawn-layout-0.3.1 vendor/prawn-core/examples/text/text_box.rb
prawn-core-0.6.1 examples/text/text_box.rb
prawn-core-0.5.1 examples/text/text_box.rb