% This documentation requires the PSTricks package called pst-barcode:
% http://www.tug.org/tex-archive/graphics/pstricks/contrib/pst-barcode/

% $Id$

\documentclass []{article}
\parindent 0.0cm
\parskip 0.2cm

\usepackage{pslatex}
\usepackage{graphicx}
\usepackage{pst-barcode}

\title{Barcode Writer in Pure Postscript}
\author{Terry Burton $<$tez@terryburton.co.uk$>$}
  
\begin{document}

\pagenumbering{roman}

\maketitle

\begin{abstract}
This document describes the implementation of the Barcode Writer in
Pure Postscript project, explains by example how to use this to
generate your own barcodes, and provides a simple reference to using 
the symbologies that it supports.
\end{abstract}

Note: Despite the date on this document, the information contained herein
is somewhat out of date. A much more thorough and up-to-date reference 
to this project is available in the wiki, 
\mbox{http://www.terryburton.co.uk/barcodewriter/wiki/}. This wiki provides
a collaborative approach to documentation that allows users to add and edit
content collectively.

\newpage

\tableofcontents

\newpage

\pagenumbering{arabic}

\section{Introduction}
Barcode Writer in Pure Postscript is an award-winning open source 
barcode maker, as used by NASA, that facilitates the printing of all 
major barcode symbologies entirely within level 2 PostScript, ideal 
for variable data printing. The complete process of generating 
printed barcodes is performed entirely within the printer (or print 
system) so that it is no longer the responsibility of your 
application or a library. There is no need for any barcode fonts and 
the flexibility offered by direct PostScript means you can avoid 
re-implementing barcode generator code, or migrating to new 
libraries, whenever your project language needs change.

To make it as easy as possible to incorporate this project into 
your own systems, whether they be freely available or proprietary, 
it is licensed under the permissive
MIT/X-Consortium License given in section \ref{license}.

The project homepage is at
http://www.terryburton.co.uk/barcodewriter.

This is the main resource for the project providing the latest
downloads of code and documentation, as well as access to the
support and development mailing list.

\section*{Acknowledgements}
The author wishes to take this opportunity to thank the growing 
community of volunteers that have helped to develop, test
and document this project. Most especially Michael Landers and 
Ross McFarland for freely donating their encoder implementations
early in the life of the project.

Also, special appreciation is extended to the developers that
have created the front-ends necessary to make the code valuable
to ordinary computer users, especially Petr Van\v{e}k, Dominik 
Seichter and Herbert Vo\ss.

\newpage

\section{Code Commentary}
This commentary assumes familiarity with the PostScript
language\footnote{The PostScript Language Tutorial and Cookbook 
(a.k.a. the Blue Book), which is freely available online, serves 
as both a useful tutorial and reference manual to the language.}.
 
The code is split cleanly into two types of procedure:

\begin{description}
\item[The encoders]{Each of these represents a barcode 
symbology\footnote{By symbology we mean an accepted standard for
representation of data as a barcode},
e.g. EAN-13 or Code-128. It takes a string containing the barcode
data and a string containing a list of options that modify the
output of the encoder. It generates
a structured representation of the barcode and its text for the 
symbology, including the calculation of check digits where necessary.}
\item[The renderer]{This takes the output of an encoder and 
generates a visual representation of the barcode.}
\end{description}

This means that all barcodes can be generated simply in a similar
manner:

\begin{verbatim}
(78858101497) (includetext height=0.6) upca barcode
(0123456789) (includecheck) interleaved2of5 barcode
\end{verbatim}


\subsection{The Barcode Data Structure}
\label{datastructure}
The following table describes the structured representation of a
barcode that is passed by an encoder to the renderer as a
dictionary when the PostScript is executed.

\begin{center}

\begin{tabular}{l|c|p{6.5cm}}
Element               & Key  & Value \\
\hline
Space bar succession  & \texttt{sbs}  & 
Array containing the widths, in points, of each bar and 
space, starting with the leftmost bar.\\ 

Bar height succession & \texttt{bhs}  &
Array containing the height of each bar in inches, starting with 
the leftmost bar.\\

Bar base succession   & \texttt{bbs}  &  
Array containing the offset of the base of each bar in inches,
starting with the leftmost bar.\\

Human readable text   & \texttt{txt}  &
Array of arrays that contain the character, position, height,
font and scale factor (font size), in points, for each of the visible 
text characters.\\

Renderer options      & \texttt{opt}  &
String containing the user-defined renderer options.
\end{tabular}

\end{center}

Other keys and values may be contained in this structure that override
the render defaults with encoder specific defaults.

\subsection{An Encoder}

The procedure labelled code2of5 is a simple example of an encoder,
which we will now consider. Its purpose is to accept as input a string
containing the barcode contents and a string containing a list of options, 
and to process these in a way
that is specific to this encoder, and finally to output an
instance of the dictionary-based data structure described in section
\ref{datastructure} that represents the barcode contents in the 
Code 2 of 5 symbology.

As with all of the encoders, the input string is assumed to be valid for
the corresponding symbology, otherwise the behaviour is undefined.

The variables that we use in this procedure are confined to local
scope by declaring the procedure as follows:

\begin{verbatim}
/code2of5 {
 
     0 begin

...

     end

} bind def
/code2of5 load 0 1 dict put
\end{verbatim}

We start by immediately reading the contents strings that are passed as
arguments to this procedure by the user. We duplicate the options string
because it is later passed unamended to the renderer.

\begin{verbatim}
     /options exch def
     /useropts options def
     /barcode exch def
\end{verbatim}

We initialise a few default variables. Those variables corresponding to 
options that can be enabled with the options argument are initially
set to false.

\begin{verbatim}
     /includetext false def 
     /textfont /Courier def
     /textsize 10 def
     /textpos -7 def
     /height 1 def
\end{verbatim}

The options string is tokenised with each successive token defining either a
name value pair which we instantiate or a lone variable that we define as true, 
allowing us to override the given default variables given above.

\begin{verbatim}
options {
    token false eq {exit} if dup length string cvs (=) search
    true eq {cvlit exch pop exch def} {cvlit true def} ifelse
} loop
\end{verbatim}      

Since any user given options create variables that are strings we need to convert
them back to their intended types.

\begin{verbatim}
/textfont textfont cvlit def
/textsize textsize cvr def
/textpos textpos cvr def
/height height cvr def	     
\end{verbatim}

We then create an array of string encodings for each of the available
characters which we then declare in another string. This information
can be derived from careful reading of the relevant specification, 
although this is often surprisingly difficult to obtain. 

\begin{verbatim}
     /encs
     [ (1111313111) (3111111131) (1131111131) (3131111111)
       (1111311131) (3111311111) (1131311111) (1111113131)
       (3111113111) (1131113111) (313111) (311131)
     ] def 

     /barchars (0123456789) def  
\end{verbatim}

We now store the length of the content string and calculate the
total number of bars and spaces in the resulting barcode. 
We initialise a string of size dependant on this length into 
which we will build the space bar succession. Similarly, we create 
an array into which we will add the human readable text information.

\begin{verbatim}
     /barlen barcode length def
     /sbs barlen 10 mul 12 add string def
     /txt barlen array def
\end{verbatim}

We now begin to populate the space bar succession by adding the
encoding of the start character to the beginning.

\begin{verbatim}
     sbs 0 encs 10 get putinterval
\end{verbatim}     

We now enter the main loop which iterates over the content string
from start to finish, looking up the encoding for each character,
adding this to the space bar succession.

It is important to understand how the encoding for a given character
is derived. Firstly, given a character, we find its position in the 
string of all available characters. We then use
this position to index the array of character encodings to obtain
the encoding for the given character, which is added to the space/bar
succession. Likewise, the character is added to the array of human 
readable text along with positioning and font information.
                         
\begin{verbatim}
    0 1 barlen 1 sub {
        /i exch def      
        barcode i 1 getinterval barchars exch search
        pop                           
        length /indx exch def            
        pop pop                        
        /enc encs indx get def     
        sbs i 10 mul 6 add enc putinterval 
        txt i [barcode i 1 getinterval i 14 mul 10 add -7 
               textfont textsize] put
    } for 
\end{verbatim}

The encoding for the end character is obtained and added to 
the end of the space bar succession.

\begin{verbatim}
    sbs barlen 10 mul 6 add encs 11 get putinterval
\end{verbatim}

Finally we prepare to push a dictionary containing the space bar 
succession (and any additional information defined in section
\ref{datastructure}) that will be passed to the renderer.

\begin{verbatim}
     /retval 1 dict def
     retval (sbs) [sbs {48 sub} forall] put
     retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put
     retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put
     includetext {
         retval (txt) txt put
     } if
     retval (opt) useropts put
     retval
\end{verbatim}


\subsection{The Renderer}

This description is out of date.

The procedure labelled barcode is known as the renderer, which we now
consider. Its purpose is to accept as input an instance of the
dictionary-based data structure described in section
\ref{datastructure} that represents a barcode in some arbitrary
symbology and produce a visual rendering of this at the current
point.

The variables that we use in this procedure are confined to local
scope by declaring the procedure as follows:

\begin{verbatim}
/barcode {
 
     0 begin

...

     end

} bind def
/barcode load 0 1 dict put
\end{verbatim}

We then immediately read the dictionary-based data structure which 
is passed as a single argument to this procedure by an encoder, from
which we extract the space bar succession, bar height succession and bar
base succession.

\begin{verbatim}
    /args exch def
    /sbs args (sbs) get def
    /bhs args (bhs) get def
    /bbs args (bbs) get def
    /renderopts args (opt) get def
\end{verbatim}

We attempt to extract from the dictionary the array containing the
information about human readable text. However, this may not exist 
in the dictionary in which case we create a default empty array.

\begin{verbatim}
    args (txt) known {
        /txt args (txt) get def
    } {
        /txt [] def
    } ifelse
\end{verbatim}

Just as with the encoders, we read and tokenise the supplied options
allowing specific rendering options to be overridden.

\begin{verbatim}
    /inkspread 0.15 def
    renderopts {
        token false eq {exit} if dup length string cvs (=) search
        true eq {cvlit exch pop exch def} {cvlit true def} ifelse
    } loop
    /inkspread inkspread cvr def
\end{verbatim}

We have extracted or derived all of the necessary information 
from the input, and now use the space bar succession, bar height 
succession and bar base succession in calculations that create a 
single array containing elements that give coordinates for each of
the bars in the barcode.

We start by creating a bars array that is half the length of the 
space bar succession. We build this by repeatedly adding array elements 
that contain the height, x-coordinate, y-coordinate and width of
single bars. The height and y-coordinates are read from the bar
height succession and the bar base succession, respectively, whilst
the x-coordinate and the width are made from a calculation of the 
total indent, based on the space bar succession and a compensating
factor that accounts for ink spread.

\begin{verbatim}    
    /bars sbs length 1 add 2 idiv array def
    /x 0.00 def
    0 1 sbs length 1 sub {
        /i exch def
        /d sbs i get 48 sub def
        i 2 mod 0 eq {
            /h bhs i 2 idiv get 72 mul def
            /c d 2 div x add def
            /y bbs i 2 idiv get 72 mul def
            /w d inkspread sub def            
            bars i 2 idiv [h c y w] put
        } if
        /x x d add def  
    } for
\end{verbatim}

Finally, we perform the actual rendering in two phases. Firstly we
use the contents of the bars array that we just built to render each 
of the bars, and secondly we use the contents of the text array 
extracted from the input argument to render the
text. We make an efficiency saving here by not performing loading and
rescaling of a font if the scale factor for the font size is 0. The graphics
state is preserved across calls to this procedure to prevent 
unexpected interference with the users environment.

\begin{verbatim}
    gsave
    
    bars {
        {} forall
        setlinewidth moveto 0 exch rlineto stroke
    } forall
    
    txt {
        {} forall
        dup 0 ne {exch findfont exch scalefont setfont} 
        {pop pop} 
        ifelse
        moveto show
    } forall

    grestore
\end{verbatim}

\subsection{Notes Regarding Coding Style}

PostScript programming veterans are encouraged to remember that the
majority of people who read the code are likely to have little,
if any, prior knowledge of the language.

To encourage development, the code has been written with these
goals in mind:

\begin{itemize}
\item[-]{That it be easy to use and to comprehend}
\item[-]{That it be easy to modify and enhance}
\end{itemize}

To this end the following points should be observed for all new
code submissions:

\begin{itemize}
\item[-]{New encoders should be based on the code of a similar
existing encoder}
\item[-]{Include comments where these clarify the operations 
involved, particular where something unexpected happens}
\item[-]{Prefer simplicity to efficency and clarity to
obfuscation, except where this will be a problem}
\end{itemize}

\newpage

\section{Resources and Examples}

There are several ways of using the PostScript within your own
projects.

Many example uses of the code for various languages and platforms
can be downloaded from the code repository at \mbox{http://www.terryburton.co.uk/barcodewriter/files/repository/}

\subsection{Language Specific APIs}

No language specific APIs exist yet. If you have experience writing API
specifications and would like to help create an API design for the project
then contact the author.

\subsection{Front Ends}

The following is a list of the front ends available for the project.

\begin{description}

\item[Web based generator]{
\mbox{http://www.terryburton.co.uk/barcodewriter/generator/}
}

\item[Scribus]
Scribus versions 1.3 and later come with a Barcode Maker plugin based on this project.\\
\mbox{http://www.scribus.org.uk}

\item[KBarcode]
KBarcode versions 2 and later make use of this project.\\ 
\mbox{http://www.kbarcode.net}

\item[pst-barcode]{
pst-barcode is a PSTricks package for \LaTeX.\\
\mbox{http://www.ctan.org/tex-archive/graphics/pstricks/contrib/pst-barcode/}

}
\end{description}

\newpage

\subsection{Installing the Barcode Generation Capability into a Printer's Virtual Machine}

Most genuine PostScript printers allow procedures to be defined such 
that they persist across different jobs through the use of the \texttt{exitserver}
command. If your printer supports this then you will be able to print
the main code containing the definitons of all the encoders and the
renderer once, e.g. soon after the device is turned on, and later omit
these definitons from each of the barcode documents that you print.

To install the barcode generation capabilities into the 
virtual machine of a PostScript printer you need to uncomment a line near the
top of the code so that it reads:

\begin{verbatim}
serverdict begin 0 exitserver
\end{verbatim}

Once this code is printed the procedural definitions for the encoders and
the renderer will remain defined across all jobs until the device is reset
either by power-cycling or with the following code:

\begin{verbatim}
serverdict begin 0 exitserver systemdict /quit get exec
\end{verbatim}

\newpage

\subsection{Hints for Generating Precisely the Required Symbol}

To create a barcode to a required width and height, without 
stretching the human readable text, perform the following steps. 

Create a basic symbol by choosing the relevant data and text options for the 
corresponding encoder, and position this using \texttt{translate} such that
the \emph{bottom-left} corner of the bars is in the required location: 

\begin{verbatim}
gsave 
430 750 translate 
(977147396801) (includetext) ean13 barcode 
grestore 
\end{verbatim}

Find the uniform scale factor (same value for x and y) that makes your output 
of the required \emph{width}: 

\begin{verbatim}
gsave 
430 750 translate 
1.3 1.3 scale      %  <-- Add a line like this 
(977147396801) (includetext) ean13 barcode 
grestore 
\end{verbatim}

Add a height option that adjusts the bar \emph{height} appropriately 
(taking the scaling into account): 

\begin{verbatim}
gsave 
430 750 translate 
1.3 1.3 scale 
% Added height=0.8 option to adjust height 
(977147396801) (includetext height=0.8) ean13 barcode 
grestore 
\end{verbatim}

The result should now be of the intended dimensions at the desired location
with properly scaled text. You can now add any additional options to
customise the symbol.

\newpage

\subsection{Printing in Perl}

This example will print a page of EAN-13s ranging between
two given values when called from a shell like this:

\begin{verbatim}
$ ./ean13s.pl 978186074271 978186074292 | lpr
\end{verbatim}

The contents of the script \texttt{ean13s.pl} is as follows:

\begin{verbatim}
#!/usr/bin/perl -w
use strict;

die 'Requires two arguments' if (@ARGV!=2);

open(PS,'barcode.ps') || die 'File not found';
$_=join('',<PS>);
close(PS);

print "%!PS-Adobe-2.0\n";

m/
    %\ --BEGIN\ TEMPLATE--
    (.*)
    %\ --END\ TEMPLATE--
    /sx || die 'Unable to parse out the template';
print $1;

for (my $i=$ARGV[0], my $j=0; $i<$ARGV[1]; $i++, $j++) {
    my $x=100+150*(int($j/7));
    my $y=100+100*($j%7);
    print "gsave\n";
    print "$x $y translate\n";
    print "($i) (includetext) ean13 barcode\n";
    print "grestore\n";
}

print "showpage\n";
\end{verbatim}

\newpage

\section{Supported Symbologies}

The following section shows the symbologies that are supported by
the encoders, including the available features for each. This list
may not be up-to-date. If it does not contain any of the formats or
features that you require then check the project source code or
try the support mailing list.

\subsection{EAN-13}



\begin{description}
\item[Data]{12 or 13 digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\item[Notes]{
	If just 12 digits are entered then the check digit is
	calculated automatically
} 
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(3,1in)
\psbarcode{9781860742712}{includetext guardwhitespace}{ean13}
\end{pspicture}
%}
\caption{\texttt{(9781860742712) (includetext guardwhitespace) ean13 barcode}}
\end{figure}

\subsection{EAN-8}

\begin{description}
\item[Data]{8 digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(2,0.6in)
\psbarcode{12345678}{includetext guardwhitespace height=0.6}{ean8}
\end{pspicture}
%}
\caption{\texttt{(12345678) (includetext guardwhitespace height=0.6) ean8 barcode}}
\end{figure}

\newpage

\subsection{UPC-A}

\begin{description}
\item[Data]{11 or 12 digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\item[Notes]{
	If just 11 digits are entered then the check digit is
	calculated automatically
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(3,1in)
\psbarcode{78858101497}{includetext}{upca}
\end{pspicture}
%}
\caption{\texttt{(78858101497) (includetext) upca barcode}}
\end{figure}

\subsection{UPC-E}

\begin{description}
\item[Data]{7 or 8 digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\item[Notes]{
	If just 7 digits are entered then the check digit is
	calculated automatically
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(2,1in)
\psbarcode{0123456}{includetext}{upce}
\end{pspicture}
%}
\caption{\texttt{(0123456) (includetext) upce barcode}}
\end{figure}

\newpage

\subsection{EAN-5}

\begin{description}
\item[Data]{5 digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(2,1in)
\psbarcode{90200}{includetext guardwhitespace}{ean5}
\end{pspicture}
%}
\caption{\texttt{(90200) (includetext guardwhitespace) ean5 barcode}}
\end{figure}

\subsection{EAN-2}

\begin{description}
\item[Data]{2 digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(1,1in)
\psbarcode{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
%}
\caption{\texttt{(38) (includetext guardwhitespace) ean2 barcode}}
\end{figure}

\newpage

\subsection{ISBN}

\begin{description}
\item[Data]{9 or 10 digits seperated appropriately with dashes}
\item[Options]{
  \begin{tabular}{l|l}
  Option                   & Feature\\
  \hline
  \texttt{includetext}     & Enable human readable text\\
  \end{tabular}
}
\item[Notes]{
	If just 9 digits are entered then the human readable
	ISBN check digit is calculated automatically
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(3,1in)
\psbarcode{1-58880-149}{includetext guardwhitespace}{isbn}
\end{pspicture}
%}
\caption{\texttt{(1-58880-149) (includetext) isbn barcode}}
\end{figure}

\subsection{Code-39}

\begin{description}
\item[Data]{
	Variable number of characters, digits
	and any of the symbols \texttt{-.\@ *\$/+\%}.
}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includecheck}       & Enable check digit\\
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make check digit visible in text\\
  \end{tabular}
}
\end{description}


\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(5,1in)
\psbarcode{CODE-39}{includecheck includetext}{code39}
\end{pspicture}
%}
\caption{\texttt{(CODE-39) (includecheck includetext) code39 barcode}}
\end{figure}

\newpage

\subsection{Code-128 and UCC/EAN-128}

\begin{description}
\item[Data]{Variable number of ASCII characters and special
funtion symbols, starting with the approriate start character
for the initial character set. UCC/EAN-128s must have a manditory
\texttt{FNC 1} symbol immediately following the start character.
}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make check digit visible in text\\
  \end{tabular}
}
\item[Notes]{
	Any non-printable character can be entered via its escaped
	ordinal value, for example \texttt{\^{}070} for \texttt{ACK}
	and \texttt{\^{}102} for \texttt{FNC 1}. Since a caret symbol
	serves as an escape character it must be escaped as \texttt{\^{}062}
	if used in the data. The check character is always added automatically. 
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(5,1in)
\psbarcode{^104^102Count^0991234^101!}{includetext}{code128}
\end{pspicture}
%}
\caption{\texttt{(\^{}104\^{}102Count\^{}0991234\^{}101!)\@ (includetext) code128 barcode}}
\end{figure}

\subsection{Rationalized Codabar}

\begin{description}
\item[Data]{
	Variable number of digits and any of the 
	symbols \texttt{-\$:/.+ABCD}.
}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includecheck}       & Enable check digit\\
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make check digit visible in text\\
  \end{tabular}
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(4,1in)
\psbarcode{0123456789}{includetext}{rationalizedCodabar}
\end{pspicture}
%}
\caption{\texttt{(0123456789) (includetext) rationalizedCodabar barcode}}
\end{figure}

\newpage

\subsection{Interleaved 2 of 5 and ITF-14}

\begin{description}
\item[Data]{Variable number of digits. An ITF-14 is 14 characters and 
  does not have a check digit.}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includecheck}       & Enable check digit\\
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make check digit visible in text\\
  \end{tabular}
}
\item[Notes]{The data may be automatically prefixed with 0 to make the
  data, including optional check digit, of even length.}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(5,0.7in)
\psbarcode{05012345678900}{includecheck height=0.7}{interleaved2of5}
\end{pspicture}
%}
\caption{\texttt{(05012345678900) (includecheck height=0.7) interleaved2of5 barcode}}
\end{figure}

\subsection{Code 2 of 5}

\begin{description}
\item[Data]{Variable number of digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includetext}        & Enable human readable text\\
  \end{tabular}
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(5,1.2in)
\psbarcode{0123456789}{includetext textpos=75 textfont=Helvetica textsize=16}{code2of5}
\end{pspicture}
%}
\caption{\texttt{(0123456789) (includetext textpos=75 textfont=Helvetica textsize=16) code2of5 barcode}}
\end{figure}

