from reportlab.lib.pagesizes import letter, A4 from reportlab.pdfgen import canvas from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle doc = SimpleDocTemplate("text.pdf", pagesize=A4, rightMargin=72, leftMargin=72, topMargin=72, bottomMargin=18) content = [] styles = getSampleStyleSheet() for i in range(10): p = Paragraph('{}'.format(i), styles["Normal"]) content.append(p) content.append(Spacer(1, 12)) doc.build(content)