Re: Using landscape in DocTemplates

Adrian Klaver <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
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
> [email protected]
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>


-- 
Adrian Klaver
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.