[reportlab-users] Tracking Position on Canvas
Tim Roberts
timr at probo.com
Fri Nov 9 19:59:49 EST 2007
Rich Shepard wrote:
> I have a portion of one report that displays five levels of a
> hierarchy,
> and I'm writing it directly to the canvas rather than trying to
> integrate a
> platypus table into the rest of the report.
>
> When the text is 72 points or less from the bottom of the page I
> want to
> force a new page to begin. To do so, I have written:
>
> place = tb.getY()
> if place <= 72:
> pg.showPage()
>
> taking advantage of Tim's TextBox() class. I test page position at
> several
> places in the code because it can get below the threshold at more than
> one
> place.
>
> However, it's not working as intended. Rather than getting page
> breaks, I
> get more than 1700 blank pages after the first page.
Are you calling tb.setXY to reset the position to top of page? The
TextBox object won't have any idea that you ejected a page. It doesn't
communicate with the canvas. It still thinks you're at Y=72.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the reportlab-users
mailing list