Sha256: c661ebce8f04ebb2bea43724cfc36380bac4ef240538e639bc97df7a490aad24

Contents?: true

Size: 542 Bytes

Versions: 2

Compression:

Stored size: 542 Bytes

Contents

# encoding: utf-8
#
# Demonstrates how to enable absolute positioning in Prawn by temporarily
# removing the margin_box via Document#canvas()
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

Prawn::Document.generate("canvas.pdf") do
  canvas do
    text "This text should appear at the absolute top left"

    # stroke a line to show that the relative coordinates are the same as absolute
    stroke_line [bounds.left,bounds.bottom], [bounds.right,bounds.top]
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
prawn-0.11.1 examples/general/canvas.rb
davebenvenuti-prawn-0.11.1.pre examples/general/canvas.rb