Class: Wizport::Document::Pdf
- Inherits:
-
Object
- Object
- Wizport::Document::Pdf
- Defined in:
- lib/wizport/document/pdf.rb
Instance Method Summary collapse
-
#initialize ⇒ Pdf
constructor
A new instance of Pdf.
- #make_table(rows) ⇒ Object
- #save(file) ⇒ Object
- #table(rows, options = {}, &block) ⇒ Object
- #text(txt) ⇒ Object
Constructor Details
#initialize ⇒ Pdf
Returns a new instance of Pdf.
9 10 11 12 |
# File 'lib/wizport/document/pdf.rb', line 9 def initialize @pdf = Prawn::Document.new @pdf.font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf" end |
Instance Method Details
#make_table(rows) ⇒ Object
23 24 25 |
# File 'lib/wizport/document/pdf.rb', line 23 def make_table(rows) @pdf.make_table(rows,:width => @pdf.bounds.width) end |
#save(file) ⇒ Object
27 28 29 |
# File 'lib/wizport/document/pdf.rb', line 27 def save(file) @pdf.render_file(file) end |
#table(rows, options = {}, &block) ⇒ Object
18 19 20 21 |
# File 'lib/wizport/document/pdf.rb', line 18 def table(rows,={}, &block) tbl = PdfTable.new(rows,&block) @pdf.table(tbl.rows,.merge({:width => @pdf.bounds.width})) end |
#text(txt) ⇒ Object
14 15 16 |
# File 'lib/wizport/document/pdf.rb', line 14 def text(txt) @pdf.text txt end |