You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
596 B
Python

4 years ago
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('<font size=12>{}</font>'.format(i), styles["Normal"])
content.append(p)
content.append(Spacer(1, 12))
doc.build(content)