🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #8134

Re: Full sheet address label program

#8134
From: Liudvikas Bukys
Date: Tue, 21 Mar 1989 17:39
89 lines
2877 bytes
In article <15294@eecae.UUCP> mireley@eecae.UUCP (John Mireley) writes:
>Is there a postcript program available that takes as input
>a file of one line, delimited addresses, that would print
>these in three columns and positioned on an 8.5x11 page, to make use
>of a full sheet of Avery address labels designed for copiers.

Here is a shell script that takes as input a bunch of labels,
with newlines at the ends of lines, and a blank line between labels.

--------------------------------CUT-HERE---------------------------------------

#!/bin/sh
###############################################################################
#
# label2ps -- convert label data to postscript, in 11 x 3 format
# by Liudvikas Bukys	<bukys@cs.rochester.edu>	October 7, 1988
#
###############################################################################

for f in "${@-'-'}"
do
	cat "$f"
	echo ""
done | sed -e 's/[\\()]/\\&/g' | awk '
BEGIN	{
	print	"%!PS-Adobe-1.0"
	print	"%%Pages: (atend)"
	print	"%%DocumentFonts: Helvetica Helvetica-BoldOblique"
	print	"%%BoundingBox: 0 0 612 792"
	print	"%%EndComments"
	print	"/Helvetica findfont 9 scalefont setfont"
	print	"/INIT	{"
	print	"	/N 0 def"
	print	"	} def"
	print	"/NEXT	{"
	print   "%	N 32 ge { (page ?) PAGE } if"
	print	"	0 792 moveto"
	print	"	18 -22 rmoveto"
	print	"	N 11 idiv 204 mul  N 11 mod -72 mul  rmoveto"
	print	"	/N N 1 add def"
	print	"	} def"
	print	"/LINE	{"
	print	"	gsave show grestore"
	print	"	0 -10 rmoveto"
	print	"	} def"
	print	"/PAGE	{"
	print	"	gsave"
	print	"	/Helvetica-BoldOblique findfont 8 scalefont setfont"
	print	"	426 30 moveto"
	print	"	LINE"
	print	"	0 -10 rmoveto"
	print	"	('"`whoami`  `date`"') LINE"
	print	"	grestore"
	print	"	showpage"
	print	"	INIT"
	print	"	} def"
	print	"INIT"
	print	"%%EndProlog"
	print	"%%Page: 1 1"
	labels = 0
	pages = 1
	}
	{
	if ($0 == "")
		line = 0
	else	{
		if (line++ == 0)
			{
			if (labels%32 == 0 && labels != 0)
				{
				print "(" "page " pages ") PAGE"
				pages++
				print "%%Page: " pages " " pages
				}
			print "NEXT"
			labels++
			}
		print "(" $0 ") LINE"
		}
	}
END	{
	print "NEXT"
	print "(TOTAL OF " labels " LABELS PRINTED) LINE"
	print "(" "page " pages ") PAGE"
	print "%%Trailer"
	print "%%Pages: " pages
	}'

--------------------------------CUT-HERE---------------------------------------
Technical Details
Message-ID: <1989Mar21.123910.11095@cs.rochester.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!bukys
References: <15294@eecae.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!bukys
From: bukys@cs.rochester.edu (Liudvikas Bukys)
Newsgroups: comp.lang.postscript
Subject: Re: Full sheet address label program
Message-ID: <1989Mar21.123910.11095@cs.rochester.edu>
Date: 21 Mar 89 17:39:10 GMT
References: <15294@eecae.UUCP>
Reply-To: bukys@cs.rochester.edu (Liudvikas Bukys)
Distribution: usa
Organization: U of Rochester, CS Dept, Rochester, NY
Lines: 89