[reportlab-users] a replicated canvas?

Jon Bradley shiftedpixels at gmail.com
Tue Sep 18 06:59:50 EDT 2007


I posted a while back and now am in the process of actually building
some content from a front-end application (written in Adobe Flex).

I've only got two assets that I need to place into the PDF file - but
the problem is that I need to place them multiple times.

One specific "form" or "canvas" of the PDF will consist of a
background image and a text field on top of that (at a specific size,
position and color). The text field is populated from a database.

I'd like to know if there is a method whereby I can create a canvas
on the PDF, and replicate that 8 times per page (2 columns, 4 rows).

I've looked through the docs and I don't see anything that is going
to help me do this quicker than adding each one specifically. Ideally
I'd loop over the pages, then the rows/columns and place the elements.

pseudocode:

for i in pages
for j in columns
for k in rows
place image
place text
set text properties

Is this how you would suggest I do this? I don't understand the PDF
format fully, and the image I am adding is just being replicated
multiple times and I'm concerned the file size will be humongous.
Only that single text field will change from canvas to canvas.

Any tips are most appreciated.

- jon




More information about the reportlab-users mailing list