Sha256: 6be63e3ea55c4beff95659207cbbcb49bf3151346fbef89f2f4715d273e27f35
Contents?: true
Size: 961 Bytes
Versions: 3
Compression:
Stored size: 961 Bytes
Contents
# encoding: utf-8 # # This example demonstrates Document#lazy_bounding_box, which is used for # storing a set of drawing instructions to be executed later. This is used # for header and footer support in Prawn, and can be used for repeating page # elements in general. # # Note that once a lazy bounding box is positioned, it calculates its anchor # relative to its parent bounding box. It will be positioned at this exact # location each time it is redrawn, regardless of the bounds # LazyBoundingBox#draw is in. # $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib')) require "prawn" file = "lazy_bounding_boxes.pdf" Prawn::Document.generate(file, :skip_page_creation => true) do point = [bounds.right-50, bounds.bottom + 25] page_counter = lazy_bounding_box(point, :width => 50) do text "Page: #{page_count}" end 10.times do start_new_page text "Some filler text for the page" page_counter.draw end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prawn-0.3.0 | examples/bounding_box/lazy_bounding_boxes.rb |
prawn-0.4.0 | examples/bounding_box/lazy_bounding_boxes.rb |
prawn-0.4.1 | examples/bounding_box/lazy_bounding_boxes.rb |