My objective is to create a table or some form of environment as shown in the figure below.
The numbers should be randomly generated every time you compile and have the font shown below.

Is this possible?
My objective is to create a table or some form of environment as shown in the figure below.
The numbers should be randomly generated every time you compile and have the font shown below.

Is this possible?
You could use TikZ nodes and pgf made random numbers, for example:
\documentclass{article}
\usepackage{tikz}
\usepackage[T1]{fontenc}
\usepackage[ocr-a]{ocr}
\usetikzlibrary{chains,positioning}
\usepackage{datetime}
\pgfmathparse{\year+\time+\currenthour+\currentminute*\currentsecond}
\pgfmathsetseed{\pgfmathresult}
\begin{document}
\begin{tikzpicture}[start chain=1 going right,node distance=-0.4pt]
\foreach \x in {1,2,...,15} {
\node (\x) [draw,on chain=1] {\pgfmathparse{random(0,9)}\ocr{\pgfmathresult}};}
\node [above of=1,anchor=south west,yshift=2ex,xshift=-2.4ex]
{Do not write in this area};
\node [below of=1,anchor=north west,yshift=-2ex,xshift=-2.4ex]
{\scshape Each document must have a unique serial number};
\end{tikzpicture}
\end{document}
The output, using ocr-a numbers, as Mico advised in his comment below:

To get different numbers for each compilation, you could initialize the random number generator yourself by
\pgfmathsetseed{<integer>}
By default, it's the value of \time*\year. So it would't change during each compilation, so I used the datetime package to use also minutes and seconds for calculating the seed. So the random values should change each second. You could also use values or counters in your .aux file instead.
You can get the ocr-a font from CTAN: http://ctan.org/pkg/ocr-a.
If you don't manage to install it, a quick workaround: you could load the mf and tfm files (for example from here), put them into your document directory and run (with fontenc and ocr as above) - it worked for me.
\usepackage[T1]{fontenc} and \usepackage[ocr-a]{ocr} in the preamble, and then encase the command that outputs the digits in \ocr{...}, to get the displayed numbers to show up in OCR-A.
– Mico
Jan 21 '12 at 19:48
\pgfmathparse and \pgfmathsetseed commands in the preamble! Don't really understand why.
– Nikos Alexandris
Oct 04 '12 at 00:07
On the off-chance that you're unable to manage the fonts, you can download the OCR-A numeral SVG and convert it to PDF (say) using Inkscape. Then, include each numeral via the traditional \includegraphics (from graphicx) with some appropriate trim-and-clip:

\documentclass{article}
\usepackage{tikz}% http://ctan.org/pkg/pgf
%\usepackage{graphicx}% http://ctan.org/pkg/graphicx (implicitly loaded by tikz)
\usetikzlibrary{chains}
\begin{document}
% Extract numerals from image
\expandafter\def\csname ocr-a-0\endcsname{\includegraphics[width=2ex,trim=0 0 4990 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-1\endcsname{\includegraphics[width=2ex,trim=554 0 4438 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-2\endcsname{\includegraphics[width=2ex,trim=1109 0 3882 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-3\endcsname{\includegraphics[width=2ex,trim=1664 0 3327 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-4\endcsname{\includegraphics[width=2ex,trim=2218 0 2773 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-5\endcsname{\includegraphics[width=2ex,trim=2773 0 2218 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-6\endcsname{\includegraphics[width=2ex,trim=3327 0 1664 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-7\endcsname{\includegraphics[width=2ex,trim=3883 0 1109 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-8\endcsname{\includegraphics[width=2ex,trim=4437 0 555 0,clip]{ocr-a}}%
\expandafter\def\csname ocr-a-9\endcsname{\includegraphics[width=2ex,trim=4991 0 0 0,clip]{ocr-a}}%
\begin{tikzpicture}[start chain=1 going right,node distance=-0.4pt]
\foreach \x in {1,2,...,15} {
\node [draw,on chain=1] {\pgfmathparse{random(9)}\csname ocr-a-\pgfmathresult\endcsname};}
\end{tikzpicture}
\end{document}
In the above example there is no need for an explicit loading of graphicx, since tikz already loads it.
The following steps were following in Inkscape:
Open the document:

Save as PDF:

trim match the original downloaded SVG. If you download the lower resolution PNG, you would need different coordinates.
– Werner
Jan 21 '12 at 20:27
ocr-a to work?
– Nikos Alexandris
Sep 13 '12 at 10:03
ocrfont package. Typetexdoc ocron a command line to get more information about this package. – Mico Jan 21 '12 at 19:52