🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.postscript
4 messages
4 total messages Started by Chris Hooper Mon, 17 Aug 1992 16:52
Barcodes in Postscript
#1796
Author: Chris Hooper
Date: Mon, 17 Aug 1992 16:52
12 lines
862 bytes
Hi.

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.  If anyone has
working code to generate postscript for printing barcodes, I'd also
appreciate it if you send that along as well.

Thanks in advance.

- Chris Hooper      CS Senior at Michigan Technological University
  cdh@mtu.edu       Employee with MTU Networking
Re: Barcodes in Postscript
#1802
Author: Henry McGilton
Date: Tue, 18 Aug 1992 05:12
14 lines
943 bytes
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
Re: Barcodes in Postscript
#1812
Author: Mats-Olof Sander
Date: Tue, 18 Aug 1992 18:07
130 lines
4307 bytes
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

} loop

} def
++++++++++++++++++++++++++++++++++
Re: Barcodes in Postscript
#2090
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads