[reportlab-users] Help making label software match paper
Paulo Eduardo Neves
reportlab-users@reportlab.com
Thu, 22 May 2003 00:34:09 -0300
Have you ever tried to print some labels (e.g. Avery) using MS Word?
Once I had to print almost a thousand labels, and it was one of the
worst days in my relation with computers.
Some years ago I needed to generate labels and decided to program it
using ReportLab. Everything worked!!! Today I came back to my program,
and after upgrading the Report Lab libs, it isn't correct any more.
It is generating the labels file, but when I print, the labels doesn't
match the paper anymore. I tried to change a lot of options in acrobat
reader (fit to page, paper size etc.) but the only way to print it
correctly is using ghostview in a linux box, and printing in a windows
connected printer via samba:-(. I've metered the labels position inside
the pdf document and everything looks fine.
I believe that the problem is with some change in report lab lib. Maybe
some of the experts here in the list can help me?
I'm posting the code below. It is very simple. Running it you have a
test pdf document (with a grid draw at the borders). The input is a
list of lists. Each element from the outer list is a label, and each
element of the inner list is a line in the label.
The only twist is that the code try to fit the text inside each label.
First wrapping the words in each line, if the text still doesn't fit,
then reducing the font. Yes, at the end you have labels with different
fonts, but you don't need to print everything with a very small font
just because someone in your mailing has a very long name.
You can see the code here:
http://www.samba-choro.com.br/neves/pdflabels.py
--
Paulo Eduardo Neves
Agenda do Samba & Choro, o boteco virtual do samba e choro
http://www.samba-choro.com.br