[reportlab-users] canvas inside canvas?
Thu, 18 Sep 2003 10:50:34 +0200
Robin Becker wrote:
> In article <3F68A08B.firstname.lastname@example.org>, Oliver Bleutgen <email@example.com>
>>I have a canvas which contains several fixed sized areas, in which my
>>application adds images (via canvas.drawImage(...)). Now I want to
>>extend that to canvas-like objects, i.e. something like
>>canv = canv.Canvas(filename, pagesize=(1000,1000))
>>subcanv1 = canv.Canvas('dummy.pdf', pagesize=(500,500))
>>subcanv1.lines( ... ) # draw some lines
>>subcanv1.drawImage( ... ) # draw an image
>># this doesn't exist:
>>Any tricks how to do something like that? Perhaps by mucking around with
>>Or would the graphics.Drawing class be the thing to look at?
>>It seems to be able to hold Bitmap Images, though this is undocumented.
>>Thanks for the great product, btw.
> you need canvas forms. I think these are in canvas.py
> see methods beginForm, endForm, doForm.
Thanks for the answer Robin, and as I see it, Forms would exactly solve
the problem I described with the code, but I fear that I should have
written some more pseudocode:
canv = canv.Canvas(filename, pagesize=(1000,1000))
subcanv1 = canv.Canvas('dummy.pdf', pagesize=(500,500))
subcanv1.lines( ... ) # draw some lines
subcanv1.drawImage( ... ) # draw an image
# this doesn't exist:
# plot the same "subcanvas somewhere else ...
# let's change subcanv1 somewhat
subcanv1.lines(...) # some more lines to subcanv1
That's not possible with Forms, right?
So, wouldn't the Drawing class be the way to go, with the (undocumented,
but existing) feature that it can also contain bitmaps?