[reportlab-users] How to render a flowable on a normal canvas?

Andy Robinson andy at reportlab.com
Sun Nov 19 16:34:04 EST 2006


Chris Withers wrote:

> Hi there,

>

> The excellent barcode stuff that ships with reportlab seems to be geared

> towards inclusion in platypus-based pdfs.

>

> I'm probably missing something simple, but how can I just render a

> barcode at a particular point on a canvas?


You can render any flowable anywhere by calling 'wrap' first with a big
enough width and height (this is needed for paragraphs for obvious
reasons, but it's a formality you just need to observe for rectangular
shapes), then drawOn(canvas, x, y) with the desired location. I can't
remember right now if x,y is top or bottom left but I'm sure you'll
figure it out in seconds ;-)

- Andy


b = MyBarCode(options)
b.wrap(10*cm, 3*cm) #any figures big enough will do
b.drawOn(canvas, x, y) #where you want it drawn...



More information about the reportlab-users mailing list