listing21-1.py 243 B

123456789
  1. from reportlab.graphics.shapes import Drawing, String
  2. from reportlab.graphics import renderPDF
  3. d = Drawing(100, 100)
  4. s = String(50, 50, 'Hello, world!', textAnchor='middle')
  5. d.add(s)
  6. renderPDF.drawToFile(d, 'hello.pdf', 'A simple PDF file')