[reportlab-users] Reportlab and Django - Beginner - landscape A4

Andy Robinson andy at reportlab.com
Fri Sep 4 03:51:22 EDT 2009

2009/9/4 leau2001 <laurent.caron.3 at free.fr>:

> HEllo,


> Im a new user of Reportlab library, and i try to use it with my Django local application. I tried to use table on my page.. i succeed but in want now to use A4 landscape for my pdf... i tried pagesize=landscape(A4), but don't work...


Here's the problem. HTTP knows nothing about page sizes in PDF and
cannot affect your PDF file,
so don't add pagesize here...

>    response['Content-Disposition'] = 'attachment; filename=somefilename.pdf  pagesize=landscape(A4)'

>    p = canvas.Canvas(buffer)

Instead, tell ReportLab the size of PDF you want to create:
p = canvas.Canvas(buffer, pagesize=landscape(A4))

- Andy

More information about the reportlab-users mailing list