0
votes

I use prawn (1.0.0) and managed to got a table inside a table. Everything good so far. But the font size in the inner table is different (i guess the default font size) than the outside table.

pdf = Prawn::Document.new
table_data = []
table_data << ['iDirect', representation.idirect.yesno]
people = []
representation.people.each do |person|
  person_fullname = "#{person.lastname} #{person.firstname}"
  person_fullname_title = if person.title.empty?
    person_fullname
  else
    "#{person_fullname}, #{person.title}"
  end
  people << [person.function, person_fullname_title]
end
table_data << ['Personen', people]
pdf.table table_data, cell_style: { size: 7, borders: [:bottom] }, column_widths: [90, 430]

Prawn Table with different font size

I tried to override the default font size by using a constructor like

# this doesn't affect the font size in the inside table    
pdf = Prawn::Document.new(:page_size => 'A4', :page_layout => :portrait, :size => 7)  

How can i change the font size of the inside table?

2

2 Answers

1
votes

You could also add inside your if else on the cells, something like

"#{person_fullname, :size => 7}, #{person.title, :size => 7}"
0
votes

I could solve this with a simple

pdf.font_size 7