[reportlab-users] Noob Instancing Question (no FAQ?)

Jerome Alet reportlab-users@reportlab.com
Thu, 12 Feb 2004 00:10:11 +0100


On Wed, Feb 11, 2004 at 10:53:49PM -0000, Ian wrote:
> I'm a complete noob on this list, so apologies if the question is perennial
> (is there a FAQ?).
> I have a document containing several hundred very similar diagrams. Each
> consists of a handful of symbols plotted on a rather complex grid. The grid
> is identical in all diagrams. Having several hundred bloats the file size,
> however, into the megabyte range.
> I'd like to do something like in SVG, where you define a 'symbol' which can
> then be instanced many times without duplicating all the drawing code each
> time. I should be able to save nearly 2 meg if I can do this.
> Question is, can I?

Of course.

In ReportLab you have to use the form mechanism :

        - beginForm
        - ... your stuff here.
        - endForm

then :

        - doForm each time you want to create the repetitive object.
Search the mailing list archive, I've posted an URL to 
an example on how to do this two or three weeks ago.


Jerome Alet
"A non-free program is a predatory social system that keeps people 
in a state of domination and division, and uses the spoils to 
dominate more." - RMS