Wrap text in a table reportlab?

前端 未结 3 453
刺人心
刺人心 2020-12-14 08:41

I use a table but, I draw in in a canvas to control the position of the flowables, this because I have a template in a pdf, an I merge with pyPDF.

The wrap is done i

3条回答
  •  盖世英雄少女心
    2020-12-14 09:26

    AutoReply:

    def coord(x, y, height, unit=1):
        x, y = x * unit, height -  y * unit
        return x, y
    
    w, h = table.wrap(width, height)
    table.wrapOn(c, width, height)
    table.drawOn(c, *coord(ml - 0.05, y + 4.6, height - h, cm))
    

    the trick is in the "height - h", h is the height of the table and this depend of the content of the table

提交回复
热议问题