[reportlab-users] Float flowable to bottom of page
    Robin Becker 
    robin at reportlab.com
       
    Thu Feb  4 11:33:28 EST 2010
    
    
  
On 04/02/2010 14:58, Adrian Klaver wrote:
> On Thursday 04 February 2010 6:30:52 am Robin Becker wrote:
>> On 03/02/2010 21:59, James Lance wrote:
>
>>
>> OK this code appears a bit better in that you don't need to work out the
>> height of the flowables before doing stuff
>>
............
>>
>>       def _makeBreak(self,h):
>>           if self._brk=='page':
>>               return PageBreak()
>>           else:
>>               return FrameBreak
>
> I have been following along and I think I understand what is going on, except
> for above. I know this is test for the type of break, but where does that come
> into play? Also should it not be PageBreak?
>
>
>>
>>       def split(self,aW,aH):
>>           dims = []
>>           W,H = _listWrapOn(self._content,aW,self.canv,dims=dims)
>>           if self._state==0:
>>               if H<aH:
>>                   return [Spacer(aW,aH-H)]+self._content
>>               else:
>>                   S = self
>>                   S._state = 1
>>                   return [self._makeBreak(aH), S]
>>           else:
>>               if H>aH: return self._content
>>               return [Spacer(aW,aH-H)]+self._content
>>
>
>
>
well some people might want to force to the next frame and others might want to 
force to first frame on the next page. Others might always want to use the last 
frame on a page etc etc.
For a multi frame layout there are several things that float to the end might 
mean. I chose to keep it simple here since the SimpleDocTemplate class has only 
one frame the two options are equivalent.
Unfortunately for some reason PageBreak is a class and not a singleton instance, 
but FrameBreak is a singleton.
For the full horror of a multi-column layout we need to look at which frame 
we're in and decide on the appropriate action. That could be something like skip 
to the next page and then select the last frame before adding the space and the 
flowables. Not sure if we could do that easily within this simple flowable and I 
don't think the possible errors are considered well.
-- 
Robin Becker
    
    
More information about the reportlab-users
mailing list