Sha256: 505b7e0d99832bc13c3e21a17f9ba4599ae750aab7e8fdf216fc8ebba20f9f9c

Contents?: true

Size: 786 Bytes

Versions: 5

Compression:

Stored size: 786 Bytes

Contents

# encoding: utf-8
#
# PNG files come in different flavours - 5 of them. This example embeds
# one of each type as proof that they all work.
#
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
require "prawn"

images = [
          ["Type 0", "#{Prawn::BASEDIR}/data/images/web-links.png"],
          ["Type 2", "#{Prawn::BASEDIR}/data/images/ruport.png"],
          ["Type 3", "#{Prawn::BASEDIR}/data/images/rails.png"],
          ["Type 4", "#{Prawn::BASEDIR}/data/images/page_white_text.png"],
          ["Type 6", "#{Prawn::BASEDIR}/data/images/dice.png"],
]

Prawn::Document.generate("png_types.pdf", :page_size => "A5") do
  images.each do |header, file|
    start_new_page unless header.include?("0")
    text header
    image file, :at => [50,450]
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
kavu-prawn-core-0.4.100 examples/graphics/png_types.rb
kavu-prawn-core-0.4.99 examples/graphics/png_types.rb
prawn-0.3.0 examples/graphics/png_types.rb
prawn-0.4.0 examples/graphics/png_types.rb
prawn-0.4.1 examples/graphics/png_types.rb