[reportlab-users] a replicated canvas?
Andy Robinson
andy at reportlab.com
Tue Sep 18 07:28:44 EDT 2007
The "canvas" is the size of the page, so it's your job to move across or down as you loop, or perhaps have a function to do each layout and pass in its x-y origin.
If you use drawImage, I think it's smart enough to realise the image is being reused. If it sees the same filename in the same document, it just uses a reference to the first one which it has read in. Normally images are stored outside of the page stream and referenced. (If you use drawInlineImage you can force it to bloat up the files as you fear)
I am away from the source code on a Blackberry and going from memory, so please watch the file sizes and check!
- Andy
--
Andy Robinson
CEO/Chief Architect
ReportLab Europe Ltd.
tel +44-20-8544-8049
-----Original Message-----
From: Jon Bradley <shiftedpixels at gmail.com>
Date: Tue, 18 Sep 2007 06:59:50
To:Support list for users of Reportlab software<reportlab-users at reportlab.com>
Subject: [reportlab-users] a replicated canvas?
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
_______________________________________________
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