ReportLab for PDF

Install ReportLab

  方法一:

  python pip install reporlab 

  方法二:

        https://pypi.python.org/pypi/reportlab 去下载python对应版本的reoplab文件

  python3 -m pip install D:/*.whl 

Example:

from reportlab.pdfgen import canvas


def hello(c):
    c.setFont("Times-Roman", 20)
    string = r"Hello World!"
    c.drawString(50, 800, string)

pdf = canvas.Canvas("hello.pdf")
hello(pdf)
pdf.showPage()
pdf.save()
原文地址:https://www.cnblogs.com/ystwyfe/p/7507935.html