Re: [xsl] mailing labels

Subject: Re: [xsl] mailing labels
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Sep 2003 15:24:16 -0400
At 2003-09-03 13:32 -0500, Stenson, Bob wrote:
I need to make mailing labels with absolute positioning to fit Avery label
stock 5161, 5261, and 5266.  Does anyone know how to do this?

With a lot of arithmetic! No magic is involved ... as you say, just use absolute positioning. What is it that you wanted to know to do?


It is quite straightforward, but also quite lengthy. When I wrote an internal version of this I included a command line parameter that specified the number of blank labels already ripped off the end of the page ... that way I was always printing at the bottom of the page which gave the most strength to the paper when the printer was pulling the page through the gears. When I consumed labels from the top of the page and labels were missing, the gears of the printer couldn't push the paper through and it accordioned inside of the printer.

If I had a form of 6 shipping labels (3.33"x4.00") unused, and I needed three labels, I would print off:

.---.---.
|   |   |
|---|---|
|   | 1 |
|---|---|
| 2 | 3 |
`---|---'

The next time if I only needed to print two, they would be:

.---.---.
|   | 1 |
|---|---|
| 2 | x |
|---|---|
| x | x |
`---|---'

If I then needed to do three, I produce the following with XSL-FO:

.---.---.
| 1 | x |
|---|---|
| x | x |
|---|---|
| x | x |
`---|---'

.---.---.
|   |   |
|---|---|
|   |   |
|---|---|
| 2 | 3 |
`---|---'

again leaving the strength at the top of the paper.

I also took the time to generalize the dimensions so I use the same code for diskette labels, name tags, etc.

Oh, one last thing: I preface the generalized stylesheet with the production of the actual FO found in each of the labels, but they aren't positioned ... it is the second step that inserts the preliminary FO into the absolute containers of the arithmetically calculated FO to produce the final FO that prints the labels. Thus I can now support any sized labels with any matrix of rows and columns with any XSL-FO just by writing the FO for the content of a label: some have my logo, some are otherwise blank, some are generated from my class lists (that's for the name tags), etc.

I hope these ideas help!

................... Ken

--
Next public European delivery:  3-day XSLT/2-day XSL-FO 2003-09-22
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 0-13-140374-5                               Definitive XSL-FO
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:     http://XMLGuild.info
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread