Solved!
I had to use bounding box to position the text.
The trick is to use the bounding_box parameters:
:width => bounds.width, :height => bounds.height
instead
:width => 800, :height => 600
now prawn center the text exactly.
See all the code...
Prawn::Document.generate("Certificado.pdf", :page_size =>
"A4", :page_layout => :landscape) do
bounding_box([0,430], :width => bounds.width, :height =>
bounds.height) do
text name, :size => 28, :align => :center
end
bounding_box([0,180], :width => bounds.width, :height =>
bounds.height) do
text "#{local}, #{date}", :size => 20, :align => :center
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---