Sha256: c6be6793a79edb3bb310da465f94d014a9d86b49f6469a6d9ab31bea09fb2093

Contents?: true

Size: 906 Bytes

Versions: 8

Compression:

Stored size: 906 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::ManualBuilder::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-2.1.0 manual/images/width_and_height.rb
prawn-git-2.0.1 manual/images/width_and_height.rb
prawn-2.0.2 manual/images/width_and_height.rb
prawn-2.0.1 manual/images/width_and_height.rb
prawn-2.0.0 manual/images/width_and_height.rb
prawn-1.3.0 manual/images/width_and_height.rb
prawn-1.2.1 manual/images/width_and_height.rb
prawn-1.1.0 manual/images/width_and_height.rb