Newsgroups: fj.comp.printers,fj.comp.misc,fj.lang.postscript
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!aist-nara!ie.u-ryukyu.ac.jp!yas
From: yas@ocean.ie.u-ryukyu.ac.jp (Yasushi Shinjo)
Subject: Re: barcode printable
In-Reply-To: nagata@butter.kitakyu-techno-ctr.co.jp's message of 24 Sep 1994 13:26:39 +0900
Message-ID: <YAS.94Sep25015833@bottom.ie.u-ryukyu.ac.jp>
Lines: 223
Sender: news@spn.ie.u-ryukyu.ac.jp (News System Admin)
Organization: Dept. of Elect. & Info. Eng., Univ. of the Ryukyus, Okinawa,
	Japan
References: <35md88$9u7@butter.kitakyu-techno-ctr.co.jp>
	<3609pv$fng@butter.kitakyu-techno-ctr.co.jp>
Date: Sat, 24 Sep 1994 16:58:33 GMT
Xref: galaxy.trc.rwcp.or.jp fj.comp.printers:818 fj.comp.misc:2369 fj.lang.postscript:688
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.comp.misc&nb=2369&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

$B?7>k!w>pJs!%N05eBg3X$G$9!#$3$s$K$A$O!#(B
$B$J$<$+%a!<%k$,Aw$l$J$$$N$G!"%K%e!<%9$K$7$^$9!#(B

