Sha256: 44b4ca3f94a1596a015a7416f4431f57e9bac68fcd148fb38f509fe50e8f3040

Contents?: true

Size: 691 Bytes

Versions: 3

Compression:

Stored size: 691 Bytes

Contents

# encoding: utf-8
#
# Padded box is a kind of bounding box which places padding on all sides of
# the current bounds.  This is easier to see than explain, so please run the
# example.
#
# Feature borrowed from Josh Knowle's pt at:
# http://github.com/joshknowles/pt/tree/master
#
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
require 'prawn'

Prawn::Document.generate('padded_box.pdf') do
  stroke_bounds
  text "Margin box"
  padded_box(25) do
    stroke_bounds
    text "Bounding box padded by 25 on all sides from the margins"
    padded_box(50) do
      stroke_bounds
      text "Bounding box padded by 50 on all sides from the parent bounds"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-0.3.0 examples/bounding_box/padded_box.rb
prawn-0.4.0 examples/bounding_box/padded_box.rb
prawn-0.4.1 examples/bounding_box/padded_box.rb