How do I define line height with Prawn when generating a pdf in rails app?
I am usi开发者_开发问答ng prawn to generate a pdf. So far everything has been rather straight forward. I am having a problem defining the leading between lines of text. For example: when using a text_box
pdf.text_box "Ipsum dolor sit amet consectetue?",
:width => pdf.bounds.width - 10, :height => 150,
:overflow => :ellipses
This will generate the text box except I can not find in the docs on how to control the spacing between lines of text. The strings I will be using are typically 5 to 8 lines long.
Thank you in advance
I know this isn't the perfect answer, but you can use the leading option with pdf.text (maybe you figured this out already):
sometext = "My big long string\ncovering multiple lines"
pdf.text sometext, :size => 10, :leading => 5
Maybe you could use this with a bounding box like so:
pdf.bounding_box([270,650], :width=>270, :height=>250) do
pdf.text sometext, :size => 10, :leading => 5
end
精彩评论