Sha256: 054211713769f857b9cc13c61f6ad49333dbe7d54fa8390d1421c9db4ee8efdb

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 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.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))
   
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

2 entries across 2 versions & 2 rubygems

Version Path
prawn-0.11.1 examples/graphics/image_fit.rb
davebenvenuti-prawn-0.11.1.pre examples/graphics/image_fit.rb