From 1bc72c65eb75d033585161c0ec24fe5248c5d2cd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 1 Jun 2007 17:02:09 +0000 Subject: pst-barcode update (22may07) git-svn-id: svn://tug.org/texlive/trunk@4401 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-barcode/Changes | 19 +- .../texmf-dist/doc/generic/pst-barcode/barcode.pdf | Bin 228289 -> 0 bytes .../texmf-dist/doc/generic/pst-barcode/barcode.tex | 1037 ------------------- .../doc/generic/pst-barcode/pst-barcode-doc.bib | 70 ++ .../doc/generic/pst-barcode/pst-barcode-doc.pdf | Bin 0 -> 240531 bytes .../doc/generic/pst-barcode/pst-barcode-doc.tex | 1053 ++++++++++++++++++++ .../texmf-dist/dvips/pst-barcode/pst-barcode.pro | 243 ++++- .../texmf-dist/source/generic/pst-barcode/Makefile | 49 + Master/texmf-dist/tpm/pst-barcode.tpm | 14 +- Master/texmf/lists/pst-barcode | 7 +- 10 files changed, 1418 insertions(+), 1074 deletions(-) delete mode 100644 Master/texmf-dist/doc/generic/pst-barcode/barcode.pdf delete mode 100644 Master/texmf-dist/doc/generic/pst-barcode/barcode.tex create mode 100644 Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.bib create mode 100644 Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf create mode 100644 Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.tex create mode 100644 Master/texmf-dist/source/generic/pst-barcode/Makefile (limited to 'Master') diff --git a/Master/texmf-dist/doc/generic/pst-barcode/Changes b/Master/texmf-dist/doc/generic/pst-barcode/Changes index 17ab2457dbf..dc5265db8bb 100644 --- a/Master/texmf-dist/doc/generic/pst-barcode/Changes +++ b/Master/texmf-dist/doc/generic/pst-barcode/Changes @@ -12,7 +12,24 @@ ----- pst-barcode.pro -2006-03-04 - An encoder for the Reduced Space Symbology RSS Expanded was added. +2007-05-22 - Added parsable example options field to each encoder. + - An encoder for the Pharmaceutical Binary Code symbology was added. +2007-04-22 - Added CMYK colorspace support. + - Fixed incorrect checksum calculation for UPC-E symbols. + - Added raw encoder to make it easier to create + miscellaneous symbols in a custom symbology. + - Functional comments were added to the head of the encoders + to allow applications to extract the symbology name and + example input data. + - An encoder for the Reduced Space Symbology RSS Expanded was added. + - The incorrect definition of the USPS FIM-B symbol was fixed. + - An encoder for the Reduced Space Symbology RSS Limited was added. + - The efficiency of RSS-14 was improved. + - An encoder for the Reduced Space Symbology RSS-14 was added. + - An encoder for the new OneCode symbology used by the + US Postal Service was added. +2006-03-04 - An encoder for the Reduced Space Symbology RSS Expanded + was added. - The incorrect definition of the USPS FIM-B symbol was fixed. - An encoder for the Reduced Space Symbology RSS Limited was added. The efficiency of RSS-14 was improved. diff --git a/Master/texmf-dist/doc/generic/pst-barcode/barcode.pdf b/Master/texmf-dist/doc/generic/pst-barcode/barcode.pdf deleted file mode 100644 index 8f85434f353..00000000000 Binary files a/Master/texmf-dist/doc/generic/pst-barcode/barcode.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/generic/pst-barcode/barcode.tex b/Master/texmf-dist/doc/generic/pst-barcode/barcode.tex deleted file mode 100644 index fe8f3541c39..00000000000 --- a/Master/texmf-dist/doc/generic/pst-barcode/barcode.tex +++ /dev/null @@ -1,1037 +0,0 @@ -\documentclass{article} -\usepackage{pstricks,tabularx,paralist} -\usepackage{showexpl} -\lstset{wide,preset=\raggedright} -\usepackage{pst-barcode} -\let\PSTfileversion\fileversion -\usepackage[ps2pdf,colorlinks,linktocpage]{hyperref} -\usepackage{breakurl} -\def\CMD#1{\texttt{\textbackslash #1}} - -\title{Package \texttt{pst-barcode}\\ -\footnotesize v. \PSTfileversion} -\author{Terry Burton\thanks{\protect\url{tez@terryburton.co.uk}} - \and Herbert Vo\ss\thanks{\protect\url{hvoss@tug.org}}} -\date{\today} -\begin{document} -\maketitle - - -\begin{center} -\begin{tabular}{@{}>{\ttfamily}lll@{}} -\textrm{\emph{file name}} & \emph{meaning} & \emph{version}\\\hline -pst-barcode.sty & \LaTeX\ style file -- wrapper & 2006-07-23\\ -pst-barcode.tex & \TeX\ file -- PS interface & 2006-07-23\\ -pst-barcode.pro & PostScript file & 2006-07-23\\ -barcode.tex & documentation source & 2006-07-23\\ -barcode.pdf & documentation PDF & 2006-07-23\\ -\end{tabular} -\end{center} - - - -\clearpage -\tableofcontents - - -\clearpage -\section{Introduction} -To install the package put the three files in a place, where \TeX{} will search -for the files: - -\bigskip\noindent -\begin{tabular}{@{}ll@{}} -\emph{name} & \emph{target dir} \\\hline -\verb+pst-barcode.tex+ & \verb+$LOCALTEXMF/tex/generic/pstricks/+\\ -\verb+pst-barcode.sty+ & \verb+$LOCALTEXMF/tex/latex/pstricks/+\\ -\verb+pst-barcode.pro+ & \verb+$LOCALTEXMF/dvips/pstricks/+ \\ -\verb+barcode.tex+ & \verb+$LOCALTEXMF/doc/pstricks/+\\ -\verb+barcode.pdf+ & \verb+$LOCALTEXMF/doc/pstricks/+ %$ -\end{tabular} - -\bigskip -There is only one macro \verb+\psbarcode+ with the usual PSTricks syntax -\begin{verbatim} -\psbarcode[]{}{} -\end{verbatim} - -Important is the fact, that the barcode is printed in a box of zero dimension. -If you want to save some space in your text, use the \verb+pspicture+ environment -or the \verb+\makebox+ macro. - - - -\section{The options} -\subsection{The \TeX\ options} - -\begin{tabular}{@{}lll@{}} -\emph{name} & \emph{default} & \emph{remarks}\\\hline -\verb+transx+ & 0 & horizontal shift\\ -\verb+transy+ & 0 & vertical shift\\ -\verb+scalex+ & 1 & horizontal scaling\\ -\verb+scaley+ & 1 & vertical scaling\\ -\verb+rotate+ & 0 & rotating angle in degrees -\end{tabular} - -\subsection{The PostScript options} - -\begin{tabularx}{\textwidth}{@{}llX@{}} -\emph{name} & \emph{default} & \emph{remarks}\\\hline -\verb+height+ & 1 & dimension is inch\\ -\verb+textsize+ & 10 & dimension is pt\\ -\verb+textpos+ & -2 & dimension is pt; it is the shift for additional code text\\ -\verb+inkspread+ & 0.15 & dimension is pt\\ -\verb+showborder+ & - & - \\ -\verb+borderwidth+ & 0.5 & dimension in pt \\ -\verb+borderleft+ & 10 & dimension in pt\\ -\verb+borderright+ & 10 & dimension in pt\\ -\verb+bordertop+ & 1 & dimension in pt\\ -\verb+borderbottom+ & 1 & dimension in pt\\ -\verb+borderwidth+ & 0.5 & dimension in pt\\ -\verb+width+ & - & dimension in inch\\ -% -\verb+font+ & /Helvetica & must be a PostScript font\\ -\verb+includetext+ & - & enable human readable text \\ -\verb+includecheck+ & - & enable check digit \\ -\verb+includecheckintext+ & - & check digit visible in text -\end{tabularx} - -\subsection{Examples for the TeX options} - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{includetext}{ean8} -\end{pspicture} -\begin{pspicture}(-2,-1.5)(0.5,0.2in) -\psbarcode[rotate=180,linecolor=red]{12345678}{includetext guardwhitespace height=0.6}{ean8} -\end{pspicture} -\begin{pspicture}(3.5,1.2in) -\psbarcode[scalex=1.5,scaley=0.5,transy=20]{12345678}{includetext inkspread=0.5}{ean8} -\end{pspicture} -\end{LTXexample} - -\newpage -\subsection{Examples for the PostScript options} - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{includetext guardwhitespace height=0.6}{ean8} -\end{pspicture} -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{textsize=15 includetext guardwhitespace height=0.6}{ean8} -\end{pspicture} -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{includetext inkspread=0.5}{ean8} -\end{pspicture} -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{includetext textpos=0}{ean8} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{includetext guardwhitespace}{ean8} -\end{pspicture} -\begin{pspicture}(3.5,1.2in) -\psbarcode{12345678}{textsize=15 includetext guardwhitespace width=2}{ean8} -\end{pspicture} -\end{LTXexample} - - -\section{Usage} -By default the barcode has a width and a height of zero. Using the \CMD{parbox} -macro or the \verb+pspicture+ environment can reserve the needed space for -the barcode. The \CMD{fbox} in the following examples is used -only for demonstration. - - -\begin{LTXexample}[width=.5\linewidth] -foo -\fbox{% - \parbox[b][1in]{1.5in}{\psbarcode{241078}{includetext width=1.5 height=1}{code39}}} -bar -\end{LTXexample} - -\bigskip -\begin{LTXexample}[width=.5\linewidth] -foo -\fbox{% -\begin{pspicture}(0,-8pt)(1.5in,1in) - \psbarcode{241078}{includetext width=1.5 height=1}{code39} -\end{pspicture}} -bar -\end{LTXexample} - - -\section{Possible barcodes} - -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[Characters] \verb+0123456789+ -\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{LTXexample}[width=.3\linewidth] -\begin{pspicture}(3,1.2in) -\psbarcode[scalex=0.8,scaley=0.8]{9781860742712}{includetext guardwhitespace}{ean13} -\end{pspicture} -\end{LTXexample} - -\subsection{EAN-8} - -\begin{description} -\item[Characters] \verb+0123456789+ -\item[Data] 8 digits -\item[Options]~\\ - \begin{tabular}{l|l} - Option & Feature\\ - \hline - \texttt{includetext} & Enable human readable text\\ - \end{tabular} -\end{description} - -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(-2,-1.2)(0,0.2in) -\psbarcode[rotate=180,linecolor=red]{12345678}{includetext guardwhitespace height=0.6}{ean8} -\end{pspicture} -\end{LTXexample} - - -\subsection{UPC-A} - -\begin{description} -\item[Characters] \verb+0123456789+ -\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{LTXexample}[width=.3\linewidth] -\begin{pspicture}(3,1.2in) -\psbarcode[transx=15pt,transy=10pt]{78858101497}{includetext}{upca} -\qdisk(0,0){3pt}\rput[lb](5pt,-10pt){Origin} -\end{pspicture} -\end{LTXexample} - -\subsection{UPC-E} - -\begin{description} -\item[Characters] \verb+0123456789+ -\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{LTXexample}[width=.3\linewidth] -\begin{pspicture}(1.5,1.2in) -\psbarcode{0123456}{includetext}{upce} -\end{pspicture} -\end{LTXexample} - -\subsection{EAN-5} - -\begin{description} -\item[Characters] \verb+0123456789+ -\item[Data] 5 digits -\item[Options]~\\ - \begin{tabular}{l|l} - Option & Feature\\ \hline - \texttt{includetext} & Enable human readable text\\ - \end{tabular} -\end{description} - -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(2,1in) -\psbarcode{90200}{includetext guardwhitespace}{ean5} -\end{pspicture} -\end{LTXexample} - -\subsection{EAN-2} - -\begin{description} -\item[Characters] \verb+0123456789+ -\item[Data] 2 digits -\item[Options]~\\ - \begin{tabular}{l|l} - Option & Feature\\\hline - \texttt{includetext} & Enable human readable text\\ - \end{tabular} -\end{description} - -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(1,1in) -\psbarcode{38}{includetext guardwhitespace}{ean2} -\end{pspicture} -\end{LTXexample} - -\newpage -\subsection{ISBN} -An ISBN symbol is really an EAN-13 with a particular prefix, 978 for the older ISBN-10 format, and others for the new ISBN-13 format. - -\begin{description} -\item[Characters] \verb+-0123456789+ -\item[Data] 9 or 10 digits for ISBN-10 seperated appropriately with dashes -\item[Data] 12 or 13 digits for ISBN-13 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 (ISBN-10) or 12 (ISBN-13) digits are entered then the human readable, - ISBN check digit is calculated automatically -\end{description} - -\smallskip -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(3,1in) -\psbarcode{3-86541-114}{includetext guardwhitespace}{isbn} -\end{pspicture} -\end{LTXexample} - -\bigskip\enlargethispage{2ex} -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(3,1in) -\psbarcode{978-3-86541-114}{includetext guardwhitespace}{isbn} -\end{pspicture} -\end{LTXexample} - - -\subsection{Code-39} - -\begin{description} -\item[Characters] \verb+0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*+ %$ -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,1in) -\psbarcode{CODE-39}{includecheck includetext}{code39} -\end{pspicture} -\end{LTXexample} - -\subsection{Code-128 and UCC/EAN-128} - -\begin{description} -\item[Characters] \verb|!"#$%&'\(\)*+,-./0...9:;<=>?@A...Z[\\]^_`a...z|\verb+{|}~+ %$ -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,1in) -\psbarcode{^104^102Count^0991234^101!}{includetext}{code128} -\end{pspicture} -\end{LTXexample} - -\subsection{Rationalized Codabar} - -\begin{description} -\item[Characters] \verb!0123456789-$:/.+ABCD! %$ -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(4,1in) -\psbarcode{0123456789}{includetext}{rationalizedCodabar} -\end{pspicture} -\end{LTXexample} - - -\newpage -\subsection{Interleaved 2 of 5 and ITF-14} - -\begin{description} -\item[Characters] \verb!0123456789! -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,0.7in) -\psbarcode{05012345678900}{includecheck height=0.7}{interleaved2of5} -\end{pspicture} -\end{LTXexample} - -\subsection{Code 2 of 5} - -\begin{description} -\item[Characters] \verb!0123456789! -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,1.2in) -\psbarcode{0123456789}{includetext textpos=75 textfont=Helvetica textsize=16}{code2of5} -\end{pspicture} -\end{LTXexample} - - -\subsection{Postnet} - -\begin{description} -\item[Characters] \verb!0123456789! -\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{LTXexample}[width=.6\linewidth] -\begin{pspicture}(7,0.3in) -\psbarcode{01234567}{includetext textpos=-10 textfont=Arial textsize=10}{postnet} -\end{pspicture} -\end{LTXexample} - - -\subsection{Royal Mail} - -\begin{description} -\item[Characters] \verb!ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS! -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,0.5in) -\psbarcode{LE28HS9Z}{includetext}{royalmail} -\end{pspicture} -\end{LTXexample} - -\subsection{Kix (Customer index) -- Dutch Mail} - -\begin{description} -\item[Characters] \verb!ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS! -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,0.3in) -\psbarcode{1203AA12}{includetext}{kix} -\end{pspicture} -\end{LTXexample} - - -\subsection{Australian postal service} - -\begin{description} -\item[Characters] \verb!ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRSabc...xyz! -\item[Data] Variable number digits and 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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(5,0.3in) -\psbarcode{1139549554}{includetext}{auspost} -\end{pspicture} -\end{LTXexample} - -\subsection{onecode} -United States Postal Service, replaces POSTNET and PLANET symbols. -Each barcode can be 20, 25, 29, or 31 digits long, depending on the type of ZIP code present. Each digit has four possible states, so one digit represents numbers 0-3. -\begin{description} -\item[Characters] \verb!0123456789! -\item[Data] Variable number digits -\iffalse -\item[Options]~\\ - \begin{tabular}{l|l} - Option & Feature\\ \hline - \texttt{includetext} & Enable human readable text\\ - \end{tabular} -\fi -\end{description} - -\begin{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(5,0.3in) -\psbarcode{0123456709498765432101234567891}{includetext}{onecode} -\end{pspicture} -\end{LTXexample} - -\subsection{Symbol} -The purpose of the symbol encoder is to store the definitions of miscellaneous barcode -symbols such as the FIM symbols used by the US Postal Service on their reply mail. - - -\begin{LTXexample}[width=.4\linewidth] -\begin{pspicture}(1cm,1.5cm) -\psbarcode{fima}{}{symbol} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=.4\linewidth] -\begin{pspicture}(1cm,1.5cm) -\psbarcode{fimb}{}{symbol} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=.4\linewidth] -\begin{pspicture}(1cm,1.5cm) -\psbarcode{fimc}{}{symbol} -\end{pspicture} -\end{LTXexample} - -\begin{LTXexample}[width=.4\linewidth] -\begin{pspicture}(1cm,1.5cm) -\psbarcode{fimd}{}{symbol} -\end{pspicture} -\end{LTXexample} - - -\subsection{MSI} - -\begin{description} -\item[Characters] \verb!0123456789! -\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{LTXexample}[width=.5\linewidth] -\begin{pspicture}(6,1in) -\psbarcode{0123456789}{includecheck includetext}{msi} -\end{pspicture} -\end{LTXexample} - -\subsection{Plessey} - -\begin{description} -\item[Characters] \verb!01234B6789ABCDEF! -\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{LTXexample}[pos=t,preset=\centering] -\begin{pspicture}(0,-2mm)(12,1in) -\psbarcode{0123456789ABCDEF}{includetext}{plessey} -\end{pspicture} -\end{LTXexample} - -\subsection{Reduced Space Symbology (RSS)} -This is a family that includes RSS-14\textregistered, RSS Limited\textregistered, -and RSS Expanded\textregistered{} (\url{http://www.gs1.org/productssolutions/barcodes/technical/rss.html}). RSS-14 and RSS Limited encode Global Trade Item -Numbers (GTINs). RSS Expanded will encode any of the GS1 System identification -numbers as well as all other Application Identifiers. -RSS is used in the healthcare industry. - -\begin{description} -\item[Characters] \verb!0123456789! -\item[Data] Variable number digits -\end{description} - -\subsubsection{rss14} - -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(12,.3in) -\psbarcode{24012345678905}{height=0.3}{rss14} -\end{pspicture} -\end{LTXexample} - -\subsubsection{rsslimited} -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(12,.3in) -\psbarcode{00978186074271}{height=0.3}{rsslimited} -\end{pspicture} -\end{LTXexample} - -\subsubsection{rssexpanded} -\begin{LTXexample}[width=.3\linewidth] -\begin{pspicture}(12,.3in) -\psbarcode{000000010011001010100001000000010000}{height=0.3}{rssexpanded} -\end{pspicture} -\end{LTXexample} - - - -\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{lstlisting} -(78858101497) (includetext height=0.6) upca barcode -(0123456789) (includecheck) interleaved2of5 barcode -\end{lstlisting} - - -\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} & -String containing the integer 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. -\end{tabular} - -\end{center} - - -\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{lstlisting} -/code2of5 { - - 0 begin - -... - - end - -} bind def -/code2of5 load 0 1 dict put -\end{lstlisting} - -We start by immediately reading the contents strings that are passed as -arguments to this procedure by the user. - -\begin{lstlisting} - /options exch def - /barcode exch def -\end{lstlisting} - -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{lstlisting} - /includetext false def - /textfont /Courier def - /textsize 10 def - /textpos -7 def - /height 1 def -\end{lstlisting} - -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{lstlisting} -options { - token false eq {exit} if dup length string cvs (=) search - true eq {cvlit exch pop exch def} {cvlit true def} ifelse -} loop -\end{lstlisting} - -Since any user given options create variables that are strings we need to convert -them back to their intended types. - -\begin{lstlisting} -/textfont textfont cvlit def -/textsize textsize cvr def -/textpos textpos cvr def -/height height cvr def -\end{lstlisting} - -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{lstlisting} - /encs - [ (1111313111) (3111111131) (1131111131) (3131111111) - (1111311131) (3111311111) (1131311111) (1111113131) - (3111113111) (1131113111) (313111) (311131) - ] def - - /barchars (0123456789) def -\end{lstlisting} - -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{lstlisting} - /barlen barcode length def - /sbs barlen 10 mul 12 add string def - /txt barlen array def -\end{lstlisting} - -We now begin to populate the space bar succession by adding the -encoding of the start character to the beginning. - -\begin{lstlisting} - sbs 0 encs 10 get putinterval -\end{lstlisting} - -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{lstlisting} - 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{lstlisting} - -The encoding for the end character is obtained and added to -the end of the space bar succession. - -\begin{lstlisting} - sbs barlen 10 mul 6 add encs 11 get putinterval -\end{lstlisting} - -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{lstlisting} - /retval 1 dict def - retval (sbs) sbs 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 -\end{lstlisting} - - -\subsection{The Renderer} - -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{lstlisting} -/barcode { - - 0 begin - -... - - end - -} bind def -/barcode load 0 1 dict put -\end{lstlisting} - -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{lstlisting} - /args exch def - /sbs args (sbs) get def - /bhs args (bhs) get def - /bbs args (bbs) get def -\end{lstlisting} - -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{lstlisting} - args (txt) known - { - /txt args (txt) get def - } - { - /txt [] def - } ifelse -\end{lstlisting} - -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{lstlisting} - /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 0.15 sub def - bars i 2 idiv [h c y w] put - } if - /x x d add def - } for -\end{lstlisting} - -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{lstlisting} - 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{lstlisting} - -\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} - -\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{lstlisting} -serverdict begin 0 exitserver -\end{lstlisting} - -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{lstlisting} -serverdict begin 0 exitserver systemdict /quit get exec -\end{lstlisting} - - - -\clearpage -\section{Package code} -\subsection{\texttt{pst-barcode.sty}} - -\lstinputlisting[xleftmargin=-1cm,xrightmargin=-1cm]{pst-barcode.sty} - -\subsection{\texttt{pst-barcode.tex}} -\lstinputlisting[xleftmargin=-1cm,xrightmargin=-1cm]{pst-barcode.tex} - -%\subsection{\texttt{pst-barcode.pro}} -%\lstinputlisting[language={},xleftmargin=-1.5cm,xrightmargin=-1.5cm]{pst-barcode.pro} -\end{document} - diff --git a/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.bib b/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.bib new file mode 100644 index 00000000000..1bc5afd844c --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.bib @@ -0,0 +1,70 @@ +%% -*-bibtex-*- +@STRING{tugboat = {TUGboat} } +@STRING{beiprogramm = {{\TeX}-Beiprogramm} } +@STRING{bretter = {Bretter, die die Welt bedeuten} } +@STRING{dtk = {{D}ie {\TeX}nische {K}om{\"o}die} } +@STRING{editorial = {Editorial} } +@STRING{fremdebuehne = {Von fremden B{\"u}hnen} } +@STRING{fundus = {Aus dem Fundus} } +@STRING{hinterbuehne = {Hinter der B{\"u}hne} } +@STRING{leserbrief = {Leserbrief(e)} } +@STRING{magazin = {Magazin} } +@STRING{rezension = {Rezensionen} } +@STRING{schonimmer = {Was Sie schon immer {\"u}ber {\TeX} wissen wollten \dots} } +@STRING{theaterkasse = {Von der Theaterkasse} } +@STRING{theatertage = {{\TeX}-Theatertage} } + +@Book{companion, + author = {Michel Goosens and Frank Mittelbach and Alexander + Samarin}, + title = {The {\LaTeX} {G}raphics {C}ompanion}, + publisher = {{Addison-Wesley Publishing Company}}, + year = {2004}, + edition = {2.}, + address = {Reading, Mass.} +} + +@Article{girou:02:, + author = {{Timothy van} Zandt and Denis Girou}, + title = {Inside {PST}ricks}, + journal = TUGboat, + year = 1994, + volume = {15}, + month = sep, + pages = {239-246} +} + +@Book{PostScript, + Author = {Kollock, Nikolai G.}, + Title = {Post{S}cript richtig eingesetzt: vom {K}onzept zum + praktischen {E}insatz}, + Publisher = {IWT}, + Address = {Vaterstetten}, + year = 1989, +} + +@Manual{pstricks, + Title = {PSTricks - {\PS} macros for generic {\TeX}}, + Author = {{Timothy van} Zandt}, + Organization = {}, + Address = {\url{http://www.tug.org/application/PSTricks}}, + Note = {}, + year = 1993 +} + +@Book{PSTricks2, + author = {Herbert Vo\ss}, + title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, + edition = {4.}, + publisher = {DANTE -- Lehmanns}, + year = {2007}, + address = {Heidelberg/Hamburg} +} + +@Book{voss:math, + author = {Herbert Vo\ss}, + title = {\LaTeX\ in {M}athematik und {N}aturwissenschaften}, + publisher = {{Franzis-Verlag}}, + year = {2006}, + address = {Poing} +} diff --git a/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf b/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf new file mode 100644 index 00000000000..15aa95ef74f Binary files /dev/null and b/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.tex b/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.tex new file mode 100644 index 00000000000..12dce6bccb4 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.tex @@ -0,0 +1,1053 @@ +\documentclass{article} +\usepackage{pstricks,tabularx,paralist} +\usepackage{showexpl} +\lstset{wide,preset=\raggedright} +\usepackage{pst-barcode} +\let\PSTfileversion\fileversion +\usepackage[ps2pdf,colorlinks,linktocpage]{hyperref} +\usepackage{breakurl} +\def\CMD#1{\texttt{\textbackslash #1}} + +\title{Package \texttt{pst-barcode}\\ +\footnotesize v. \PSTfileversion} +\author{Terry Burton\thanks{\protect\url{tez@terryburton.co.uk}} + \and Herbert Vo\ss\thanks{\protect\url{hvoss@tug.org}}} +\date{\today} +\begin{document} +\maketitle + + +\begin{center} +\begin{tabular}{@{}>{\ttfamily}lll@{}} +\textrm{\emph{file name}} & \emph{meaning} & \emph{version}\\\hline +pst-barcode.sty & \LaTeX\ style file -- wrapper & 2006-07-23\\ +pst-barcode.tex & \TeX\ file -- PS interface & 2006-07-23\\ +pst-barcode.pro & PostScript file & 2007-05-22\\ +pst-barcode-doc.tex & documentation source & 2007-05-22\\ +pst-barcode-doc.pdf & documentation PDF & 2007-05-22\\ +pst-barcode-doc.bib & Bibliography file & 2007-05-22 +\end{tabular} +\end{center} + + + +\clearpage +\tableofcontents + +\clearpage +\section{Introduction} +To install the package put the three files in a place, where \TeX{} will search +for the files: + +\bigskip\noindent +\begin{tabular}{@{}ll@{}} +\emph{name} & \emph{target dir} \\\hline +\verb+pst-barcode.tex+ & \verb+$LOCALTEXMF/tex/generic/pstricks/+\\ +\verb+pst-barcode.sty+ & \verb+$LOCALTEXMF/tex/latex/pstricks/+\\ +\verb+pst-barcode.pro+ & \verb+$LOCALTEXMF/dvips/pstricks/+ \\ +\verb+barcode.tex+ & \verb+$LOCALTEXMF/doc/pstricks/+\\ +\verb+barcode.pdf+ & \verb+$LOCALTEXMF/doc/pstricks/+ %$ +\end{tabular} + +\bigskip +There is only one macro \verb+\psbarcode+ with the usual PSTricks syntax +\begin{verbatim} +\psbarcode[]{}{} +\end{verbatim} + +Important is the fact, that the barcode is printed in a box of zero dimension. +If you want to save some space in your text, use the \verb+pspicture+ environment +or the \verb+\makebox+ macro. + + + +\section{The options} +\subsection{The \TeX\ options} + +\begin{tabular}{@{}lll@{}} +\emph{name} & \emph{default} & \emph{remarks}\\\hline +\verb+transx+ & 0 & horizontal shift\\ +\verb+transy+ & 0 & vertical shift\\ +\verb+scalex+ & 1 & horizontal scaling\\ +\verb+scaley+ & 1 & vertical scaling\\ +\verb+rotate+ & 0 & rotating angle in degrees +\end{tabular} + +\subsection{The PostScript options} + +\begin{tabularx}{\textwidth}{@{}llX@{}} +\emph{name} & \emph{default} & \emph{remarks}\\\hline +\verb+height+ & 1 & dimension is inch\\ +\verb+textsize+ & 10 & dimension is pt\\ +\verb+textpos+ & -2 & dimension is pt; it is the shift for additional code text\\ +\verb+inkspread+ & 0.15 & dimension is pt\\ +\verb+showborder+ & - & - \\ +\verb+borderwidth+ & 0.5 & dimension in pt \\ +\verb+borderleft+ & 10 & dimension in pt\\ +\verb+borderright+ & 10 & dimension in pt\\ +\verb+bordertop+ & 1 & dimension in pt\\ +\verb+borderbottom+ & 1 & dimension in pt\\ +\verb+borderwidth+ & 0.5 & dimension in pt\\ +\verb+width+ & - & dimension in inch\\ +% +\verb+font+ & /Helvetica & must be a PostScript font\\ +\verb+includetext+ & - & enable human readable text \\ +\verb+includecheck+ & - & enable check digit \\ +\verb+includecheckintext+ & - & check digit visible in text +\end{tabularx} + +\subsection{Examples for the TeX options} + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{includetext}{ean8} +\end{pspicture} +\begin{pspicture}(-2,-1.5)(0.5,0.2in) +\psbarcode[rotate=180,linecolor=red]{12345678}{includetext guardwhitespace height=0.6}{ean8} +\end{pspicture} +\begin{pspicture}(3.5,1.2in) +\psbarcode[scalex=1.5,scaley=0.5,transy=20]{12345678}{includetext inkspread=0.5}{ean8} +\end{pspicture} +\end{LTXexample} + +\newpage +\subsection{Examples for the PostScript options} + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{includetext guardwhitespace height=0.6}{ean8} +\end{pspicture} +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{textsize=15 includetext guardwhitespace height=0.6}{ean8} +\end{pspicture} +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{includetext inkspread=0.5}{ean8} +\end{pspicture} +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{includetext textpos=0}{ean8} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{includetext guardwhitespace}{ean8} +\end{pspicture} +\begin{pspicture}(3.5,1.2in) +\psbarcode{12345678}{textsize=15 includetext guardwhitespace width=2}{ean8} +\end{pspicture} +\end{LTXexample} + + +\section{Usage} +By default the barcode has a width and a height of zero. Using the \CMD{parbox} +macro or the \verb+pspicture+ environment can reserve the needed space for +the barcode. The \CMD{fbox} in the following examples is used +only for demonstration. + + +\begin{LTXexample}[width=.5\linewidth] +foo +\fbox{% + \parbox[b][1in]{1.5in}{\psbarcode{241078}{includetext width=1.5 height=1}{code39}}} +bar +\end{LTXexample} + +\bigskip +\begin{LTXexample}[width=.5\linewidth] +foo +\fbox{% +\begin{pspicture}(0,-8pt)(1.5in,1in) + \psbarcode{241078}{includetext width=1.5 height=1}{code39} +\end{pspicture}} +bar +\end{LTXexample} + + +\section{Possible barcodes} + +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[Characters] \verb+0123456789+ +\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{LTXexample}[width=.3\linewidth] +\begin{pspicture}(3,1.2in) +\psbarcode[scalex=0.8,scaley=0.8]{9781860742712}{includetext guardwhitespace}{ean13} +\end{pspicture} +\end{LTXexample} + +\subsection{EAN-8} + +\begin{description} +\item[Characters] \verb+0123456789+ +\item[Data] 8 digits +\item[Options]~\\ + \begin{tabular}{l|l} + Option & Feature\\ + \hline + \texttt{includetext} & Enable human readable text\\ + \end{tabular} +\end{description} + +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(-2,-1.2)(0,0.2in) +\psbarcode[rotate=180,linecolor=red]{12345678}{includetext guardwhitespace height=0.6}{ean8} +\end{pspicture} +\end{LTXexample} + + +\subsection{UPC-A} + +\begin{description} +\item[Characters] \verb+0123456789+ +\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{LTXexample}[width=.3\linewidth] +\begin{pspicture}(3,1.2in) +\psbarcode[transx=15pt,transy=10pt]{78858101497}{includetext}{upca} +\qdisk(0,0){3pt}\rput[lb](5pt,-10pt){Origin} +\end{pspicture} +\end{LTXexample} + +\subsection{UPC-E} + +\begin{description} +\item[Characters] \verb+0123456789+ +\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{LTXexample}[width=.3\linewidth] +\begin{pspicture}(1.5,1.2in) +\psbarcode{0123456}{includetext}{upce} +\end{pspicture} +\end{LTXexample} + +\subsection{EAN-5} + +\begin{description} +\item[Characters] \verb+0123456789+ +\item[Data] 5 digits +\item[Options]~\\ + \begin{tabular}{l|l} + Option & Feature\\ \hline + \texttt{includetext} & Enable human readable text\\ + \end{tabular} +\end{description} + +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(2,1in) +\psbarcode{90200}{includetext guardwhitespace}{ean5} +\end{pspicture} +\end{LTXexample} + +\subsection{EAN-2} + +\begin{description} +\item[Characters] \verb+0123456789+ +\item[Data] 2 digits +\item[Options]~\\ + \begin{tabular}{l|l} + Option & Feature\\\hline + \texttt{includetext} & Enable human readable text\\ + \end{tabular} +\end{description} + +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(1,1in) +\psbarcode{38}{includetext guardwhitespace}{ean2} +\end{pspicture} +\end{LTXexample} + +\newpage +\subsection{ISBN} +An ISBN symbol is really an EAN-13 with a particular prefix, 978 for the older ISBN-10 format, and others for the new ISBN-13 format. + +\begin{description} +\item[Characters] \verb+-0123456789+ +\item[Data] 9 or 10 digits for ISBN-10 seperated appropriately with dashes +\item[Data] 12 or 13 digits for ISBN-13 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 (ISBN-10) or 12 (ISBN-13) digits are entered then the human readable, + ISBN check digit is calculated automatically +\end{description} + +\smallskip +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(3,1in) +\psbarcode{3-86541-114}{includetext guardwhitespace}{isbn} +\end{pspicture} +\end{LTXexample} + +\bigskip\enlargethispage{2ex} +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(3,1in) +\psbarcode{978-3-86541-114}{includetext guardwhitespace}{isbn} +\end{pspicture} +\end{LTXexample} + + +\subsection{Code-39} + +\begin{description} +\item[Characters] \verb+0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*+ %$ +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,1in) +\psbarcode{CODE-39}{includecheck includetext}{code39} +\end{pspicture} +\end{LTXexample} + +\subsection{Code-128 and UCC/EAN-128} + +\begin{description} +\item[Characters] \verb|!"#$%&'\(\)*+,-./0...9:;<=>?@A...Z[\\]^_`a...z|\verb+{|}~+ %$ +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,1in) +\psbarcode{^104^102Count^0991234^101!}{includetext}{code128} +\end{pspicture} +\end{LTXexample} + +\subsection{Rationalized Codabar} + +\begin{description} +\item[Characters] \verb!0123456789-$:/.+ABCD! %$ +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(4,1in) +\psbarcode{0123456789}{includetext}{rationalizedCodabar} +\end{pspicture} +\end{LTXexample} + + +\newpage +\subsection{Interleaved 2 of 5 and ITF-14} + +\begin{description} +\item[Characters] \verb!0123456789! +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,0.7in) +\psbarcode{05012345678900}{includecheck height=0.7}{interleaved2of5} +\end{pspicture} +\end{LTXexample} + +\subsection{Code 2 of 5} + +\begin{description} +\item[Characters] \verb!0123456789! +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,1.2in) +\psbarcode{0123456789}{includetext textpos=75 textfont=Helvetica textsize=16}{code2of5} +\end{pspicture} +\end{LTXexample} + + +\subsection{Postnet} + +\begin{description} +\item[Characters] \verb!0123456789! +\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{LTXexample}[width=.6\linewidth] +\begin{pspicture}(7,0.3in) +\psbarcode{01234567}{includetext textpos=-10 textfont=Arial textsize=10}{postnet} +\end{pspicture} +\end{LTXexample} + + +\subsection{Royal Mail} + +\begin{description} +\item[Characters] \verb!ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS! +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,0.5in) +\psbarcode{LE28HS9Z}{includetext}{royalmail} +\end{pspicture} +\end{LTXexample} + +\subsection{Kix (Customer index) -- Dutch Mail} + +\begin{description} +\item[Characters] \verb!ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRS! +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,0.3in) +\psbarcode{1203AA12}{includetext}{kix} +\end{pspicture} +\end{LTXexample} + + +\subsection{Australian postal service} + +\begin{description} +\item[Characters] \verb!ZUVWXY501234B6789AHCDEFGNIJKLMTOPQRSabc...xyz! +\item[Data] Variable number digits and 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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(5,0.3in) +\psbarcode{1139549554}{includetext}{auspost} +\end{pspicture} +\end{LTXexample} + +\subsection{onecode} +United States Postal Service, replaces POSTNET and PLANET symbols. +Each barcode can be 20, 25, 29, or 31 digits long, depending on the type of ZIP code present. Each digit has four possible states, so one digit represents numbers 0-3. +\begin{description} +\item[Characters] \verb!0123456789! +\item[Data] Variable number digits +\iffalse +\item[Options]~\\ + \begin{tabular}{l|l} + Option & Feature\\ \hline + \texttt{includetext} & Enable human readable text\\ + \end{tabular} +\fi +\end{description} + +\begin{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(5,0.3in) +\psbarcode{0123456709498765432101234567891}{includetext}{onecode} +\end{pspicture} +\end{LTXexample} + +\subsection{Symbol} +The purpose of the symbol encoder is to store the definitions of miscellaneous barcode +symbols such as the FIM symbols used by the US Postal Service on their reply mail. + + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fima}{}{symbol} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fimb}{}{symbol} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fimc}{}{symbol} +\end{pspicture} +\end{LTXexample} + +\begin{LTXexample}[width=.4\linewidth] +\begin{pspicture}(1cm,1.5cm) +\psbarcode{fimd}{}{symbol} +\end{pspicture} +\end{LTXexample} + + +\subsection{MSI} + +\begin{description} +\item[Characters] \verb!0123456789! +\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{LTXexample}[width=.5\linewidth] +\begin{pspicture}(6,1in) +\psbarcode{0123456789}{includecheck includetext}{msi} +\end{pspicture} +\end{LTXexample} + +\subsection{Plessey} + +\begin{description} +\item[Characters] \verb!01234B6789ABCDEF! +\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{LTXexample}[pos=t,preset=\centering] +\begin{pspicture}(0,-2mm)(12,1in) +\psbarcode{0123456789ABCDEF}{includetext}{plessey} +\end{pspicture} +\end{LTXexample} + +\subsection{Reduced Space Symbology (RSS)} +This is a family that includes RSS-14\textregistered, RSS Limited\textregistered, +and RSS Expanded\textregistered{} (\url{http://www.gs1.org/productssolutions/barcodes/technical/rss.html}). RSS-14 and RSS Limited encode Global Trade Item +Numbers (GTINs). RSS Expanded will encode any of the GS1 System identification +numbers as well as all other Application Identifiers. +RSS is used in the healthcare industry. + +\begin{description} +\item[Characters] \verb!0123456789! +\item[Data] Variable number digits +\end{description} + +\subsubsection{rss14} + +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{24012345678905}{height=0.3}{rss14} +\end{pspicture} +\end{LTXexample} + +\subsubsection{rsslimited} +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{00978186074271}{height=0.3}{rsslimited} +\end{pspicture} +\end{LTXexample} + +\subsubsection{rssexpanded} +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{000000010011001010100001000000010000}{height=0.3}{rssexpanded} +\end{pspicture} +\end{LTXexample} + + +\subsection{Pharmacode} +For a documentation see \url{http://www.laetus.com/laetus.php?request=file&id=69}. + +\begin{description} +\item[Characters] \verb!0123456789! +\item[Data] Variable number digits +\end{description} + +\begin{LTXexample}[width=.3\linewidth] +\begin{pspicture}(12,.3in) +\psbarcode{117480}{}{pharmacode} +\end{pspicture} +\end{LTXexample} + + + + +\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{lstlisting} +(78858101497) (includetext height=0.6) upca barcode +(0123456789) (includecheck) interleaved2of5 barcode +\end{lstlisting} + + +\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} & +String containing the integer 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. +\end{tabular} + +\end{center} + + +\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{lstlisting} +/code2of5 { + + 0 begin + +... + + end + +} bind def +/code2of5 load 0 1 dict put +\end{lstlisting} + +We start by immediately reading the contents strings that are passed as +arguments to this procedure by the user. + +\begin{lstlisting} + /options exch def + /barcode exch def +\end{lstlisting} + +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{lstlisting} + /includetext false def + /textfont /Courier def + /textsize 10 def + /textpos -7 def + /height 1 def +\end{lstlisting} + +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{lstlisting} +options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse +} loop +\end{lstlisting} + +Since any user given options create variables that are strings we need to convert +them back to their intended types. + +\begin{lstlisting} +/textfont textfont cvlit def +/textsize textsize cvr def +/textpos textpos cvr def +/height height cvr def +\end{lstlisting} + +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{lstlisting} + /encs + [ (1111313111) (3111111131) (1131111131) (3131111111) + (1111311131) (3111311111) (1131311111) (1111113131) + (3111113111) (1131113111) (313111) (311131) + ] def + + /barchars (0123456789) def +\end{lstlisting} + +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{lstlisting} + /barlen barcode length def + /sbs barlen 10 mul 12 add string def + /txt barlen array def +\end{lstlisting} + +We now begin to populate the space bar succession by adding the +encoding of the start character to the beginning. + +\begin{lstlisting} + sbs 0 encs 10 get putinterval +\end{lstlisting} + +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{lstlisting} + 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{lstlisting} + +The encoding for the end character is obtained and added to +the end of the space bar succession. + +\begin{lstlisting} + sbs barlen 10 mul 6 add encs 11 get putinterval +\end{lstlisting} + +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{lstlisting} + /retval 1 dict def + retval (sbs) sbs 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 +\end{lstlisting} + + +\subsection{The Renderer} + +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{lstlisting} +/barcode { + + 0 begin + +... + + end + +} bind def +/barcode load 0 1 dict put +\end{lstlisting} + +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{lstlisting} + /args exch def + /sbs args (sbs) get def + /bhs args (bhs) get def + /bbs args (bbs) get def +\end{lstlisting} + +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{lstlisting} + args (txt) known + { + /txt args (txt) get def + } + { + /txt [] def + } ifelse +\end{lstlisting} + +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{lstlisting} + /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 0.15 sub def + bars i 2 idiv [h c y w] put + } if + /x x d add def + } for +\end{lstlisting} + +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{lstlisting} + 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{lstlisting} + +\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} + +\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{lstlisting} +serverdict begin 0 exitserver +\end{lstlisting} + +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{lstlisting} +serverdict begin 0 exitserver systemdict /quit get exec +\end{lstlisting} + + + +\clearpage +\section{Package code} +\subsection{\texttt{pst-barcode.sty}} + +\lstinputlisting[xleftmargin=-1cm,xrightmargin=-1cm]{pst-barcode.sty} + +\subsection{\texttt{pst-barcode.tex}} +\lstinputlisting[xleftmargin=-1cm,xrightmargin=-1cm]{pst-barcode.tex} + +%\subsection{\texttt{pst-barcode.pro}} +%\lstinputlisting[language={},xleftmargin=-1.5cm,xrightmargin=-1.5cm]{pst-barcode.pro} +\end{document} + diff --git a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro index 0054cdac340..54cdffe33e8 100644 --- a/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro +++ b/Master/texmf-dist/dvips/pst-barcode/pst-barcode.pro @@ -4,10 +4,10 @@ %%EndComments %%EndProlog -% Barcode Writer in Pure PostScript - Version 2006-05-26 +% Barcode Writer in Pure PostScript - Version 2007-05-19 % http://www.terryburton.co.uk/barcodewriter/ % -% Copyright (c) 2006 Terry Burton - tez@terryburton.co.uk +% Copyright (c) 2007 Terry Burton - tez@terryburton.co.uk % % Permission is hereby granted, free of charge, to any % person obtaining a copy of this software and associated @@ -42,6 +42,9 @@ % --BEGIN TEMPLATE-- % --BEGIN ENCODER ean13-- +% --DESC: EAN-13 +% --EXAM: 977147396801 +% --EXOP: includetext guardwhitespace /ean13 { 0 begin @@ -180,6 +183,9 @@ % --END ENCODER ean13-- % --BEGIN ENCODER ean8-- +% --DESC: EAN-8 +% --EXAM: 01335583 +% --EXOP: includetext guardwhitespace height=0.5 /ean8 { 0 begin @@ -278,6 +284,9 @@ % --END ENCODER ean8-- % --BEGIN ENCODER upca-- +% --DESC: UPC-A +% --EXAM: 78858101497 +% --EXOP: includetext /upca { 0 begin @@ -403,6 +412,9 @@ % --END ENCODER upca-- % --BEGIN ENCODER upce-- +% --DESC: UPC-E +% --EXAM: 0123456 +% --EXOP: includetext height=0.4 /upce { 0 begin @@ -447,18 +459,37 @@ % Add checksum digit to barcode if length is odd barlen 2 mod 0 ne { - /pad barlen 1 add string def % Create pad one bigger than barcode + % Derive the equivalent UPC-A for its checksum + /upcacode (00000000000) def + barcode 6 get 48 sub 2 le { + upcacode 1 barcode 1 2 getinterval putinterval + upcacode 3 barcode 6 1 getinterval putinterval + upcacode 8 barcode 3 3 getinterval putinterval + } if + barcode 6 get 48 sub 3 eq { + upcacode 1 barcode 1 3 getinterval putinterval + upcacode 9 barcode 4 2 getinterval putinterval + } if + barcode 6 get 48 sub 4 eq { + upcacode 1 barcode 1 4 getinterval putinterval + upcacode 10 barcode 5 1 getinterval putinterval + } if + barcode 6 get 48 sub 5 ge { + upcacode 1 barcode 1 5 getinterval putinterval + upcacode 10 barcode 6 1 getinterval putinterval + } if /checksum 0 def - 0 1 barlen 1 sub { - /i exch def - /barchar barcode i get 48 sub def - i 2 mod 0 ne { - /checksum barchar checksum add def - } { - /checksum barchar 3 mul checksum add def - } ifelse + 0 1 10 { + /i exch def + /barchar upcacode i get 48 sub def + i 2 mod 0 ne { + /checksum checksum barchar add def + } { + /checksum checksum barchar 3 mul add def + } ifelse } for /checksum 10 checksum 10 mod sub 10 mod def + /pad barlen 1 add string def % Create pad one bigger than barcode pad 0 barcode putinterval % Add barcode to the start of the pad pad barlen checksum 48 add put % Put ascii for checksum at end of pad /barcode pad def % barcode=pad @@ -538,6 +569,9 @@ % --END ENCODER upce-- % --BEGIN ENCODER ean5-- +% --DESC: EAN-5 (5 digit addon) +% --EXAM: 90200 +% --EXOP: includetext guardwhitespace /ean5 { 0 begin @@ -651,6 +685,9 @@ % --END ENCODER ean5-- % --BEGIN ENCODER ean2-- +% --DESC: EAN-2 (2 digit addon) +% --EXAM: 05 +% --EXOP: includetext guardwhitespace /ean2 { 0 begin @@ -750,6 +787,9 @@ % --BEGIN ENCODER isbn-- % --REQUIRES ean13-- +% --DESC: ISBN +% --EXAM: 978-1-56592-479 +% --EXOP: includetext guardwhitespace /isbn { 0 begin @@ -864,6 +904,9 @@ % --END ENCODER isbn-- % --BEGIN ENCODER code128-- +% --DESC: Code 128 +% --EXAM: ^104^102Count^0990123456789^101! +% --EXOP: includetext /code128 { 0 begin % Confine variables to local scope @@ -982,6 +1025,9 @@ % --END ENCODER code128-- % --BEGIN ENCODER code39-- +% --DESC: Code 39 +% --EXAM: THIS IS CODE 39 +% --EXOP: includetext includecheck includecheckintext /code39 { 0 begin % Confine variables to local scope @@ -1088,6 +1134,9 @@ % --END ENCODER code39-- % --BEGIN ENCODER code93-- +% --DESC: Code 93 +% --EXAM: THIS IS CODE 93 +% --EXOP: includetext includecheck /code93 { 0 begin % Confine variables to local scope @@ -1202,6 +1251,9 @@ % --END ENCODER code93-- % --BEGIN ENCODER interleaved2of5-- +% --DESC: Interleaved 2 of 5 (ITF) +% --EXAM: 24012345678905 +% --EXOP: showborder borderwidth=4 borderleft=15 borderright=15 height=0.5 includecheck includetext includecheckintext textpos=-10 /interleaved2of5 { 0 begin % Confine variables to local scope @@ -1331,6 +1383,9 @@ % --END ENCODER interleaved2of5-- % --BEGIN ENCODER rss14-- +% --DESC: Reduced Space Symbology 14 (RSS-14) +% --EXAM: 24012345678905 +% --EXOP: height=0.3 /rss14 { 0 begin % Confine variables to local scope @@ -1551,6 +1606,9 @@ % --END ENCODER rss14-- % --BEGIN ENCODER rsslimited-- +% --DESC: Reduced Space Symbology Limited (RSS-Limited) +% --EXAM: 00978186074271 +% --EXOP: height=0.3 /rsslimited { 0 begin % Confine variables to local scope @@ -1724,6 +1782,9 @@ % --END ENCODER rsslimited-- % --BEGIN ENCODER rssexpanded-- +% --DESC: Reduced Space Symbology Expanded (RSS-Expanded) +% --EXAM: 000000010011001010100001000000010000 +% --EXOP: height=0.3 /rssexpanded { 0 begin % Confine variables to local scope @@ -1925,7 +1986,70 @@ /rssexpanded load 0 1 dict put % --END ENCODER rssexpanded-- +% --BEGIN ENCODER pharmacode-- +% --DESC: Pharmaceutical Binary Code +% --EXAM: 117480 +% --EXOP: showborder +/pharmacode { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /barcode exch def % We are given a barcode string + + /height 8 2.835 mul 72 div def + /nwidth 0.5 2.835 mul def + /wwidth 1.5 2.835 mul def + /swidth 1.0 2.835 mul def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + + /height height cvr def + /nwidth nwidth cvr def + /wwidth wwidth cvr def + /swidth swidth cvr def + + % Convert the integer into the paramacode string + /barcode barcode cvi 1 add 2 17 string cvrs def + /barcode barcode 1 barcode length 1 sub getinterval def + + /barlen barcode length def % Length of the code + /sbs barlen 2 mul array def + + 0 1 barlen 1 sub { + /i exch def + /enc barcode i 1 getinterval def + enc (0) eq { + sbs i 2 mul nwidth put + } { + sbs i 2 mul wwidth put + } ifelse + sbs i 2 mul 1 add swidth put + } for + + % Return the arguments + /retval 2 dict def + retval (sbs) sbs put + retval (bhs) [sbs length 1 add 2 idiv {height} repeat] put + retval (bbs) [sbs length 1 add 2 idiv {0} repeat] put + retval (opt) useropts put + retval + + end + +} bind def +/pharmacode load 0 1 dict put +% --END ENCODER pharmacode-- + % --BEGIN ENCODER code2of5-- +% --DESC: Code 25 +% --EXAM: 01234567 +% --EXOP: includetext includecheck includecheckintext /code2of5 { % Thanks to Michael Landers @@ -2029,6 +2153,9 @@ % --END ENCODER code2of5-- % --BEGIN ENCODER code11-- +% --DESC: Code 11 +% --EXAM: 0123456789 +% --EXOP: includetext includecheck includecheckintext /code11 { 0 begin % Confine variables to local scope @@ -2154,6 +2281,9 @@ % --END ENCODER code11-- % --BEGIN ENCODER rationalizedCodabar-- +% --DESC: Rationalized Codabar +% --EXAM: A0123456789B +% --EXOP: includetext includecheck includecheckintext /rationalizedCodabar { 0 begin % Confine variables to local scope @@ -2268,6 +2398,9 @@ % --END ENCODER rationalizedCodabar-- % --BEGIN ENCODER onecode-- +% --DESC: United States Postal Service OneCode +% --EXAM: 0123456709498765432101234567891 +% --EXOP: barcolor=FF0000 /onecode { 0 begin @@ -2532,10 +2665,11 @@ % --END ENCODER onecode-- % --BEGIN ENCODER postnet-- +% --DESC: United States Postal Service Postnet +% --EXAM: 012345 +% --EXOP: includetext includecheckintext /postnet { - % Thanks to Ross McFarland - 0 begin /options exch def % We are given an option string @@ -2645,6 +2779,9 @@ % --END ENCODER postnet-- % --BEGIN ENCODER royalmail-- +% --DESC: Royal Mail 4 State Customer Code (RM4SCC) +% --EXAM: LE28HS9Z +% --EXOP: includetext includecheckintext barcolor=FF0000 /royalmail { 0 begin @@ -2761,6 +2898,9 @@ % --END ENCODER royalmail-- % --BEGIN ENCODER auspost-- +% --DESC: AusPost 4 State Customer Code +% --EXAM: 5956439111ABA 9 +% --EXOP: includetext custinfoenc=character /auspost { 0 begin @@ -2949,6 +3089,9 @@ % --END ENCODER auspost-- % --BEGIN ENCODER kix-- +% --DESC: Royal Dutch TPG Post KIX 4-State Barcode +% --EXAM: 1231FZ13XHS +% --EXOP: includetext includecheckintext /kix { 0 begin @@ -3044,6 +3187,9 @@ % --END ENCODER kix-- % --BEGIN ENCODER msi-- +% --DESC: MSI Modified Plessey +% --EXAM: 0123456789 +% --EXOP: includetext includecheck includecheckintext /msi { 0 begin % Confine variables to local scope @@ -3145,6 +3291,9 @@ % --END ENCODER msi-- % --BEGIN ENCODER plessey-- +% --DESC: Plessey +% --EXAM: 01234ABCD +% --EXOP: includetext includecheckintext /plessey { 0 begin % Confine variables to local scope @@ -3262,7 +3411,45 @@ /plessey load 0 1 dict put % --END ENCODER plessey-- +% --BEGIN ENCODER raw-- +% --DESC: Raw bar space succession for custom symbologies +% --EXAM: 331132131313411122131311333213114131131221323 +% --EXOP: height=0.5 +/raw { + + 0 begin % Confine variables to local scope + + /options exch def % We are given an option string + /useropts options def + /sbs exch def % We are given a barcode string + + /height 1 def + + % Parse the input options + options { + token false eq {exit} if dup length string cvs (=) search + true eq {cvlit exch pop exch def} {cvlit true def} ifelse + } loop + /height height cvr def + + % Return the arguments + /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 + retval (opt) useropts put + retval + + end + +} bind def +/raw load 0 1 dict put +% --END ENCODER raw-- + % --BEGIN ENCODER symbol-- +% --DESC: Miscellaneous symbols +% --EXAM: fima +% --EXOP: backgroundcolor=DD000011 /symbol { 0 begin % Confine variables to local scope @@ -3399,6 +3586,17 @@ width 72 mul x div 1 scale } if + % Set RGB or CMYK color depending on length of given hex string + /setanycolor { + /anycolor exch def + anycolor length 6 eq { + (< >) dup 1 anycolor putinterval cvx exec {255 div} forall setrgbcolor + } if + anycolor length 8 eq { + (< >) dup 1 anycolor putinterval cvx exec {255 div} forall setcmykcolor + } if + } bind def + % Display the border and background newpath borderleft neg borderbottom neg moveto @@ -3407,26 +3605,17 @@ x borderleft add borderright add neg 0 rlineto 0 maxh borderbottom add bordertop add neg rlineto closepath - backgroundcolor (unset) ne { - gsave - (< >) dup 1 backgroundcolor putinterval cvx exec {255 div} forall setrgbcolor - fill - grestore - } if + backgroundcolor (unset) ne { gsave backgroundcolor setanycolor fill grestore } if showborder { gsave - bordercolor (unset) ne { - (< >) dup 1 bordercolor putinterval cvx exec {255 div} forall setrgbcolor - } if + bordercolor (unset) ne { bordercolor setanycolor } if borderwidth setlinewidth stroke grestore } if % Display the bars for elements in the bars array gsave - barcolor (unset) ne { - (< >) dup 1 barcolor putinterval cvx exec {255 div} forall setrgbcolor - } if + barcolor (unset) ne { barcolor setanycolor } if bars { {} forall newpath setlinewidth moveto 0 exch rlineto stroke @@ -3434,9 +3623,7 @@ grestore % Display the text for elements in the text array - textcolor (unset) ne { - (< >) dup 1 textcolor putinterval cvx exec {255 div} forall setrgbcolor - } if + textcolor (unset) ne { textcolor setanycolor } if /s 0 def /f () def txt { {} forall diff --git a/Master/texmf-dist/source/generic/pst-barcode/Makefile b/Master/texmf-dist/source/generic/pst-barcode/Makefile new file mode 100644 index 00000000000..db682c2ff2d --- /dev/null +++ b/Master/texmf-dist/source/generic/pst-barcode/Makefile @@ -0,0 +1,49 @@ + +# `Makefile' for `pst-coil.pdf', hv, 2006/08/11 + +.SUFFIXES : .tex .ltx .dvi .ps .pdf .eps + +PACKAGE = pst-barcode + +MAIN = pst-barcode-doc + +LATEX = latex + +ARCHNAME = $(MAIN)-$(shell date +%y%m%d) + +ARCHFILES = $(PACKAGE).sty $(PACKAGE).tex $(PACKAGE).pro $(MAIN).tex README Changes Makefile + +all : doc +# clean +doc: $(MAIN).pdf + +$(MAIN).pdf : $(MAIN).ps + GS_OPTIONS=-dAutoRotatePages=/None ps2pdf $< + +$(MAIN).ps : $(MAIN).dvi + dvips $< + +$(MAIN).dvi : $(MAIN).tex + $(LATEX) $< + $(LATEX) $< + if ! test -f $(basename $<).glo ; then touch $(basename $<).glo; fi + if ! test -f $(basename $<).idx ; then touch $(basename $<).idx; fi + makeindex -s gglo.ist -t $(basename $<).glg -o $(basename $<).gls \ + $(basename $<).glo + makeindex -t $(basename $<).ilg -o $(basename $<).ind \ + $(basename $<).idx + bibtex $(basename $<) + $(LATEX) $< + $(LATEX) $< + +clean : + $(RM) $(addprefix $(MAIN), .log .aux .glg .glo .gls .ilg .idx .ind .tmp .toc .out ) + $(RM) $(addprefix $(MAIN), .dvi .ps) + +veryclean : clean + $(RM) $(addprefix $(MAIN), .pdf .bbl .blg) + +arch : + zip $(ARCHNAME).zip $(ARCHFILES) + +# EOF diff --git a/Master/texmf-dist/tpm/pst-barcode.tpm b/Master/texmf-dist/tpm/pst-barcode.tpm index 68e2f0af0b6..c9b172d49b4 100644 --- a/Master/texmf-dist/tpm/pst-barcode.tpm +++ b/Master/texmf-dist/tpm/pst-barcode.tpm @@ -3,7 +3,7 @@ pst-barcode Package - 2006/10/18 20:45:25 + 2007/05/22 19:33:00 karl Print barcodes using Postscript. @@ -22,18 +22,22 @@ distillation mechansism such as ps2pdf. 376037 - + texmf-dist/dvips/pst-barcode/pst-barcode.pro texmf-dist/tex/generic/pst-barcode/pst-barcode.tex texmf-dist/tex/latex/pst-barcode/pst-barcode.sty texmf-dist/tpm/pst-barcode.tpm - + texmf-dist/doc/generic/pst-barcode/Changes texmf-dist/doc/generic/pst-barcode/README -texmf-dist/doc/generic/pst-barcode/barcode.pdf -texmf-dist/doc/generic/pst-barcode/barcode.tex +texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.bib +texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf +texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.tex + +texmf-dist/source/generic/pst-barcode/Makefile + Package/pst-barcode diff --git a/Master/texmf/lists/pst-barcode b/Master/texmf/lists/pst-barcode index 7a8bd77cf98..86656d52a33 100644 --- a/Master/texmf/lists/pst-barcode +++ b/Master/texmf/lists/pst-barcode @@ -1,8 +1,9 @@ texmf-dist/doc/generic/pst-barcode/Changes texmf-dist/doc/generic/pst-barcode/README -texmf-dist/doc/generic/pst-barcode/barcode.pdf -texmf-dist/doc/generic/pst-barcode/barcode.tex - +texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.bib +texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.pdf +texmf-dist/doc/generic/pst-barcode/pst-barcode-doc.tex +texmf-dist/source/generic/pst-barcode/Makefile texmf-dist/dvips/pst-barcode/pst-barcode.pro texmf-dist/tex/generic/pst-barcode/pst-barcode.tex texmf-dist/tex/latex/pst-barcode/pst-barcode.sty -- cgit v1.2.3