[reportlab-users] SimpleDocTemplate and clever in document numbering

Laszlo KREKACS laszlo.krekacs.list at gmail.com
Tue Jun 15 08:44:29 EDT 2010

Dear list,

Im using SimpleDocTemplate from platypus for generating PDF documents.
The document has two parts:
- the main document (page number: 1 .. x)
- Appendix (pagenumber: 1/1 .. 1/x)

For now, Im using myLaterPages(canvas,doc) function to decide where
am I (main document or appendix), and draw some simple stuff directly
to the canvas. But it is different for the main document and for
the appendix.

Im using something like:
if doc.page < 7: doMainLook(canvas))
else: doAppendixLook(canvas)

My problem is obvious: I would not like to depend on page numbering
to decide where ends the main document, simply because I cant be
sure its always 6 page long.

So Im looking some other method, like adding a temporary flowable
to the elements list, so I could somehow test if the current page
contains this flowable. If so, then the appendix already began.

I hope it is not too fuzzy, and you understand the problem.

Best regards,

ps: the real document would be about 30 pages, plus 2 appendix
each of it is at least 10 pages.
Also for some of the pages, I would like to omit the page number,
just like the chapters are in books.

More information about the reportlab-users mailing list