[aklug] Printing Return Address Labels the unix Way

From: Fielder George Dowding <fgdowding@iceworm-enterprises.org>
Date: Sun Dec 16 2007 - 23:14:03 AKST

Greetings all, earlier today Doug presented me with the problem of
getting a Word document to print correctly in OO Writer. It turned out
the document simply prints out return addresses labels. The Avery labels
are four across and twenty down. Well, there is an easier way.

I am reminded not to be too hard on Windows and Word users because they
don't have much to work with. We in the unix world are spoiled because
we expect to have all the tools that one might need to do little tasks
such as this. Each of us probably have a preferred technique, and in
this case, my preferred technique is to whip up a quick little
PostScript program with the help of vim and gv.

This is a first cut. I don't have the dimensions and the exact layout of
the labels which will affect the point size of the font, the leading,
and other dimensions needed to get the graphite in the right places on
the cellulose. Further, I have not yet added the Document Structuring
Conventions which make life easy when using the program on different
platforms and printing utilities. Finally, like Arthur's comments, I
probably have missed a point or two in good programming technique.
Nevertheless, here it is for everyone to try. Just copy the text between
the START and END to a plain text file with the extension of ps, i.e.:
returnAddressLabels.ps

Then simply call the GhostView utility to display on your monitor. On my
boxen I have gv, so at my regular user login prompt, I simply enter:

fgd@seth:~/psfiles/addressLabels$ gv returnAddressLabels.ps &

x-x-x-x-x-x START PostScript x-x-x-x-x-x
/leading {-10} def

/LabelWidth { 2.125 72 mul } def

/LeftEdge {18} def

/TopEdge {778} def

/Helvetica findfont 9 scalefont setfont

/printAddress {
(First Line of Address) dup show
stringwidth pop neg leading rmoveto

(Second Line of Address) dup show
stringwidth pop neg leading rmoveto

(Third Line of Address) dup show
stringwidth pop neg -2 leading mul rmoveto
} def

/printRow {
0 1 3 {
    printAddress
    LabelWidth 0 rmoveto
} for
} def

LeftEdge TopEdge moveto

0 1 19 {
printRow
-4 LabelWidth mul
3.75 leading mul rmoveto
} for

showpage
x-x-x-x-x-x END PostScript x-x-x-x-x-x

-- 
Mit freundlichen Grüßen / Best regards       Debian/GNU Linux
Fielder George Dowding, Chief Iceworm        "etch" Testing
dba Iceworm Enterprises, Anchorage, Alaska   User Number 269482
Since 1976 - Over 30 Years of Service.       "Seth" 186667
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GE/MU d+@ s+: a+++>++++ C++(+++)>$ UL++>$ P+>+++>$ L+++>$ !E W+++>$
N- o? K? W-- O !M V? PS-- PE+ Z+ PGP t+ 5? X- !R !tv b++ DI !D G
e++>+++ h+>--- r>+++ Y+>+++
------END GEEK CODE BLOCK------
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Dec 16 23:10:35 2007

This archive was generated by hypermail 2.1.8 : Sun Dec 16 2007 - 23:10:35 AKST