How to change text/font color in reportlab.pdfgen

后端 未结 3 594
执念已碎
执念已碎 2021-02-01 19:02

I want to use a different color of text in my auto-generated PDF.

According to the reportlab docs all I need to do is:

self.canvas.setFillColorRGB(255,0,         


        
3条回答
  •  遇见更好的自我
    2021-02-01 19:19

    from reportlab.lib.colors import HexColor
    ...
    
    # sets fill color like orange
    c.setFillColor(HexColor(0xff8100))
    # or 
    c.setFillColor(HexColor('#ff8100'))
    
    ...
    

提交回复
热议问题