Sha256: eca006da9e70936bb31e23756f5ae5e70af5717e8f7a5d056377954268b36bba

Contents?: true

Size: 895 Bytes

Versions: 8

Compression:

Stored size: 895 Bytes

Contents

# encoding: utf-8
#
# The image size can be set with the <code>:width</code> and
# <code>:height</code> options.
#
# If only one of those is provided, the image will be scaled proportionally.
# When both are provided, the image will be stretched to fit the dimensions
# without maintaining the aspect ratio.
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
  text  "Scale by setting only the width"
  image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 150
  move_down 20
  
  text  "Scale by setting only the height"
  image "#{Prawn::DATADIR}/images/pigs.jpg", :height => 100
  move_down 20
  
  text  "Stretch to fit the width and height provided"
  image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 500, :height => 100
end

Version data entries

8 entries across 8 versions & 2 rubygems

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