Sha256: 904074f1545e82f8d4fbcc29a26dcab0be893072763288a05f92d4720797981a
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
# encoding: utf-8 # # This example demonstrates how nested bounding boxes work when the outer box is # stretchy and includes several inner boxes of different sizes. require File.expand_path(File.join(File.dirname(__FILE__), %w[.. example_helper])) Prawn::Document.generate("stretched_nesting.pdf", :page_layout => :landscape) do def stroke_dashed_bounds dash(1) stroke_bounds undash end bounding_box [100,400], :width => 500 do bounding_box [0, bounds.top], :width => 200, :height => 100 do stroke_bounds end bounding_box [200, bounds.top], :width => 150 do indent(5) do text "This box is longest, so it stretches the parent box. \n"*5 end end bounding_box [350, bounds.top], :width => 150 do text "I AM SANTA CLAUS!!!" end stroke_dashed_bounds end bounding_box [100, 250], :width => 500 do bounding_box [0, bounds.top], :width => 100, :height => 100 do text "1" stroke_bounds end bounding_box [125, bounds.top], :width => 50, :height => 25 do text "2" stroke_bounds end bounding_box [200, bounds.top - 50], :width => 50, :height => 125 do text "3" stroke_bounds end bounding_box [350, bounds.top - 100], :width => 20, :height => 20 do text "4" stroke_bounds end bounding_box [400, bounds.height - 150], :width => 100, :height => 100 do text "5" stroke_bounds end stroke_dashed_bounds end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
prawn-0.11.1 | examples/bounding_box/stretched_nesting.rb |
davebenvenuti-prawn-0.11.1.pre | examples/bounding_box/stretched_nesting.rb |