Sha256: 223974abce085b2d808cc976f74edb2d4a0857cf3da4075fdd47579545263fab

Contents?: true

Size: 651 Bytes

Versions: 8

Compression:

Stored size: 651 Bytes

Contents

# encoding: utf-8
#
# <code>:fit</code> option is useful when you want the image to have the
# maximum size within a container preserving the aspect ratio without
# overlapping.
#
# Just provide the container width and height pair.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
  size = 300
  
  text "Using the fit option"
  bounding_box([0, cursor], :width => size, :height => size) do
    image "#{Prawn::DATADIR}/images/pigs.jpg", :fit => [size, size]
    stroke_bounds
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
prawn-1.0.0 manual/images/fit.rb
prawn-0.15.0 manual/images/fit.rb
prawn-0.14.0 manual/images/fit.rb
prawn-0.13.2 manual/images/fit.rb
prawn-0.13.1 manual/images/fit.rb
prawn-0.13.0 manual/images/fit.rb
prawn-1.0.0.rc2 manual/images/fit.rb
nurettin-prawn-1.0.0.rc1 manual/images/fit.rb