Search code examples
pythonreportlab

Same matter in triplicate in a canvas


c.setFont("Times-Roman", 12)    
c.drawRightString(148,750,"PARTICULARS")
c.drawRightString(148,475,"PARTICULARS")
c.drawRightString(148,200,"PARTICULARS")

Is there a way to shorten this code to achieve the same result? (Python Reportlab pdf canvas)


Solution

  • You can use a loop.

    c.setFont("Times-Roman", 12);
    for y in range(750, 199, -275):
        c.drawRightString(148, y, "PARTICULARS")