[reportlab-users] Page background image with Platypus?

Stephan Diehl stephan.diehl at gmx.net
Fri Oct 5 13:55:54 EDT 2007


Erik Wickstrom wrote:

> Hi,

>

> I'm trying to use an image as a background for my pdf. The image is

> large enough to cover the page. It seems to work fine when printing

> straight to the canvas with "p.drawImage

> ('/root/journal/gazette/paper1.png', 0, 0, width=None, height=None,

> mask=None)" but I need to use Platypus.

>


[...]

> 671. raise LayoutError(ident)

>

> LayoutError at /gazette/test/

> Flowable <Image at -0x4950c374 frame=normal

> filename=/root/journal/gazette/paper1.png> too large on page 2

>

> What am I doing wrong?


you can embed this into a 'KeepInFrame' object
for example

from reportlab.platypus.flowables import KeepInFrame
from reportlab.platuyps import Image

[ ...some code... ]

image = Image(<... whatever ...>)
story.append(KeepInFrame(MAXWIDTH, MAXHEIGHT, [image])

this will scale you image in such a way that it's not larger than
MAXWIDTH, MAXHEIGHT.

Hope that helps

Stephan



>

> Thanks!

> Erik

> |

>

>

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

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

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




More information about the reportlab-users mailing list