[reportlab-users] Newbie Page Breaks

Robin Becker reportlab-users@reportlab.com
Thu, 23 Sep 2004 08:43:31 +0100


Graeme wrote:
> G'day
> 
> 
> I downloaded reportlab this morning as I need to generate order PDFs.
> 
> I have read the doco but am still a bit confused and I have searched the net looking for a complete example
> 
> There is a definite problem with my understanding. Obviously reportlab does not auto generate page breaks so I have to do it.
> My content list has about 200 order items in it but it only writes to one page.
> 
> For example:
> 
> c = canvas.Canvas(filename)
> c.setPageCompression(0)
>     
> textobject = c.beginText()
> textobject.setTextOrigin(5, 800)
> textobject.setFont("Courier", 8)
> textobject.textLines("\r\n".join(content))
> c.drawText(textobject)
> doc.multiBuild(story)
> c.save()
> 
> Can anyone help with some pointers on how one controls page break, I am also confused as to which base class
> should be used to generate a simple PDF
> 
> many thanks, and lastly this is an awesome product !!!!!!

Your example is a bit confused as it seems to include elements of both 
the doctemplate approach and direct canvas drawing.

ie multibuild applies to the doctemplate approach.

If you resist the doctemplate tendency and want to draw everything 
directly yourself (a compleetly viable approach) then you need to look 
at showPage etc to control the canvas directly.

The doctemplate classes allow for automatic page/frame throws.

-- 
Robin Becker