Sha256: b786a9afc670ab8438ddc1e777297b63faf1e4f85af143853da496eb32e0d197

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

# encoding: utf-8
#
# This example demonstrates the basic functionality of Prawn's bounding boxes.
# Note that top level bounding boxes are positioned relative to the margin_box.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

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

  text "No indentation"
  indent(20) do
    text "Some indentation"
    # Generates a box with a top-left of [100,600] and a top-right of [300,600]
    # The box automatically expands as the cursor moves down the page.  Notice
    # that the final coordinates are outlined by a top and bottom line drawn
    # relatively using calculations from +bounds+.
    #
    bounding_box [100,600], :width => 200 do
      text "A little more indentation"
      indent(20) do
        text "And some more indentation"
        indent(20) do
          text "And some deeper indentation"
        end
      end
    end
    text "Some indentation"
  end
  indent(10) do
    text "A bit of indentation"
  end
  
  text "No indentation"
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
prawn-0.11.1 examples/bounding_box/indentation.rb
davebenvenuti-prawn-0.11.1.pre examples/bounding_box/indentation.rb