Sha256: 6acc8d593ec2056baf30cd44fc1b698760e5f5e57d2e249f8fe4bc768928934d

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

# <code>:fit</code> option is useful when you want the image to have the
# maximum size within a container preserving the aspect ratio without
# overlapping.
#
# Just provide the container width and height pair.

require_relative '../example_helper'

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  size = 300

  text 'Using the fit option'
  bounding_box([0, cursor], width: size, height: size) do
    image "#{Prawn::DATADIR}/images/pigs.jpg", fit: [size, size]
    stroke_bounds
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
prawn-2.4.0 manual/images/fit.rb
prawn-2.3.0 manual/images/fit.rb