🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #2090

Re: Barcodes in Postscript

#2090
From: delinck
Date: Thu, 03 Sep 1992 15:05
143 lines
5302 bytes
In article <moj.714161261@risken>, moj@risken.vd.volvo.se (Mats-Olof Sander) writes:
> henry@trilithon.mpk.ca.us (Henry McGilton) writes:
> 
>>In article <1992Aug17.165203.16627@mtu.edu> cdh@mtu.edu (Chris Hooper) writes:
>>    *  I'd like to be able to print barcodes (specifically code
>>    *  3 of 9) using postscript.  If anyone out there has heard
>>    *  of this being successfully done in the past, please email me.
>>You can obtain complete fonts of bar codes and postal
>>codes in a variety of different formats from an outfit called
> 
>>    Bear Rock Technologies
>>    6069 Enterprise Drive
>>    Diamond Springs
>>    California 95619
>>    
>>    
>>        ........  Henry
> 
> I picked up this piece of PS-code from the net and have tried it out to
> full satisfaction.
> Mats-Olof
> ++++++++++++++++++++++++++++++++++++++++++++
> The attached will load a postscript routine for printing code 3/9
> barcodes.
> 
> Sample usage:
> 
>         /inch {72 mul} def
>         (*TEST BARCODE*) 1 inch .015 inch barcode
> 
> will print a 1 inch tall barcode with .015 inch bars (about 4
> characters/inch)
> at the current position.  The asterisks around the barcode text are
> required
> start/stop characters.
> 
> Bill Neisius
> bill@solaria.hac.com
> 
> -------------------------------------------------------------------------
> %!
> % print barcode at current location:   (string) barheight barwidth
> barcode
> % W V Neisius (bill@solaria.hac.com) - January 1992
> %
> serverdict begin 0 exitserver
> /barcode {
> /chars (1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *) def
> /bars   [ 00 17 18 03 20 05 06 24 09 10 12 00 ] def
> /spaces [ 00 02 04 08 01 07 11 13 14          ] def
> 
> % height, width
> /bwidth exch def
> /bheight exch def
> 
> % string
> /bstring exch def
> 
> /ilen bstring length def
> /indx 0 def
> /clen chars length def
> 
> % loop
> {
>         indx ilen ge {exit} if
>         /wchar bstring indx 1 getinterval def
>         indx 1 add /indx exch def
> 
>         /cndx 0 def
> 
>         % getchr
>         {
>                 cndx clen ge {
>                                 % getother
>                                 /bndx 11 def
>                                 /sndx 8 def
>                                 wchar ($) eq {/sndx 5 def} if
>                                 wchar (/) eq {/sndx 6 def} if
>                                 wchar (+) eq {/sndx 7 def} if
>                                 exit
>                              } if
>                 /cchar chars cndx 1 getinterval def
>                 cndx 1 add /cndx exch def
>                 cchar wchar eq {
>                                 % getbar
>                                 /sndx cndx 1 sub 10 div 1 add cvi def
>                                 /bndx cndx sndx 1 sub 10 mul sub def
>                                 exit
>                                } if
>         } loop
> 
>         % getbarx
> 
>         /bar bars bndx get def
>         /space spaces sndx get def
> 
>         % barcode
>         5 {
>                 /btemp bar 2 div cvi def
>                 /btemp bar btemp 2 mul sub def
>                 /bar bar 2 div cvi def
>                 btemp 0 eq {/btemp 1 def} {/btemp 3 def} ifelse
> 
>                 /stemp space 2 div cvi def
>                 /stemp space stemp 2 mul sub def
>                 /space space 2 div cvi def
>                 stemp 0 eq {/stemp 1 def} {/stemp 3 def} ifelse
> 
>                 % dobars
>                 % narrowbar
>                 % widebar
>                 0 bheight rlineto
>                 bwidth btemp mul 0 rlineto
>                 0 bheight neg rlineto
>                 bwidth btemp mul neg 0 rlineto
>                 currentpoint fill moveto
>                 bwidth btemp mul 0 rmoveto
> 
>                 % dospace
>                 % narrowspc
>                 % widespace
>                 bwidth stemp mul 0 rmoveto
> 
>         } repeat
> 
>         bwidth 2 mul 0 rmoveto
****************************************************************************
DO NOT INCLUDE THE PREVIOUS LINE!! IT WILL MAKE AN INCORRECT SPACE BETWEEN
ANY ADJACENT CHARACTERS IN THE BAR CODE. REMOVE THE PREVIOUS LINE OR COMMENT
IT OUT!!!
****************************************************************************
> 
> } loop
> 
> } def
> ++++++++++++++++++++++++++++++++++

Please note the bug in the previous program pointed out by the many asterisks.

___________________________________________________________________________
 /\  Jeff Delinck        internet: delinck@pa881a.inland.com
/||\ 
\||/ Inland Steel        "...98% of that smoke is water vapor." -anonymous
Technical Details
Message-ID: <1992Sep3.100551.1@pa621a.inland.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sample.eng.ohio-state.edu!purdue!news.cs.indiana.edu!syscon!gator!inland!pa621a.inland.com!delinck
References: <1992Aug17.165203.16627@mtu.edu> <1992Aug18.051216.4736@trilithon.mpk.ca.us> <moj.714161261@risken>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!sample.eng.ohio-state.edu!purdue!news.cs.indiana.edu!syscon!gator!inland!pa621a.inland.com!delinck
From: delinck@pa621a.inland.com
Newsgroups: comp.lang.postscript
Subject: Re: Barcodes in Postscript
Message-ID: <1992Sep3.100551.1@pa621a.inland.com>
Date: 3 Sep 92 15:05:51 GMT
References: <1992Aug17.165203.16627@mtu.edu> <1992Aug18.051216.4736@trilithon.mpk.ca.us> <moj.714161261@risken>
Organization: Inland Steel Company, East Chicago, IN
Lines: 143