Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding: utf-8
- #
- # Generates a couple simple tables, including some UTF-8 text cells.
- # Although this does not show all of the options available to table,
- the most
- # common are used here. See fancy_table.rb for a more comprehensive
- example.
- #
- # require "#{File.dirname(__FILE__).to_s}/../example_helper.rb"
- require 'rubygems'
- require "prawn/core"
- require "prawn/layout"
- class Create_pdf_table
- def make_pdf_table (file, pdf)
- # =begin
- Prawn::Document.generate("#{file}.pdf") do
- font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
- # cell [0,730],
- :text => "'"[ + pdf[0] + ]"'",
- :font_size => 80,
- # :font_style => :bold,
- :border_width => 0,
- :text_color => 'f07878'
- move_down 10
- table "'"[ + pdf[2] ] "'",
- :font_size => 18,
- :horizontal_padding => 10,
- :vertical_padding => 3,
- :border_width => 0,
- :position => :center,
- :headers => "'"[ + pdf[1] ]"'",
- :font_size => 28
- :font_style => :bold,
- :align => {1 => :left},
- :align_headers => :left
- end
- end
- end
- a = Create_pdf_table.new
- t = "This is a title line"
- h = "[=============================col a col b col
- c-----------------------------]"
- l = "[row 1 a b][row 2 a b][row
- 3 a b]"
- data = Array[2]
- data[0] = t
- data[1] = h
- data[2] = l
- a.make_pdf_table 'atable',data
Add Comment
Please, Sign In to add comment