prawn:Prawn::Document::LazyBoundingBox#action, #draw

#!/usr/bin/env ruby

require "prawn"
require "prawn/layout"

pdf = Prawn::Document.new

point = [pdf.bounds.right-50, pdf.bounds.bottom + 25]

b = Prawn::Document::LazyBoundingBox.new(pdf, point, :width => 50)

b.action do
  pdf.text "Page: #{pdf.page_count}"
end

10.times do
  pdf.start_new_page
  pdf.text "Some text"
  b.draw
end

pdf.render_file(File.basename($0, ".rb") + ".pdf")