[reportlab-users] Using landscape in DocTemplates

Adrian Klaver adrian.klaver at gmail.com
Wed Jan 8 16:10:48 EST 2014


On 01/08/2014 01:07 PM, Mike Driscoll wrote:

> Hi,

>

> I thought I had this figured out, but I guess not. I am creating a

> SimpleDocTemplate like this:

>

> self.doc = SimpleDocTemplate(fileObj, pagesize=letter,

> leftMargin=l_margin)


Try:

pagesize=landscape(letter)


>

> And then building it like this:

>

> self.doc.build(self.story,

> onFirstPage=self.create_pdf

>

> In the create_pdf method, I tell reportlab that I want the canvas to be

> in landscape:

>

> self.c = canvas

> self.c.setPageSize( landscape(letter) )

>

> Unfortunately, if I create a table or other flowable that is too large

> to fit on the first page, the second page ends up being in portrait

> mode. I tried adding the second kwarg for the build operation

> (onLaterPages) and told it to also set the size to landscape, but it

> doesn't appear to work correctly...the second page goes landscape, but

> the table is mostly missing with only the last row or so showing up on

> the page. So somehow it seems that reportlab is drawing the table on the

> second page as if it were in portrait mode and then when it saves it, it

> flips it to landscape?

>

> Is there some way to tell the template to just be in landscape mode

> across all pages?

>

> Thanks!

>

> -------------------

> Mike Driscoll

>

> Blog: http://blog.pythonlibrary.org

>

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

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

>



--
Adrian Klaver
adrian.klaver at gmail.com


More information about the reportlab-users mailing list