Im using prawn to create pdfs that contain much data in table format and some lists. The problem with the lists is that Im just using text as lists because there is no semantic equivalent to ul > li lists like I use them in the webfrointend. So the lists arent justified. A list point that uses more than one line looks creapy because I doesnt fit the list icon. How can I implement lists in prawn that dont look like crap?
One go-around is to create a method similar to crm's answer. The difference is that it won't break when the text goes to another page and you can have multiple levels as well.
def bullet_item(level = 1, string)
indent (15 * level), 0 do
text "• " + string
end
end
Simply call this method like so:
bullet_item(1, "Text for bullet point 1")
bullet_item(2, "Sub point")
Feel free to refactor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With