File: scale.rb

package info (click to toggle)
ruby-prawn 2.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,220 kB
  • ctags: 826
  • sloc: ruby: 14,469; sh: 43; makefile: 18
file content (22 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# encoding: utf-8
#
# To scale an image use the <code>:scale</code> option.
#
# It scales the image proportionally given the provided value.
#
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  "Normal size"
  image "#{Prawn::DATADIR}/images/stef.jpg"
  move_down 20

  text  "Scaled to 50%"
  image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 0.5
  move_down 20

  text  "Scaled to 200%"
  image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 2
end