Sha256: 09b7a15f2104f92498520b4e1cd43731a92b192dc5052c373ba185815a341c8a

Contents?: true

Size: 494 Bytes

Versions: 5

Compression:

Stored size: 494 Bytes

Contents

# encoding: utf-8
#
# Demonstrates fitting an image within a rectangular width and height.
# The image will be scaled down to fit within the box, while preserving
# the aspect ratio.
#
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
require "prawn"
   
Prawn::Document.generate("image_fit.pdf", :page_layout => :landscape) do

  pigs = "#{Prawn::BASEDIR}/data/images/pigs.jpg" 
  stroke_rectangle [50,450], 200, 200
  image pigs, :at => [50,450], :fit => [200,200]

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
kavu-prawn-core-0.4.100 examples/graphics/image_fit.rb
kavu-prawn-core-0.4.99 examples/graphics/image_fit.rb
prawn-0.3.0 examples/graphics/image_fit.rb
prawn-0.4.0 examples/graphics/image_fit.rb
prawn-0.4.1 examples/graphics/image_fit.rb