How to Print Text and Text Files in Delphi

This code how to print text and text files. This is the simplest way to print without using any external functions. All you have to do is open the LPT1 port (this is the default printer port) as if it where a file.

This code can be easily ported to Turbo Pascal (just change the function and variable type names).

var
  fPrinter: TextFile;
begin
  (* Write your printing code here. For files you may want to use a "for"
  ** or "while not Eof(fPrinter)" statement.
  **
  ** Example: WriteLn(fPrinter, 'The text you want to print.');
  *)
  AssignFile(fPrinter, 'LPT1');
  Rewrite(fPrinter);
  CloseFile(fPrinter);
end;

Tags: , , , , , , , , , , , , , , , , ,

No Comments Yet

You can be the first to comment!

Leave a comment

OpenID Login

Standard Login