I need to generate a document with nested tables in prawn pdf.
The most recent answer on this stack overflow question seems to indicate that I can do it like this:
(Prawn::Document.generate("subtable.pdf") do |pdf|
subtable = pdf.make_table([["sub"],["table"]])
pdf.table([[subtable,"original"]])
end
Unfortunatley doing that gives me the following error:
undefined method `size=' for #<Prawn::Table::Cell::Subtable:0xad3f1e4>
So checking the documentation I can see:
” You can use Prawn::Document#make_table to create a table for use as a subtable without immediately drawing it. See examples/table/bill.rb for a somewhat complex use of subtables. ”
http://prawn.majesticseacreature.com/docs/0.11.1/Prawn/Table.html
Where can I see this examples/table/bill.rb? I’ve cloned the github repo, scoured the website and the manual but can’t find these examples anywhere!
I know I’m missing something stupid. Does anyone know how do do nested tables correctly in prawn pdf and/or where the example files are located?
Thanks for any help
do:
gem which prawn
that would give you location of the prawn gem. It includes the examples dir. You can find table/bill.rb there.