In article <3609pv$fng@butter.kitakyu-techno-ctr.co.jp> 
nagata@butter.kitakyu-techno-ctr.co.jp (nagata) writes:
>   $B:#F|$O!"1JED!w%7%9%3%`$G$9!#(B
..
>   $B!&$?$V$s#5G/0J>eA0$K!"(Bcomp.lang.postscript $B$+$I$3$+$KN.$l$?(B 
>     PostScript $B$N%W%m%0%i%`(B

$B$=$N%W%m%0%i%`$=$N$b$N$,!"=);39@0l$5$s!wIY;N%<%m%C%/%9(B
<akiyama@q.ksp.fujixerox.co.jp>$B$+$i;d$N=j$K$H$I$-$^$7$?!#;d(B
$B$K$O!"1JED$5$sEv$F$N%a!<%k$N(B cc: $B$GMh$?$N$G$9$,!"$b$7$+$7$?(B
$B$i!"F1$8$/%a!<%k$,FO$+$J$$$G$$$k$+$b$7$l$J$$$N$G!"$=$N%W%m%0(B
$B%i%`$r%]%9%H$7$^$9!#$J$*!";d$b=);3$5$s$b0lEY$b;H$C$?$3$H$,$"(B
$B$j$^$;$s!#$&$^$/$$$C$?$i!"%K%e!<%9$KJs9p4j$$$^$9!#(B

$B!@!@!!?7>k!!Lw!!!J$7$s$8$g$&!!$d$9$7!K!!!@!@(B
$B!@!@!!N05eBg3X!!>pJs9)3X!!!!!!!!!!!!!!!!!@!@(B

$B$3$l$O!"#2G/A0$G$9$M!#(B
----------------------------------------------------------------------
From: sham@cs.arizona.edu (Shamim Zvonko Mohamed)
Newsgroups: comp.lang.postscript
Subject: Re: Zip Code "Bar Codes"
Date: 31 Oct 92 03:31:53 JST
Organization: U of Arizona CS Dept, Tucson

I have this script that generates PS for envelopes, including the FIM and
5-digit zips. It also typesets the address in accordance with the USPS
guideline (Ref. "A Guide to Business Mail Preparation"). It also prints
return addresses, and can accommodate different envelope sizes. It's short
enough that I guess it can be posted here, so here goes:
==================== cut here =================
:
# Copyright 1991 Shamim P. Mohamed   <shamim@cs.arizona.edu>
# Department of Computer Science, University of Arizona, Tucson AZ 85721
#
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation; either version 2 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# * GNU General Public License (the file COPYING in this directory, or send
# * me mail) for more details.
# *
#
# Usage:
# The addresses are read from standard input. The adressee's address comes
# first, and a '#' alone on a line demarcates the to address and the sender's
# address.
#
# $ pr-envelope [-c] [width height] | lpr
# Acme Products
# 1 Gizmo Drive
# Olmo, RI 02345-8956
# #
# Wile E. Coyote
# 10 Hunger Drive
# Toon Town, NV 56789-1234
#
# The return address is optional; if not present, it will look for the file
# $HOME/.return_address and use that; and if that is missing, no return
# address will be printed. If the +4 is missing, it will print a 5-digit
# bar-code. If the zip is missing, the Postnet bar-code will not be printed,
# and neither will the FIM (the mark at the top that indicates that a bar-code
# is present, and the orientation). The address will be converted to all
# upper-case, except if -c is used. Punctuation is removed.
# (Ref. "A Guide to Business Mail Preparation," USPS Publication.)
#
# Arguments are size of the envelope (in PostScript units, 72 = 1 inch), and
# default to the standard business size. The envelope should be manually fed,
# centered. This works on LaserWriters, you may have to experiment a little
# for other printers.
#

if [ ."$1" = '.-?' ]; then
   echo Usage: $0 '[-c] [width height] | lpr'
   exit 1
fi
if [ ."$1" = .-c ]; then
   echo Preserving case. >&2
   case_cmd=cat
   shift;
else
   case_cmd="tr a-z A-Z"
fi
e_width="${1:-678}"
e_height="${2:-298}"
echo Using size $e_width x $e_height >&2
$case_cmd | sed -e 's/\.//g;s/,//g;s/  */ /g' |
awk '
   BEGIN          { FS = " "; zip = ""; print "%!\n/nopostnet 0 def /addr [" }
   length > 1     { printf "(%s)\n", $0 }
                  { z = $NF }
   length == 1    { if($0 == "#") {zip = substr(z,1,5)+0; p4 = substr(z,7,4)+0
                    print "] def /rt ["} else { printf "(%s)\n", $0 }}
   END            { if(zip == "") {zip = substr(z,1,5)+0; p4 = substr(z,7,4)+0}
                    if(zip == 0) print "] def /nopostnet 1 def"; else
                    if(p4 == 0) printf "] def /zip4 (%05.5d) def\n", zip; else
                    printf "] def /zip4 (%05.5d%04.4d) def\n", zip, p4 }' |
sed -e 's/ /  /g'

if [ -f $HOME/.return_address ]; then
   echo /dfl_rt '['
   awk '{print "(" $0 ")"}' <$HOME/.return_address
   echo '] def'
else
   echo /dfl_rt '[()] def'
fi

cat << END_OF_PS
/in {72 mul} def
/mm {2.83 mul} def
/cm {28.3 mul} def
/xdisp 792 0.56 $e_width mul sub def
/ydisp 306.0 $e_height 2 div sub def
newpath clippath pathbbox pop exch pop add 0 translate 90 rotate newpath
.010 in setlinewidth
/l_one .125 in def
/l_zero .050 in def
/bar_spacing .0475 in def
/Helvetica findfont 10 scalefont setfont
/linehite {14} def
/barcode [
(11000)
(00011)
(00101)
(00110)
(01001)
(01010)
(01100)
(10001)
(10010)
(10100)
] def
/zero {
0 l_zero rlineto bar_spacing l_zero neg rmoveto
} def
/one {
0 l_one rlineto bar_spacing l_one neg rmoveto
} def
/do_barcode {
moveto
/sum 0 def
gsave
one
{
48 sub dup
sum add /sum exch def
barcode exch get
{48 eq {zero}{one} ifelse} forall
} forall
barcode
90 sum sub 10 mod
get {48 eq {zero}{one} ifelse} forall
one
stroke
grestore
} def
/height 0.625 in def
/thick 0.7 mm def
/sm_space 1.6 mm def
/lg_space 4.5 mm def
/orientmark {
moveto
gsave
thick setlinewidth
0 height rlineto
sm_space 0 rmoveto
0 height neg rlineto
lg_space 0 rmoveto
0 height rlineto
lg_space 0 rmoveto
0 height neg rlineto
sm_space 0 rmoveto
0 height rlineto
stroke
grestore
} def
/address { pstack
/stringaray exch def
/ycoord exch def
/xcoord exch def
xcoord
stringaray length
linehite mul ycoord add moveto
stringaray {
currentpoint linehite sub exch pop xcoord exch moveto
show
} forall
} def
/address2 {
/x currentpoint pop def
{
x currentpoint linehite sub exch pop moveto
show
} forall
} def
xdisp ydisp 100 add addr address
nopostnet 0 eq {
zip4 510 ydisp 18 add do_barcode
612 300 $e_height 2 div add height sub orientmark
} if
/Bookman-Light findfont 8 scalefont setfont /linehite {9} def
815 $e_width sub 293 $e_height 2 div add moveto
userdict /rt known {rt} {dfl_rt} ifelse
address2
showpage
END_OF_PS

exit 0

===================== cut here ================
--
  Shamim Mohamed / {uunet,noao,cmcl2..}!arizona!shamim / shamim@cs.arizona.edu
  "Take this cross and garlic; here's a Mezuzah if he's Jewish; a page of the
    Koran if he's a Muslim; and if he's a Zen Buddhist, you're on your own."
 Member of the League for Programming Freedom - write to league@prep.ai.mit.edu

