Sha256: a38d89bd9d0debe27b417ff1982424a16bebbd83e549845ad745b7ad34999155

Contents?: true

Size: 968 Bytes

Versions: 8

Compression:

Stored size: 968 Bytes

Contents

# encoding: utf-8
#
# <code>Prawn::Table#initialize</code> takes a
# <code>:before_rendering_page</code> argument, to adjust the way an entire page
# of table cells is styled. This allows you to do things like draw a border
# around the entire table as displayed on a page.
#
# The callback is passed a Cells object that is numbered based on the order of
# the cells on the page (e.g., the first row on the page is
# <code>cells.row(0)</code>).
#
require File.expand_path(File.join(File.dirname(__FILE__),
                                   %w[.. example_helper]))

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::Example.generate(filename) do
  table([["foo", "bar", "baz"]] * 40) do |t|
    t.cells.border_width = 1
    t.before_rendering_page do |page|
      page.row(0).border_top_width       = 3
      page.row(-1).border_bottom_width   = 3
      page.column(0).border_left_width   = 3
      page.column(-1).border_right_width = 3
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
prawn-1.0.0 manual/table/before_rendering_page.rb
prawn-0.15.0 manual/table/before_rendering_page.rb
prawn-0.14.0 manual/table/before_rendering_page.rb
prawn-0.13.2 manual/table/before_rendering_page.rb
prawn-0.13.1 manual/table/before_rendering_page.rb
prawn-0.13.0 manual/table/before_rendering_page.rb
prawn-1.0.0.rc2 manual/table/before_rendering_page.rb
nurettin-prawn-1.0.0.rc1 manual/table/before_rendering_page.rb