Sha256: 8b51fd062213acc10e31c4b97d61e941d1cae104d5820fcbe65cdd0dfa5bac3e

Contents?: true

Size: 672 Bytes

Versions: 12

Compression:

Stored size: 672 Bytes

Contents

#!/usr/bin/env ruby
# coding: utf-8

$:.unshift(File.dirname(__FILE__) + "/../lib")

require 'pdf/wrapper'

@pdf = PDF::Wrapper.new("translate.pdf", :paper => :A4)

def captioned_image(filename, caption, x, y)
  @pdf.translate(x, y) do
    @pdf.image(filename, :top => 0, :left => 0, :height => 100, :width => 100, :proportional => true)
    @pdf.text("Image Caption", :top => 110, :left => 0)
  end
end

captioned_image(File.dirname(__FILE__) + "/../specs/data/orc.svg", "One", 100, 100)
captioned_image(File.dirname(__FILE__) + "/../specs/data/orc.svg", "Two", 250, 300)
captioned_image(File.dirname(__FILE__) + "/../specs/data/orc.svg", "Three", 400, 500)

@pdf.finish

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pdf-wrapper-0.4.5 examples/translate.rb
pdf-wrapper-0.4.4 examples/translate.rb
pdf-wrapper-0.4.1 examples/translate.rb
pdf-wrapper-0.4.0 examples/translate.rb
pdf-wrapper-0.3.5 examples/translate.rb
pdf-wrapper-0.3.4 examples/translate.rb
pdf-wrapper-0.3.3 examples/translate.rb
pdf-wrapper-0.3.2 examples/translate.rb
pdf-wrapper-0.3.1 examples/translate.rb
pdf-wrapper-0.3.0 examples/translate.rb
pdf-wrapper-0.2.0 examples/translate.rb
pdf-wrapper-0.2.1 examples/translate.rb