\newpage

\subsection{Postnet}

\begin{description}
\item[Data]{Variable number digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make the check digit visible in the text
  \end{tabular}
} 
\item[Notes]{
	Check digit is always added automatically
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(7,0.3in)
\psbarcode{01234567}{includetext textpos=-10 textfont=Arial textsize=10}{postnet}
\end{pspicture}
%}
\caption{\texttt{(01234567) (includetext textpos=-10 textfont=Arial textsize=10) postnet barcode}}
\end{figure}

\subsection{Royal Mail}

\begin{description}
\item[Data]{Variable number digits and capital letters}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make the check digit visible in the text
  \end{tabular}
}
\item[Notes]{
	Check digit is always added automatically
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(5,0.5in)
\psbarcode{LE28HS9Z}{includetext}{royalmail}
\end{pspicture}
%}
\caption{\texttt{(LE28HS9Z) (includetext) royalmail barcode}}
\end{figure}
		 
\newpage

\subsection{MSI}

\begin{description}
\item[Data]{Variable number digits}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includecheck}       & Enable check digit\\
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make check digit visible in the text
  \end{tabular}
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(6,1in)
\psbarcode{0123456789}{includecheck includetext}{msi}
\end{pspicture}
%}
\caption{\texttt{(0123456789) (includecheck includetext) msi barcode}}
\end{figure}

\subsection{Plessey}

\begin{description}
\item[Data]{Variable number of hexadecimal characters}
\item[Options]{
  \begin{tabular}{l|l}
  Option                      & Feature\\
  \hline
  \texttt{includetext}        & Enable human readable text\\
  \texttt{includecheckintext} & Make the check digits visible in the text
  \end{tabular}
} 
\item[Notes]{
	Check digits are always added automatically.
}
\end{description}

\begin{figure}[h]
\centering
%\framebox{
\begin{pspicture}(12,1in)
\psbarcode{0123456789ABCDEF}{includetext}{plessey}
\end{pspicture}
%}
\caption{\texttt{(012345ABCDEF) (includetext) plessey barcode}}
\end{figure}

\newpage

\section{License}
\label{license}

Copyright \copyright 2004 Terry Burton

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

The software is provided "as is", without warranty of any 
kind, express or implied, including but not limited to
the warranties of merchantability, fitness for a 
particular purpose and noninfringement. In no event shall
the authors or copyright holders be liable for any claim,
damages or other liability, whether in an action of
contract, tort or otherwise, arising from, out of or in
connection with the software or the use or other dealings
in the software.

\end{document}


