mirec
unread,May 26, 2009, 2:53:00 PM5/26/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prawn
this is relevant extract of my code:
results = Song.find(:all, :order => 'chorus,title')
Prawn::Document.generate(file_name, :page_size => "A5", :page_layout
=> :portrait) do
results.each do |result|
height = 15
song = lazy_bounding_box([0,530], :width => 350) do
font font_gbi
text counter.to_s + '. ' + "#{result.title}",:align
=> :left, :size => title_size, :kerning => true
(1...12).each do |t|
t = t.to_s
s = eval('result.strofa'+t)
unless s.blank? or s == ' '
s = s.chomp.chomp.chomp.chomp
move_down(8)
font font_g
text t + ". " + s, :align => :left, :spacing =>
2, :size => text_size, :kerning => true
move_down(4)
height = height + height_of(t + ". " + s,
line_width) + 10
end
r = eval("result.refren"+t)
unless r.blank? or r == ' ' or r == ' '
r = r.chomp.chomp.chomp.chomp
move_down(4)
font font_gbi
text "Refrén", :align => :left, :spacing =>
2, :size => text_size-1, :kerning => true
move_down(2)
font font_gi
text r, :align => :left, :spacing => 2, :size =>
text_size, :kerning => true
end
end
move_down(4)
start_new_page
song.draw
end
end
end