%
%   $Id$
%   This file is part of the FPC documentation.
%   Copyright (C) 1997, by Michael Van Canneyt
%
%   The FPC documentation is free text; you can redistribute it and/or
%   modify it under the terms of the GNU Library General Public License as
%   published by the Free Software Foundation; either version 2 of the
%   License, or (at your option) any later version.
%
%   The FPC Documentation is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Library General Public License for more details.
%
%   You should have received a copy of the GNU Library General Public
%   License along with the FPC documentation; see the file COPYING.LIB.  If not,
%   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
%   Boston, MA 02111-1307, USA. 
%
\chapter{The PRINTER unit.}
This chapter describes the PRINTER unit for Free Pascal. It was written for
\dos by Florian kl\"ampfl, and it was written for \linux by Micha\"el Van 
Canneyt, and has been ported to \windows as well. 
Its basic functionality is the same for both systems, although there are 
minor differences on \linux.

The chapter is divided in 2 sections:
\begin{itemize}
\item The first section lists types, constants and variables from the
interface part of the unit.
\item The second section describes the functions defined in the unit.
\end{itemize}
\section {Types, Constants and variables : }
\begin{verbatim}
var 
  lst : text;
\end{verbatim}
\var{Lst} is the standard printing device. \\ On \linux, 
\var{Lst} is set up using \var{AssignLst('/tmp/PID.lst')}. 
You can change this behaviour at compile time, setting the DefFile constant.
\section {Procedures and functions}
\begin{procedure}{AssignLst}
\Declaration
Procedure AssignLst  ( Var F : text; ToFile : string[255]);

\Description
 \linux only. \\
 Assigns to F a printing device. ToFile is a string with the following form:
\begin{itemize}
\item \var{ '|filename options'}  : This sets up a pipe with the program filename,
             with the given options, such as in the popen() call.
\item \var{ 'filename'} : Prints to file filename. Filename can contain the string 'PID'
              (No Quotes), which will be replaced by the PID of your program.
              When closing lst, the file will be sent to lpr and deleted.
              (lpr should be in PATH)
                
\item \var {'filename|'} Idem as previous, only the file is NOT sent to lpr, nor is it
             deleted.
             (useful for opening /dev/printer or for later printing)
\end{itemize}

\Errors
 Errors are reported in Linuxerror.
\SeeAlso
\seem{lpr}{1}
\end{procedure}
\latex{\lstinputlisting{printex/printex.pp}}
\html{\input{printex/printex.tex}}
