Using lists in prawn

后端 未结 7 1014
深忆病人
深忆病人 2021-02-13 15:53

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

相关标签:
7条回答
  • 2021-02-13 16:16

    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.

    0 讨论(0)
提交回复
热议问题