if __name__ == '__main__':
    doc = MyDocTemplate('filename.pdf', pagesize=A4, rightMargin=0.3 * inch,
        leftMargin=0.3 * inch, topMargin=0.3 * inch, bottomMargin=0.3 * inch)
elements = []
doc.addPageTemplates([])
doc.build(elements)
Conditional page break in reportlab