[reportlab-users] Mailing labels

Andy Robinson reportlab-users@reportlab.com
Thu, 10 Apr 2003 00:58:50 +0100


> I shudder at
> the prospect of having to build templates for every different 
> printer used. I
> realize that this is not a problem inside reportlab itself, but 
> if anyone has
> encountered, and successfully overcome this problem, I'd love to 
> hear suggestions.
> 
You aren't the first.  Once upon a time somebody on
this list started collecting lists of printer variations :-)
In general anything using Postscript and costing say
$5000 or more is pretty accurate, but inkjets aren't :-(

The best approach I know is to have a 'test mode' which
draws, say, grey boirders where it thinks the label edges
are.  You can then use the canvas transform and translate
methods.  So if your default script is written with these
rather pointless calls...

    # at the beginning
    NUDGE_X = 0.0
    NUDGE_Y = 0.0
    STRETCH_X = 1.0
    STRETCH_Y = 1.0

    # and before drawing each page...
    canv.translate(NUDGE_X, NUDGE_Y)
    canv.scale(STRETCH_X, STRETCH_Y)

...then you can see how much it misses by, and 'calibrate'
for your printer.  

If your web server has to work for end users with any printer,
the best I can suggest today is to offer them a 'test card'
with a ruler on it and instructions on how to calibrate
themselves.  

So, you should keep shuddering because it IS a horrible
problem, but there is a sane global way to adjust things 
without making many different templates.

If you find a better way let us all know!

Thanks,

Andy Robinson