# encoding: utf-8 $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') require "prawn" require "rubygems" headers, body = nil, nil ruby_18 do require "fastercsv" headers, *body = FasterCSV.read("#{Prawn::BASEDIR}/examples/addressbook.csv") end ruby_19 do require "csv" headers, *body = CSV.read("#{Prawn::BASEDIR}/examples/addressbook.csv") headers.map! { |e| e.encode("UTF-8") } body.map! { |e| e.map! { |x| x.encode("UTF-8") } } end Prawn::Document.generate("top_and_bottom_cells.pdf", :page_layout => :portrait) do table(body, :headers => headers, :align => :center, :border_style => :top_and_bottom) move_down(50) table(body, :headers => headers, :align => :center, :border_style => :top_and_bottom, :header_border_style => :sides) move_down(50) table(body, :headers => headers, :align => :center, :border_style => :grid, :header_border_style => :bottom_only) # cell([500,300], :text => "This free flowing textbox shows how you can use Prawn's "+ # "cells outside of a table with ease. Think of a 'cell' as " + # "simply a limited purpose bounding box that is meant for laying " + # "out blocks of text and optionally placing a border around it", # :width => 225, :padding => 10, :border_width => 2, :border_style => :top_and_bottom) end