Sha256: 66e720b6a9b9b176e0d2d809891d5814e7df3b24b6d92c2e97bdd10b4eb7ddbf

Contents?: true

Size: 462 Bytes

Versions: 21

Compression:

Stored size: 462 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.
#
require "#{File.dirname(__FILE__)}/../example_helper.rb"
   
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

21 entries across 21 versions & 7 rubygems

Version Path
piglop-prawn-0.10.2.3 examples/graphics/image_fit.rb
piglop-prawn-0.10.2.2 examples/graphics/image_fit.rb
piglop-prawn-0.10.2.1 examples/graphics/image_fit.rb
prawn-0.11.1.pre examples/graphics/image_fit.rb
goodwill-prawn-edge-0.10.0 examples/graphics/image_fit.rb
alphasights-prawn-0.10.4 examples/graphics/image_fit.rb
alphasights-prawn-0.10.3 examples/graphics/image_fit.rb
alphasights-prawn-0.10.2 examples/graphics/image_fit.rb
alphasights-prawn-0.10.1 examples/graphics/image_fit.rb
alphasights-prawn-0.10.0 examples/graphics/image_fit.rb
prawn-core-0.8.4 examples/graphics/image_fit.rb
prawn-graph-0.0.2 vendor/prawn-core/examples/graphics/image_fit.rb
prawn-graph-0.0.1 vendor/prawn-core/examples/graphics/image_fit.rb
prawn-core-0.7.2 examples/graphics/image_fit.rb
prawn-core-0.7.1 examples/graphics/image_fit.rb
prawn-layout-0.3.2 vendor/prawn-core/examples/graphics/image_fit.rb
prawn-core-0.6.3 examples/graphics/image_fit.rb
prawn-core-0.6.2 examples/graphics/image_fit.rb
prawn-layout-0.3.1 vendor/prawn-core/examples/graphics/image_fit.rb
prawn-core-0.6.1 examples/graphics/image_fit.rb