Create PDF file in Python using the open source Python library from Reportlab.

Add several pages to the PDF file.

See also Creating PDF files using Python and reportlab

examples/python/pdf_multiple_pages.py

from reportlab.pdfgen import canvas


def create_pdf():
    pdf_file = 'multipage.pdf'

    can = canvas.Canvas(pdf_file)

    can.drawString(20, 800, "First Page")
    can.showPage()

    can.drawString(20, 800, "Second Page")
    can.showPage()

    can.drawString(20, 700, "Third Page")
    can.showPage()

    can.save()

create_pdf()