Multiple pages using Reportlab - Django Multiple pages using Reportlab - Django python python

Multiple pages using Reportlab - Django


showPage(), despite its confusing name, will actually end the current page, so anything you draw on the canvas after calling it will go on the next page.

In your example, you can just use p.showPage() after each p.drawString example and they will all appear on their own page.

def Print_PDF(request):    response = HttpResponse(content_type='application/pdf')    response['Content-Disposition'] = 'attachment; filename="resume.pdf"'    p = canvas.Canvas(response)    p.drawString(100, 100, "Some text in first page.")    p.showPage()    p.drawString(200, 100, "Some text in second page.")    p.showPage()    p.drawString(300, 100, "Some text in third page")    p.showPage()    p.save()    return response