Sha256: 63668d599a53056cac98b0e7f7915aeb38fd9ff2c810c8dad02991a2dffb15d7

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

# encoding: utf-8

$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
require "prawn"

Prawn::Document.generate("baseline.pdf") do
  pos = self.y - margin_box.absolute_bottom
  stroke do
    horizontal_rule
    line [0,pos], [0,pos - font.height*2]
  end
  
  bounding_box(bounds.top_left, :width => 250) do  
    text "blah blah blah"
    text "fasjkafsk asfkjfj saklfs asfklafs"
  end
  
  bounding_box([300,bounds.top], :width => 250) do
    # This is how you can position the text exactly at the baseline
    move_up font.height
    text "blah blah blah"
    text "fasjkafsk asfkjfj saklfs asfklafs"    
  end
  
  stroke_horizontal_rule
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
fullcirclegroup-fullcirclegroup-prawn-0.2.99.2 examples/position_by_baseline.rb
fullcirclegroup-prawn-0.2.99.3 examples/position_by_baseline.rb
satoko-prawn-0.2.99.6 examples/position_by_baseline.rb