File: png.rb

package info (click to toggle)
ruby-prawn 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,936 kB
  • ctags: 802
  • sloc: ruby: 13,906; sh: 43; makefile: 15
file content (25 lines) | stat: -rw-r--r-- 665 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# encoding: utf-8

require_relative "../../lib/prawn"

images = [
      ["Type 0", "#{Prawn::DATADIR}/images/web-links.png"],
      ["Type 2", "#{Prawn::DATADIR}/images/ruport.png"],
      ["Type 3", "#{Prawn::DATADIR}/images/indexed_color.png"],
      ["Type 4", "#{Prawn::DATADIR}/images/page_white_text.png"],
      ["Type 6", "#{Prawn::DATADIR}/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")

    fill_color "FF0000"

    fill_rectangle bounds.top_left, bounds.width, bounds.height
    text header

    image file, :at => [50,450]
  end
end