[reportlab-users] Best way forward

Rafael Lopes rafael at whitehat.com.br
Wed Aug 11 22:44:58 EDT 2010

2010/8/11 Simon <simonluijk at gmail.com>:

> On 11 August 2010 19:08, Steve Romanow <slestak989 at gmail.com> wrote:

>>> They are going to be printed on continus paper that is perferated every

>>> 20cm. If a invoice is too large to fit on one page it should continue


>>> the second page as if it is the same piece of paper. e.g. the second


>>> should not have a header. I think it would be easer to create one large


>>> (40cm high) rather then two seperate ones. Is it posible to create a pdf

>>> page (PageTemplate) with a flexable height? or change the height if I

>>> calculate that the flowables wont fit (Most likely be one table per

>>> invoice).

You can cycle through two PageTemplates. A first PageTemplate with a frame
with 20 cm on top and a second one with a Frame
on bottom. The first also draws a header and the second don't.


>>> Here comes the wedge: There is a piece of text that has to come below


>>> invoice item table. If the pdf needs to be printed on two pages it


>>> not get printed on the bottom of the first page but the second.


>>> Is it posible to wrap two flowables in a flowable that can not be split?

You can use the KeepTogether flowable.

>>> My other question is: Is it posible when a PageTemplate is drawing the

>>> static elements on the page to grab information from the first flowable


>>> be drawn on that page. Related to that is it posible to store extra data


>>> a flowable.

Yes you can store whatever you want to in a flowable that you implement.

You can also insert a NextPageTemplate before a special flowable. You can
store some data in doctemplate.
Like the current header text. Just implement a DocTemplate with you
information, and get it on the beforePageDraw of
Page template. Something like:

class SpecialDocTemplate(DocTemplate)
def afterInit(self):
self.my_special_data = None

But before you implement You can change the PageTemplate with a
NextPageTemplate flowable.

>> I don't have a specific RL answer for you, however, I have had to handle

>> this with some other products so lets just talk concepts. I will need to

>> tackle this one day in RL (I hope, if my company purchases).


>> You need 4 layouts, Single, First, Middle, Last.


>> Single will have Header, Detail Footer

>> First will have Header and Detail

>> Middle will only have Detail (maybe a mini header, but different than

>> First)

>> Last will have Detail and Footer


> Yes that is good, I think I could get that to work in Reportlab. I think

> having seperate pages is better as then a table row wont get printed on


> perferation line between two pages.


> The only dificutly I think I will have is working out which PageTemplate


> use, especily when I am creating more then one invoice. I will have a


> at it tomorrow.


> Thanks again


> Simon Luijk




>> _______________________________________________

>> reportlab-users mailing list

>> reportlab-users at lists2.reportlab.com

>> http://two.pairlist.net/mailman/listinfo/reportlab-users



> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users



Rafael Lopes
(11) 6729-1897
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100811/002a3170/attachment-0001.html>

More information about the reportlab-users mailing list