printer.tex 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The PRINTER unit.}
  22. \label{ch:printerunit}
  23. \FPCexampledir{printex}
  24. This chapter describes the PRINTER unit for Free Pascal. It was written for
  25. \dos by Florian Kl\"ampfl, and it was written for \linux by Micha\"el Van
  26. Canneyt, and has been ported to \windows and \ostwo as well.
  27. Its basic functionality is the same for al supported systems, although there
  28. are minor differences on \linux.
  29. The chapter is divided in 2 sections:
  30. \begin{itemize}
  31. \item The first section lists types, constants and variables from the
  32. interface part of the unit.
  33. \item The second section describes the functions defined in the unit.
  34. \end{itemize}
  35. \section {Types, Constants and variables : }
  36. \begin{verbatim}
  37. var
  38. lst : text;
  39. \end{verbatim}
  40. \var{Lst} is the standard printing device. \\ On \linux,
  41. \var{Lst} is set up using \var{AssignLst('/tmp/PID.lst')}.
  42. You can change this behaviour at compile time, setting the DefFile constant.
  43. \section {Procedures and functions}
  44. \begin{procedure}{AssignLst}
  45. \Declaration
  46. Procedure AssignLst ( Var F : text; ToFile : string[255]);
  47. \Description
  48. \linux only. \\
  49. Assigns to F a printing device. ToFile is a string with the following form:
  50. \begin{itemize}
  51. \item \var{ '|filename options'} : This sets up a pipe with the program filename,
  52. with the given options, such as in the popen() call.
  53. \item \var{ 'filename'} : Prints to file filename. Filename can contain the string 'PID'
  54. (No Quotes), which will be replaced by the PID of your program.
  55. When closing lst, the file will be sent to lpr and deleted.
  56. (lpr should be in PATH)
  57. \item \var {'filename|'} Idem as previous, only the file is NOT sent to lpr, nor is it
  58. deleted.
  59. (useful for opening /dev/printer or for later printing)
  60. \end{itemize}
  61. \Errors
  62. Errors are reported in Linuxerror.
  63. \SeeAlso
  64. \seem{lpr}{1}
  65. \end{procedure}
  66. \FPCexample{printex}